Compare commits

...

2 commits

9 changed files with 29 additions and 261 deletions

View file

@ -1,38 +0,0 @@
---
name: Bug report
about: Create a report to help us improve
title: ''
labels: ''
assignees: ''
---
**Describe the bug**
A clear and concise description of what the bug is.
**To Reproduce**
Steps to reproduce the behavior:
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error
**Expected behavior**
A clear and concise description of what you expected to happen.
**Screenshots**
If applicable, add screenshots to help explain your problem.
**Desktop (please complete the following information):**
- OS: [e.g. iOS]
- Browser [e.g. chrome, safari]
- Version [e.g. 22]
**Smartphone (please complete the following information):**
- Device: [e.g. iPhone6]
- OS: [e.g. iOS8.1]
- Browser [e.g. stock browser, safari]
- Version [e.g. 22]
**Additional context**
Add any other context about the problem here.

View file

@ -1,41 +0,0 @@
import { readFile, writeFile } from "fs/promises";
import { join } from "path";
import { format } from "prettier";
console.time("Done");
console.log("Reading avatarsdatabase.css...");
const avis = (await readFile(join("../../", "avatarsdatabase.css"), "utf8"))
.replace(/\r/g, "")
.split("\n");
const imageMatcher = /url\((?:'|")([^'"]+)(?:'|")\)/;
const avatarMatcher = /^\/\* Custom avatar for ([0-9]+) \*\/$/;
const badgeMatcher = /^\/\* Custom badge for (.*?) \*\/$/;
const avatars = {};
for (let i = 0; i < avis.length; i++) {
const l = avis[i];
const id = l.match(avatarMatcher)?.[1];
if (id) avatars[id] = avis[i + 2].match(imageMatcher)[1];
}
const badges = {};
for (let i = 0; i < avis.length; i++) {
const l = avis[i];
const bid = l.match(badgeMatcher)?.[1];
if (bid) badges[bid] = avis[i + 10].match(imageMatcher)[1];
}
await writeFile(
join("../../", "source", "data.json"),
format(
JSON.stringify({
avatars,
badges,
}),
{
parser: "json",
}
)
);

View file

@ -1,49 +0,0 @@
import { readFile, writeFile } from "fs/promises";
import { join } from "path";
import UglifyCSS from "uglifycss";
console.time("Done");
const uglify = !process.argv.includes("--debug");
console.log("Getting templates...");
const templateLines = (
await readFile(join("../../", "source", "template.css"), "utf8")
)
.replace(/\r/g, "")
.split("\n");
const templates = {
avatar: "",
};
for (const id of Object.keys(templates)) {
const start = templateLines.findIndex(
(x) => x === `/* ${id.toUpperCase()}-TEMPLATE-BEGIN */`
),
end = templateLines.findIndex(
(x) => x === `/* ${id.toUpperCase()}-TEMPLATE-END */`
);
if (start >= 0 && end >= 0)
templates[id] = templateLines.slice(start + 1, end).join("\n");
else throw new Error(`Failed to get template lines for: ${id}`);
}
console.log("Generating import.css...");
const data = JSON.parse(
await readFile(join("../../", "source", "data.json"), "utf8")
);
const dist = [];
for (const [id, img] of Object.entries(data.avatars)) {
dist.push(templates.avatar.replace(/{id}/g, id).replace(/{img}/g, img));
}
await writeFile(
join("../../", "import.css"),
uglify ? UglifyCSS.processString(dist.join("\n")) : dist.join("\n\n")
);
console.timeEnd("Done");

View file

@ -1,13 +0,0 @@
{
"name": "scripts",
"private": true,
"scripts": {
"convert": "node convert/index.mjs",
"generate": "node generate/index.mjs",
"generate:debug": "node generate/index.mjs --debug"
},
"dependencies": {
"prettier": "^3.0.2",
"uglifycss": "^0.0.29"
}
}

View file

@ -1,27 +0,0 @@
lockfileVersion: '6.0'
settings:
autoInstallPeers: true
excludeLinksFromLockfile: false
dependencies:
prettier:
specifier: ^3.0.2
version: 3.0.2
uglifycss:
specifier: ^0.0.29
version: 0.0.29
packages:
/prettier@3.0.2:
resolution: {integrity: sha512-o2YR9qtniXvwEZlOKbveKfDQVyqxbEIWn48Z8m3ZJjBjcCmUy3xZGIv+7AkaeuaTr6yPXJjwv07ZWlsWbEy1rQ==}
engines: {node: '>=14'}
hasBin: true
dev: false
/uglifycss@0.0.29:
resolution: {integrity: sha512-J2SQ2QLjiknNGbNdScaNZsXgmMGI0kYNrXaDlr4obnPW9ni1jljb1NeEVWAiTgZ8z+EBWP2ozfT9vpy03rjlMQ==}
engines: {node: '>=6.4.0'}
hasBin: true
dev: false

View file

@ -1,55 +0,0 @@
name: Generate Database
on:
push:
branches:
- main
paths:
- ".forgejo/workflows/generate-source.yml"
- ".forgejo/scripts/generate/**/*.*"
- "source/data.json"
- "source/template.css"
pull_request:
branches:
- main
workflow_dispatch:
concurrency:
group: ${{ github.ref }}
cancel-in-progress: true
jobs:
generate:
runs-on: ubuntu-latest
permissions:
contents: write
# v this isn't really needed v
# strategy:
# matrix:
# retry-max: [3] # Set the maximum number of retries here
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 18.x
- name: Setup PNPM
working-directory: .forgejo/scripts
run: |
npm i -g pnpm
pnpm i
- name: Run generate script
working-directory: .forgejo/scripts
run: pnpm run generate
- name: Push changes
run: |
git config --global user.name "dingus"
git config --global user.email "bot@dorkbutt.lol"
git add import.css
git commit -m "Update import.css (${{ github.sha || 'manual trigger' }})" || true
git push

View file

@ -1,37 +0,0 @@
name: Release
on:
push:
tags:
- "v*"
jobs:
release:
name: Release
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Check out Git repository
uses: actions/checkout@v2
- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: 18
- uses: pnpm/action-setup@v2
with:
version: latest
- name: Install Node.js dependencies
run: pnpm install
- name: Build TypeScript and bundle into asar
run: pnpm run bundle
- uses: ncipollo/release-action@v1
with:
artifacts: "bundle/*"
makeLatest: true

5
.gitignore vendored
View file

@ -106,4 +106,7 @@ dist
.tern-port
.parcel-cache
/bundle
/bundle
# For now, as runners are unable to be deployed on local instance.
.forgejo

25
import.css vendored Normal file
View file

@ -0,0 +1,25 @@
/* Manual submission for now */
.avatar__183c2[src^="https://cdn.discordapp.com/avatars/862105885660676146"]
,.avatar_c19a55[src^="https://cdn.discordapp.com/avatars/862105885660676146"]
,.avatar__44b0c[src^="https://cdn.discordapp.com/avatars/862105885660676146"]
,.voiceAvatar_f910d0[src^="https://cdn.discordapp.com/avatars/862105885660676146"]
,.replyAvatar_c19a55[src^="https://cdn.discordapp.com/avatars/862105885660676146"]
,.icon__6e9f8[src^="https://cdn.discordapp.com/avatars/862105885660676146"] {
content: url("https://nomadants.net/harleyLineup-2.jpeg")
}
.userAvatar__55bab[style*="{862105885660676146}"] {
background-image: url("https://nomadants.net/harleyLineup-2.jpeg")!important
}
.avatar__183c2[src^="https://cdn.discordapp.com/avatars/578012873813524530"]
,.avatar_c19a55[src^="https://cdn.discordapp.com/avatars/578012873813524530"]
,.avatar__44b0c[src^="https://cdn.discordapp.com/avatars/578012873813524530"]
,.voiceAvatar_f910d0[src^="https://cdn.discordapp.com/avatars/578012873813524530"]
,.replyAvatar_c19a55[src^="https://cdn.discordapp.com/avatars/578012873813524530"]
,.icon__6e9f8[src^="https://cdn.discordapp.com/avatars/578012873813524530"] {
content: url("https://nomadants.net/ezgif-581c216698e71e.gif")
}
.userAvatar__55bab[style*="{578012873813524530}"] {
background-image: url("https://nomadants.net/ezgif-581c216698e71e.gif")!important
}