From 6923002b1f5b0515d97a1ca5384fd8af30127a03 Mon Sep 17 00:00:00 2001 From: kate Date: Fri, 17 Jul 2026 12:45:15 +0800 Subject: [PATCH 1/3] Delete old scripts and use new way of referencing Deno dependencies --- credits.old.js | 160 ------------------------------------------------ deno.json | 5 ++ deno.lock | 23 +++++++ footer.html | 21 ++++--- generate.js | 90 --------------------------- groups.old.js | 34 ---------- header.html | 2 +- index.ts | 2 +- src/generate.ts | 6 +- src/render.ts | 12 ++-- 10 files changed, 52 insertions(+), 303 deletions(-) delete mode 100644 credits.old.js create mode 100644 deno.json create mode 100644 deno.lock delete mode 100644 generate.js delete mode 100644 groups.old.js diff --git a/credits.old.js b/credits.old.js deleted file mode 100644 index 281d85d..0000000 --- a/credits.old.js +++ /dev/null @@ -1,160 +0,0 @@ -module.exports = [ - { - link: 'https://pillowfort.social/posts/1632320', - validate (filename) { - return filename.startsWith('flag-') - } - }, - { - link: 'https://rekkanogotoku.com/', - files: ['viperbtn.gif'] - }, - { - link: 'https://niv.gay/', - files: ['niv-banner.gif'] - }, - { - link: 'https://kernel.org', - validate (filename) { - return filename.startsWith('xenia_') - } - }, - { - link: 'https://heckscaper.com', - validate (filename) { - return filename.startsWith('hs8831') || - [ - 'emma.gif', - 'emmalink.gif' - ].includes(filename) - } - }, - { - link: `http://www.mabsland.com/Adoption.html`, - validate (filename) { - return filename.startsWith('Censor_') - } - }, - { - link: 'https://lapfox.com', - validate (filename) { - return filename.startsWith('lapfox') || filename.startsWith('rotteen') || filename.startsWith('kitcaliber') - } - }, - { - link: 'https://en.pronouns.page/', - files: [ - 'pronouns.page' - ] - }, - { - link: 'https://notepad.org', - files: [ - 'button_np.gif' - ] - }, - { - link: 'https://mogai-genders.fandom.com/wiki/Catgender', - files: ['catgender.gif'] - }, - { - link: 'https://ada.untergrund.net/', - files: ['ada.gif'] - }, - { - link: 'https://pouet.net', - files: ['pouet.gif'] - }, - { - link: 'https://otherkin.fandom.com/wiki/Therians', - files: ['therian.png'] - }, - { - link: 'https://code.visualstudio.com', - files: ['vscode.gif'] - }, - { - link: 'https://en.wikipedia.org/wiki/Source_(game_engine)', - validate (filename) { - return filename.startsWith('source-') - } - }, - { - link: 'https://yesterweb.org/no-to-web3/', - files: ['noweb3.gif', 'roly-saynotoweb3.gif'] - }, - { - link: 'https://nikutrax.neocities.org/', - files: ['niku.png'] - }, - { - link: 'https://casey.pet/', - files: ['casey.png'] - }, - { - link: 'https://yesterweb.org', - files: ['yesterweb.png'] - }, - { - link: 'https://crushcapitalism.com/', - files: ['crushcapitalism.png'] - }, - { - link: 'https://sanya.gay', - files: ['sanya.png'] - }, - { - link: 'https://exo.pet', - validate (filename) { - return filename.startsWith('exopet') || filename == 'fdfdfd.gif' - } - }, - { - link: 'https://web.archive.org/web/20110513011151/http://graphics.rootmode.com/', - validate (filename) { - return filename.includes('-gnu-') - } - }, - { - link: 'https://kate.pet', - files: ['kate.gif'] - }, - { - link: 'http://creativecommons.org/publicdomain/zero/1.0/', - files: ['public-domain.png'] - }, - { - link: 'https://treblesand.dreamwidth.org/', - files: ['plural_ALT.png', 'plural.png'] - }, - { - link: `https://88x31.kate.pet/`, - files: ['_88x31.kate.pet'] - }, - { - link: 'https://hyenatown.neocities.org/', - files: ['vscodium100.gif'] - }, - { - link: 'https://forum.artixlinux.org/index.php/topic,3871.0.html', - files: ['artix.png', 'artix.gif'] - }, - { - link: 'https://wiki.ubuntu.com/WebsiteButtons', - validate (filename) { - return filename.match(/^(ubuntu|getubuntu|poweredby(|_)ubuntu)/gi) - } - }, - { - link: 'https://transistorcafe.net/~voltbun/artwork.html', - files: ['vbwebspace.gif', 'xenia-now.gif', 'xeniatrans_now.gif'] - }, - { - link: 'http://transistorcafe.net/', - files: ['TransistorCafeButton.gif'] - }, - { - link: 'https://www.sominemo.com/', - files: ['sominemo.gif'] - } -] diff --git a/deno.json b/deno.json new file mode 100644 index 0000000..51a4fd3 --- /dev/null +++ b/deno.json @@ -0,0 +1,5 @@ +{ + "imports": { + "@std/path": "jsr:@std/path@^1.1.6" + } +} diff --git a/deno.lock b/deno.lock new file mode 100644 index 0000000..44e4cb5 --- /dev/null +++ b/deno.lock @@ -0,0 +1,23 @@ +{ + "version": "5", + "specifiers": { + "jsr:@std/internal@^1.0.14": "1.0.14", + "jsr:@std/path@^1.1.6": "1.1.6" + }, + "jsr": { + "@std/internal@1.0.14": { + "integrity": "291516b3d4c35024d6ffbc0a9df5bf4c64116e05b50012cf846710152d2ffdf7" + }, + "@std/path@1.1.6": { + "integrity": "c68485c2a4dfbb5ae3cc74fae4e8c4e5d874cf8a8ed12927917235c758b46cbe", + "dependencies": [ + "jsr:@std/internal" + ] + } + }, + "workspace": { + "dependencies": [ + "jsr:@std/path@^1.1.6" + ] + } +} diff --git a/footer.html b/footer.html index cf76f35..5d8166d 100644 --- a/footer.html +++ b/footer.html @@ -18,20 +18,23 @@ console.log('Copied to clipboard;\n', content) alert('Coped HTML to clipboard') } - catch (except){} + catch (except) { + console.error('failed to copy content to clipboard', { + error: except, + content + }); + } } document.addEventListener('click', (e) => { - if (e.target.localName == "img") + if (e.target.localName !== "img") return; + let targetContent = ``; + if (e.target.attributes.targetLink != undefined) { - let targetContent = `` - if (e.target.attributes.targetLink != undefined) - { - targetContent = `${targetContent}` - } - clipboardCopy(targetContent) - e.preventDefault() + targetContent = `${targetContent}`; } + clipboardCopy(targetContent); + e.preventDefault(); }) diff --git a/generate.js b/generate.js deleted file mode 100644 index 52df385..0000000 --- a/generate.js +++ /dev/null @@ -1,90 +0,0 @@ -const fs = require('fs') -const path = require('path') - -const credits = require('./credits.old.js') -const groupData = require('./groups.old.js') - -const GenerateTemplate = (filename) => -{ - let target = null - for (let item of credits) - { - if (target != null) continue - if (item.validate != undefined && typeof item.validate == 'function') - { - if (item.validate(filename)) - { - target = item - } - } - else if (item.files != undefined || typeof item.files == 'object') - { - if (item.files.includes(filename)) - { - target = item - } - } - } - - // console.log(target, filename) - - let elementImage = `${filename}` - if (target != null && target.link != undefined) - { - return `${elementImage}` - } - else - { - return elementImage - } -} -let elements = [] -let filenameArray = fs.readdirSync('./img') -let generatedFilenames = {} -for (let group of groupData) -{ - let groupElements = [] - for (let filename of filenameArray) - { - console.log(filename, filename.match(group.expression)) - if (filename.match(group.expression) != null && generatedFilenames[filename] == undefined) - { - groupElements.push(GenerateTemplate(filename)) - generatedFilenames[filename] = true - } - } - if (groupElements.length > 0) - groupElements = [ - `

${group.name}

`, - ...groupElements - ] - elements = elements.concat(groupElements) -} -let tempElementArr = [] -for (let filename of filenameArray) -{ - if (/\.(png|gif|jp(e|)g)$/i.test(filename) && generatedFilenames[filename] == undefined) - { - tempElementArr.push(GenerateTemplate(filename)) - } -} -if (tempElementArr.length > 0) - tempElementArr = [ - `

Other

`, - ...tempElementArr - ] -elements = elements.concat(tempElementArr) - -if (fs.existsSync('dist/index.html')) - fs.unlinkSync('dist/index.html') -let content = fs.readFileSync('header.html').toString() -content += '' -content += `

Generated at ${new Date(Date.now()).toLocaleString('en-AU', {timeZone: 'UTC'})} (UTC+00:00)

` -content += fs.readFileSync('footer.html') - -fs.writeFileSync('dist/index.html', content) -for (let filename of filenameArray) -{ - if (/\.(png|gif|jp(e|)g)$/i.test(filename)) - fs.copyFileSync(`./img/${filename}`, `./dist/${filename}`) -} \ No newline at end of file diff --git a/groups.old.js b/groups.old.js deleted file mode 100644 index 553c2fb..0000000 --- a/groups.old.js +++ /dev/null @@ -1,34 +0,0 @@ -module.exports = [ - { - name: 'flags', - expression: /^(pronouns|flag-|plural|pronouns|pride|therian|catgender)/gi - }, - { - name: 'powered by', - expression: /^(emacs|power-button|powered|made_with|made(on|with)|vscodium|php|nts_iis|msfrontpage2000|hackerpowered|twopaws|notepad|button_np|redhat|win98_891|thevoid)/gi - }, - { - name: 'people', - expression: /^(sominemo|niku|niv|kate|emma(link|)|sanya|kitcaliber|lapfox|viper|rotteen|hs|exopet|casey|fdfdfd|vbwebspace)/gi - }, - { - name: 'services', - expression: /^(mastodon|twitter|discord|revolt|tumblr|github|lastfm|netflix|TransistorCafeButton)/gi - }, - { - name: 'games', - expression: /^(steam|duke|source|3dr|hl|aniquake)/gi - }, - { - name: 'software', - expression: /^(adobe|rp|plgn_rp|download_(download|jukebox|player|rec)|mirc|get_java|getrealplayer|vscod(e|ium)|nsie|ie2|button_np|catscape|any_brow(|ser)|winamp|walisten|wa-button|realone|rp(7|)|plgn_rp|freeplayer|getfree|get_player|freeplayer|50_button_static|GetWinMP)/gi - }, - { - name: 'gnu', - expression: /^(button\-[0-9]+x[0-9]+\-gnu|button-powered_by_gnu)/gi - }, - { - name: 'linux', - expression: /^(xenia|visitmini|redhat|netbsd|ubuntu|getubuntu|artix)/gi - } -] \ No newline at end of file diff --git a/header.html b/header.html index 48b6944..f921966 100644 --- a/header.html +++ b/header.html @@ -28,7 +28,7 @@ transition: 100ms; } body { - font-family:'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; + font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; background-color: #333; color: #e9e9e9; } diff --git a/index.ts b/index.ts index a98131d..830e717 100644 --- a/index.ts +++ b/index.ts @@ -1,4 +1,4 @@ -import * as path from 'https://deno.land/std@0.170.0/path/mod.ts'; +import * as path from '@std/path'; import type { IConfig } from './index.d.ts' import * as _groups from './groups.js' diff --git a/src/generate.ts b/src/generate.ts index 76f19fa..77c9581 100644 --- a/src/generate.ts +++ b/src/generate.ts @@ -5,12 +5,12 @@ export function run(): string let content: string = '' content += config.headerContent let lookup = generateLookup() - let gengroups: string[] = [] + let groups: string[] = [] for (let group of lookup) { - gengroups.push(RenderGroup(group)) + groups.push(RenderGroup(group)) } - content += `` + content += `` content += RenderTimestamp() content += config.footerContent return content diff --git a/src/render.ts b/src/render.ts index 0405c95..604dd9d 100644 --- a/src/render.ts +++ b/src/render.ts @@ -4,21 +4,23 @@ export function RenderImage(image: ImageDetails): string { let link = '' if (image.link != undefined && image.link.length > 3) - link = image.link + link = encodeURI(image.link); + let content = `${image.name} 3 ) + if (link.length > 3) content += ` targetLink="${link}" ` content +=` height="31" />` if (link.length > 1) - content = `${content}` + content = `${content}` return content } export function RenderGroup(group: GeneratedGroup): string { let returnValue: string[] = [] + const groupName = group.name.replaceAll('&', '&').replaceAll('<', '<').replaceAll('>', '<'); returnValue = returnValue.concat([ - `
  • ${group.name}

  • ` - ]) + `
  • ${groupName}

  • ` + ]); for (let item of group.images) { returnValue.push(`
  • ${RenderImage(item)}
  • `) From f0db83b5d700e4cccf3820b4d8130128b8f16cbd Mon Sep 17 00:00:00 2001 From: kate Date: Fri, 17 Jul 2026 12:46:01 +0800 Subject: [PATCH 2/3] github/workflows/pages: Use Deno v2 (and denoland/setup-deno@v2) --- .github/workflows/pages.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/pages.yml b/.github/workflows/pages.yml index a84439e..064ffb1 100644 --- a/.github/workflows/pages.yml +++ b/.github/workflows/pages.yml @@ -33,9 +33,9 @@ jobs: with: lfs: true - - uses: denoland/setup-deno@v1 + - uses: denoland/setup-deno@v2 with: - deno-version: v1.x.x + deno-version: v2.x.x - run: deno run --allow-all index.ts From b26fa0479f3fdcb9bb538b3c80b14ebf70500dd5 Mon Sep 17 00:00:00 2001 From: kate Date: Fri, 17 Jul 2026 12:47:38 +0800 Subject: [PATCH 3/3] Created workflow for running generate script (w/o deploy) --- .github/workflows/build.yml | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 .github/workflows/build.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..fa7d19d --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,24 @@ +name: Generate static content (without deploying) +on: + push: + pull_request: + workflow_dispatch: + +permissions: + contents: read + +jobs: + # Single deploy job since we're just deploying + generate: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + lfs: true + + - uses: denoland/setup-deno@v2 + with: + deno-version: v2.x.x + + - run: deno run --allow-all index.ts \ No newline at end of file