Pokemon_server / dist /server /chat-plugins /daily-spotlight.js.map
Jofthomas's picture
Jofthomas HF staff
Upload 4781 files
5c2ed06 verified
{
"version": 3,
"sources": ["../../../server/chat-plugins/daily-spotlight.ts"],
"sourcesContent": ["import { FS, Utils } from '../../lib';\n\nconst DAY = 24 * 60 * 60 * 1000;\nconst SPOTLIGHT_FILE = 'config/chat-plugins/spotlights.json';\nconst NUMBER_REGEX = /^\\s*[0-9]+\\s*$/;\n\n/** legacy - string = just url, arr is [url, width, height] */\ntype StoredImage = string | [string, number, number];\n\ninterface Spotlight {\n\timage?: StoredImage;\n\tdescription: string;\n\ttime: number;\n}\n\nexport let spotlights: {\n\t[roomid: string]: { [k: string]: Spotlight[] },\n} = {};\n\ntry {\n\tspotlights = JSON.parse(FS(SPOTLIGHT_FILE).readIfExistsSync() || \"{}\");\n\tfor (const roomid in spotlights) {\n\t\tfor (const k in spotlights[roomid]) {\n\t\t\tfor (const spotlight of spotlights[roomid][k]) {\n\t\t\t\tif (!spotlight.time) {\n\t\t\t\t\tspotlight.time = Date.now();\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n} catch (e: any) {\n\tif (e.code !== 'MODULE_NOT_FOUND' && e.code !== 'ENOENT') throw e;\n}\nif (!spotlights || typeof spotlights !== 'object') spotlights = {};\n\nfunction saveSpotlights() {\n\tFS(SPOTLIGHT_FILE).writeUpdate(() => JSON.stringify(spotlights));\n}\n\nfunction nextDaily() {\n\tfor (const roomid in spotlights) {\n\t\tfor (const key in spotlights[roomid]) {\n\t\t\tif (spotlights[roomid][key].length > 1) {\n\t\t\t\tspotlights[roomid][key].shift();\n\t\t\t}\n\t\t}\n\t}\n\n\tsaveSpotlights();\n\ttimeout = setTimeout(nextDaily, DAY);\n}\n\nconst midnight = new Date();\nmidnight.setHours(24, 0, 0, 0);\nlet timeout = setTimeout(nextDaily, midnight.getTime() - Date.now());\n\nexport async function renderSpotlight(roomid: RoomID, key: string, index: number) {\n\tlet imgHTML = '';\n\tconst { image, description } = spotlights[roomid][key][index];\n\n\tif (image) {\n\t\tif (Array.isArray(image)) {\n\t\t\timgHTML = `<td><img src=\"${image[0]}\" width=\"${image[1]}\" height=\"${image[2]}\" style=\"vertical-align:middle;\"></td>`;\n\t\t} else {\n\t\t\t// legacy format\n\t\t\ttry {\n\t\t\t\tconst [width, height] = await Chat.fitImage(image, 150, 300);\n\t\t\t\timgHTML = `<td><img src=\"${image}\" width=\"${width}\" height=\"${height}\" style=\"vertical-align:middle;\"></td>`;\n\t\t\t\t// eslint-disable-next-line require-atomic-updates\n\t\t\t\tspotlights[roomid][key][index].image = [image, width, height];\n\t\t\t} catch {}\n\t\t}\n\t}\n\n\treturn `<table style=\"text-align:center;margin:auto\"><tr><td style=\"padding-right:10px;\">${Chat.formatText(description, true)}</td>${imgHTML}</tr></table>`;\n}\n\nexport const destroy = () => clearTimeout(timeout);\n\nexport const pages: Chat.PageTable = {\n\tasync spotlights(query, user, connection) {\n\t\tthis.title = 'Daily Spotlights';\n\t\tconst room = this.requireRoom();\n\t\tquery.shift(); // roomid\n\t\tconst sortType = toID(query.shift());\n\t\tif (sortType && !['time', 'alphabet'].includes(sortType)) {\n\t\t\treturn this.errorReply(`Invalid sorting type '${sortType}' - must be either 'time', 'alphabet', or not provided.`);\n\t\t}\n\n\t\tlet buf = `<div class=\"pad ladder\">`;\n\t\tbuf += `<div class=\"pad\">`;\n\t\tbuf += `<button style=\"float:right;\" class=\"button\" name=\"send\" value=\"/join view-spotlights-${room.roomid}${sortType ? '-' + sortType : ''}\">`;\n\t\tbuf += `<i class=\"fa fa-refresh\"></i> Refresh</button>`;\n\t\tbuf += `<h2>Daily Spotlights</h2>`;\n\t\t// for posterity, all these switches are futureproofing for more sort types\n\t\tif (sortType) {\n\t\t\tlet title = '';\n\t\t\tswitch (sortType) {\n\t\t\tcase 'time':\n\t\t\t\ttitle = 'latest time updated';\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\ttitle = 'alphabetical';\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tbuf += `(sorted by ${title})<br />`;\n\t\t}\n\t\tif (!spotlights[room.roomid]) {\n\t\t\tbuf += `<p>This room has no daily spotlights.</p></div>`;\n\t\t} else {\n\t\t\tconst sortedKeys = Utils.sortBy(Object.keys(spotlights[room.roomid]), key => {\n\t\t\t\tswitch (sortType) {\n\t\t\t\tcase 'time': {\n\t\t\t\t\t// find most recently added/updated spotlight in that key, sort all by that\n\t\t\t\t\tconst sortedSpotlights = Utils.sortBy(spotlights[room.roomid][key].slice(), k => -k.time);\n\t\t\t\t\treturn -sortedSpotlights[0].time;\n\t\t\t\t}\n\t\t\t\t// sort alphabetically by key otherwise\n\t\t\t\tdefault:\n\t\t\t\t\treturn key;\n\t\t\t\t}\n\t\t\t});\n\t\t\tfor (const key of sortedKeys) {\n\t\t\t\tbuf += `<table style=\"margin-bottom:30px;\"><th colspan=\"2\"><h3>${key}:</h3></th>`;\n\t\t\t\tconst keys = Utils.sortBy(spotlights[room.roomid][key].slice(), spotlight => {\n\t\t\t\t\tswitch (sortType) {\n\t\t\t\t\tcase 'time':\n\t\t\t\t\t\treturn -spotlight.time;\n\t\t\t\t\tdefault:\n\t\t\t\t\t\treturn spotlight.description;\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t\tfor (const [i] of keys.entries()) {\n\t\t\t\t\tconst html = await renderSpotlight(room.roomid, key, i);\n\t\t\t\t\tbuf += `<tr><td>${i ? i : 'Current'}</td><td>${html}</td></tr>`;\n\t\t\t\t\tif (!user.can('announce', null, room)) break;\n\t\t\t\t}\n\t\t\t\tbuf += '</table>';\n\t\t\t}\n\t\t}\n\t\treturn buf;\n\t},\n};\n\nexport const commands: Chat.ChatCommands = {\n\tremovedaily(target, room, user) {\n\t\troom = this.requireRoom();\n\t\tif (!room.persist) return this.errorReply(\"This command is unavailable in temporary rooms.\");\n\t\tlet [key, rest] = target.split(',');\n\t\tkey = toID(key);\n\t\tif (!key) return this.parse('/help daily');\n\t\tif (!spotlights[room.roomid][key]) return this.errorReply(`Cannot find a daily spotlight with name '${key}'`);\n\n\t\tthis.checkCan('announce', null, room);\n\t\tif (rest) {\n\t\t\tconst queueNumber = parseInt(rest);\n\t\t\tif (isNaN(queueNumber) || queueNumber < 1) return this.errorReply(\"Invalid queue number\");\n\t\t\tif (queueNumber >= spotlights[room.roomid][key].length) {\n\t\t\t\treturn this.errorReply(`Queue number needs to be between 1 and ${spotlights[room.roomid][key].length - 1}`);\n\t\t\t}\n\t\t\tspotlights[room.roomid][key].splice(queueNumber, 1);\n\t\t\tsaveSpotlights();\n\n\t\t\tthis.modlog(`DAILY REMOVE`, `${key}[${queueNumber}]`);\n\t\t\tthis.privateModAction(\n\t\t\t\t`${user.name} removed the ${queueNumber}th entry from the queue of the daily spotlight named '${key}'.`\n\t\t\t);\n\t\t} else {\n\t\t\tspotlights[room.roomid][key].shift();\n\t\t\tif (!spotlights[room.roomid][key].length) {\n\t\t\t\tdelete spotlights[room.roomid][key];\n\t\t\t}\n\t\t\tsaveSpotlights();\n\t\t\tthis.modlog(`DAILY REMOVE`, key);\n\t\t\tthis.privateModAction(`${user.name} successfully removed the daily spotlight named '${key}'.`);\n\t\t}\n\t\tChat.refreshPageFor(`spotlights-${room.roomid}`, room);\n\t},\n\tswapdailies: 'swapdaily',\n\tswapdaily(target, room, user) {\n\t\troom = this.requireRoom();\n\t\tif (!room.persist) return this.errorReply(\"This command is unavailable in temporary rooms.\");\n\t\tif (!spotlights[room.roomid]) return this.errorReply(\"There are no dailies for this room.\");\n\t\tthis.checkCan('announce', null, room);\n\n\t\tconst [key, indexStringA, indexStringB] = target.split(',').map(index => toID(index));\n\t\tif (!indexStringB) return this.parse('/help daily');\n\t\tif (!spotlights[room.roomid][key]) return this.errorReply(`Cannot find a daily spotlight with name '${key}'`);\n\t\tif (!(NUMBER_REGEX.test(indexStringA) && NUMBER_REGEX.test(indexStringB))) {\n\t\t\treturn this.errorReply(\"Queue numbers must be numbers.\");\n\t\t}\n\t\tconst indexA = parseInt(indexStringA);\n\t\tconst indexB = parseInt(indexStringB);\n\t\tconst queueLength = spotlights[room.roomid][key].length;\n\t\tif (indexA < 1 || indexB < 1 || indexA >= queueLength || indexB >= queueLength) {\n\t\t\treturn this.errorReply(`Queue numbers must between 1 and the length of the queue (${queueLength}).`);\n\t\t}\n\n\t\tconst dailyA = spotlights[room.roomid][key][indexA];\n\t\tconst dailyB = spotlights[room.roomid][key][indexB];\n\t\tspotlights[room.roomid][key][indexA] = dailyB;\n\t\tspotlights[room.roomid][key][indexB] = dailyA;\n\n\t\tsaveSpotlights();\n\n\t\tthis.modlog(`DAILY QUEUE SWAP`, key, `${indexA} with ${indexB}`);\n\t\tthis.privateModAction(`${user.name} swapped the queued dailies for '${key}' at queue numbers ${indexA} and ${indexB}.`);\n\t\tChat.refreshPageFor(`spotlights-${room.roomid}`, room);\n\t},\n\tqueuedaily: 'setdaily',\n\tqueuedailyat: 'setdaily',\n\treplacedaily: 'setdaily',\n\tasync setdaily(target, room, user, connection, cmd) {\n\t\troom = this.requireRoom();\n\t\tif (!room.persist) return this.errorReply(\"This command is unavailable in temporary rooms.\");\n\t\tlet key, indexString, rest;\n\t\tif (cmd.endsWith('at') || cmd === 'replacedaily') {\n\t\t\t[key, indexString, ...rest] = target.split(',');\n\t\t} else {\n\t\t\t[key, ...rest] = target.split(',');\n\t\t}\n\t\tkey = toID(key);\n\t\tif (!key) return this.parse('/help daily');\n\t\tif (key.length > 20) return this.errorReply(\"Spotlight names can be a maximum of 20 characters long.\");\n\t\tif (key === 'constructor') return false;\n\t\tif (!spotlights[room.roomid]) spotlights[room.roomid] = {};\n\t\tconst queueLength = spotlights[room.roomid][key]?.length || 0;\n\n\t\tif (indexString && !NUMBER_REGEX.test(indexString)) return this.errorReply(\"The queue number must be a number.\");\n\n\t\tconst index = (indexString ? parseInt(indexString) : queueLength);\n\t\tif (indexString && (index < 1 || index > queueLength)) {\n\t\t\treturn this.errorReply(`Queue numbers must be between 1 and the length of the queue (${queueLength}).`);\n\t\t}\n\n\t\tthis.checkCan('announce', null, room);\n\t\tif (!rest.length) return this.parse('/help daily');\n\t\tlet img, height, width;\n\t\tif (rest[0].trim().startsWith('http://') || rest[0].trim().startsWith('https://')) {\n\t\t\t[img, ...rest] = rest;\n\t\t\timg = img.trim();\n\t\t\ttry {\n\t\t\t\t[width, height] = await Chat.fitImage(img);\n\t\t\t} catch {\n\t\t\t\treturn this.errorReply(`Invalid image url: ${img}`);\n\t\t\t}\n\t\t}\n\t\tconst desc = rest.join(',');\n\t\tif (Chat.stripFormatting(desc).length > 500) {\n\t\t\treturn this.errorReply(\"Descriptions can be at most 500 characters long.\");\n\t\t}\n\t\tif (img) img = [img, width, height] as StoredImage;\n\t\tconst obj = { image: img, description: desc, time: Date.now() };\n\t\tif (!spotlights[room.roomid][key]) spotlights[room.roomid][key] = [];\n\t\tif (cmd === 'setdaily') {\n\t\t\tspotlights[room.roomid][key].shift();\n\t\t\tspotlights[room.roomid][key].unshift(obj);\n\n\t\t\tthis.modlog('SETDAILY', key, `${img ? `${img}, ` : ''}${desc}`);\n\t\t\tthis.privateModAction(`${user.name} set the daily ${key}.`);\n\t\t} else if (cmd === 'queuedailyat') {\n\t\t\tspotlights[room.roomid][key].splice(index, 0, obj);\n\t\t\tthis.modlog('QUEUEDAILY', key, `queue number ${index}: ${img ? `${img}, ` : ''}${desc}`);\n\t\t\tthis.privateModAction(`${user.name} queued a daily ${key} at queue number ${index}.`);\n\t\t} else {\n\t\t\tspotlights[room.roomid][key][index] = obj;\n\t\t\tif (indexString) {\n\t\t\t\tthis.modlog('REPLACEDAILY', key, `queue number ${index}: ${img ? `${img}, ` : ''}${desc}`);\n\t\t\t\tthis.privateModAction(`${user.name} replaced the daily ${key} at queue number ${index}.`);\n\t\t\t} else {\n\t\t\t\tthis.modlog('QUEUEDAILY', key, `${img ? `${img}, ` : ''}${desc}`);\n\t\t\t\tthis.privateModAction(`${user.name} queued a daily ${key}.`);\n\t\t\t}\n\t\t}\n\t\tsaveSpotlights();\n\t\tChat.refreshPageFor(`spotlights-${room.roomid}`, room);\n\t},\n\tasync daily(target, room, user) {\n\t\troom = this.requireRoom();\n\t\tif (!room.persist) return this.errorReply(\"This command is unavailable in temporary rooms.\");\n\t\tconst key = toID(target);\n\t\tif (!key) return this.parse('/help daily');\n\n\t\tif (!spotlights[room.roomid]?.[key]) {\n\t\t\treturn this.errorReply(`Cannot find a daily spotlight with name '${key}'`);\n\t\t}\n\n\t\tif (!this.runBroadcast()) return;\n\n\t\tconst { image, description } = spotlights[room.roomid][key][0];\n\t\tconst html = await renderSpotlight(room.roomid, key, 0);\n\n\t\tthis.sendReplyBox(html);\n\t\tif (!this.broadcasting && user.can('ban', null, room, 'setdaily')) {\n\t\t\tconst code = Utils.escapeHTML(description).replace(/\\n/g, '<br />');\n\t\t\tthis.sendReplyBox(`<details><summary>Source</summary><code style=\"white-space: pre-wrap; display: table; tab-size: 3\">/setdaily ${key},${image ? `${image},` : ''}${code}</code></details>`);\n\t\t}\n\t\troom.update();\n\t},\n\tvsl: 'viewspotlights',\n\tdailies: 'viewspotlights',\n\tviewspotlights(target, room, user) {\n\t\troom = this.requireRoom();\n\t\tif (!room.persist) return this.errorReply(\"This command is unavailable in temporary rooms.\");\n\t\ttarget = toID(target);\n\t\treturn this.parse(`/join view-spotlights-${room.roomid}${target ? `-${target}` : ''}`);\n\t},\n\n\tdailyhelp() {\n\t\tthis.sendReply(\n\t\t\t`|html|<details class=\"readmore\"><summary><code>/daily [name]</code>: shows the daily spotlight.<br />` +\n\t\t\t`<code>!daily [name]</code>: shows the daily spotlight to everyone. Requires: + % @ # ~<br />` +\n\t\t\t`<code>/setdaily [name], [image], [description]</code>: sets the daily spotlight. Image can be left out. Requires: % @ # ~</summary>` +\n\t\t\t`<code>/queuedaily [name], [image], [description]</code>: queues a daily spotlight. At midnight, the spotlight with this name will automatically switch to the next queued spotlight. Image can be left out. Requires: % @ # ~<br />` +\n\t\t\t`<code>/queuedailyat [name], [queue number], [image], [description]</code>: inserts a daily spotlight into the queue at the specified number (starting from 1). Requires: % @ # ~<br />` +\n\t\t\t`<code>/replacedaily [name], [queue number], [image], [description]</code>: replaces the daily spotlight queued at the specified number. Requires: % @ # ~<br />` +\n\t\t\t`<code>/removedaily [name][, queue number]</code>: if no queue number is provided, deletes all queued and current spotlights with the given name. If a number is provided, removes a specific future spotlight from the queue. Requires: % @ # ~<br />` +\n\t\t\t`<code>/swapdaily [name], [queue number], [queue number]</code>: swaps the two queued spotlights at the given queue numbers. Requires: % @ # ~<br />` +\n\t\t\t`<code>/viewspotlights [sorter]</code>: shows all current spotlights in the room. For staff, also shows queued spotlights.` +\n\t\t\t`[sorter] can either be unset, 'time', or 'alphabet'. These sort by either the time added, or alphabetical order.` +\n\t\t\t`</details>`\n\t\t);\n\t},\n};\n\nexport const handlers: Chat.Handlers = {\n\tonRenameRoom(oldID, newID) {\n\t\tif (spotlights[oldID]) {\n\t\t\tif (!spotlights[newID]) spotlights[newID] = {};\n\t\t\tObject.assign(spotlights[newID], spotlights[oldID]);\n\t\t\tdelete spotlights[oldID];\n\t\t\tsaveSpotlights();\n\t\t}\n\t},\n};\n\nprocess.nextTick(() => {\n\tChat.multiLinePattern.register('/(queue|set|replace)daily(at | )');\n});\n"],
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,iBAA0B;AAE1B,MAAM,MAAM,KAAK,KAAK,KAAK;AAC3B,MAAM,iBAAiB;AACvB,MAAM,eAAe;AAWd,IAAI,aAEP,CAAC;AAEL,IAAI;AACH,eAAa,KAAK,UAAM,eAAG,cAAc,EAAE,iBAAiB,KAAK,IAAI;AACrE,aAAW,UAAU,YAAY;AAChC,eAAW,KAAK,WAAW,MAAM,GAAG;AACnC,iBAAW,aAAa,WAAW,MAAM,EAAE,CAAC,GAAG;AAC9C,YAAI,CAAC,UAAU,MAAM;AACpB,oBAAU,OAAO,KAAK,IAAI;AA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