Skip to content

Commit 4c9bce7

Browse files
committed
chore: fixed recentPads being null
1 parent a9c91ac commit 4c9bce7

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

src/node/hooks/express/specialpages.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,13 +70,11 @@ exports.expressPreSession = async (hookName:string, {app}:ArgsExpressType) => {
7070
}
7171

7272

73-
console.log("Favicon is", settings.favicon)
7473
const fns = [
7574
...(settings.favicon ? [path.resolve(settings.root, settings.favicon)] : []),
7675
settings.skinName && path.join(settings.root, 'src', 'static', 'skins', settings.skinName, 'favicon.ico'),
7776
path.join(settings.root, 'src', 'static', 'favicon.ico'),
7877
].filter(f=>f != null);
79-
console.log('FNS are', fns)
8078
for (const fn of fns) {
8179
try {
8280
await fsp.access(fn, fs.constants.R_OK);

src/static/js/pad_userlist.ts

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -489,15 +489,17 @@ const paduserlist = (() => {
489489
online++;
490490
}
491491
}
492-
const recentPadsList = JSON.parse(localStorage.getItem('recentPads'));
493-
const pathSegments = window.location.pathname.split('/');
494-
const padName = pathSegments[pathSegments.length - 1];
495-
const existingPad = recentPadsList.find((pad) => pad.name === padName);
496-
if (existingPad) {
497-
existingPad.members = online;
498-
}
499-
localStorage.setItem('recentPads', JSON.stringify(recentPadsList));
500492

493+
if (localStorage.getItem('recentPads') != null) {
494+
const recentPadsList = JSON.parse(localStorage.getItem('recentPads'));
495+
const pathSegments = window.location.pathname.split('/');
496+
const padName = pathSegments[pathSegments.length - 1];
497+
const existingPad = recentPadsList.find((pad) => pad.name === padName);
498+
if (existingPad) {
499+
existingPad.members = online;
500+
}
501+
localStorage.setItem('recentPads', JSON.stringify(recentPadsList));
502+
}
501503

502504
$('#online_count').text(online);
503505

0 commit comments

Comments
 (0)