mirror of
https://gitlab.com/soapbox-pub/ditto.git
synced 2025-12-06 03:19:46 +00:00
Remove png-to-ico (this augments @types/node to a wrong version)
This commit is contained in:
parent
30b4900992
commit
b07ba9423b
3 changed files with 1 additions and 37 deletions
|
|
@ -88,7 +88,6 @@
|
||||||
"nostr-tools": "npm:nostr-tools@2.5.1",
|
"nostr-tools": "npm:nostr-tools@2.5.1",
|
||||||
"nostr-wasm": "npm:nostr-wasm@^0.1.0",
|
"nostr-wasm": "npm:nostr-wasm@^0.1.0",
|
||||||
"path-to-regexp": "npm:path-to-regexp@^7.1.0",
|
"path-to-regexp": "npm:path-to-regexp@^7.1.0",
|
||||||
"png-to-ico": "npm:png-to-ico@^2.1.8",
|
|
||||||
"postgres": "https://gitlab.com/soapbox-pub/postgres.js/-/raw/e79d7d2039446fbf7a37d4eca0d17e94a94b8b53/deno/mod.js",
|
"postgres": "https://gitlab.com/soapbox-pub/postgres.js/-/raw/e79d7d2039446fbf7a37d4eca0d17e94a94b8b53/deno/mod.js",
|
||||||
"prom-client": "npm:prom-client@^15.1.2",
|
"prom-client": "npm:prom-client@^15.1.2",
|
||||||
"question-deno": "https://raw.githubusercontent.com/ocpu/question-deno/10022b8e52555335aa510adb08b0a300df3cf904/mod.ts",
|
"question-deno": "https://raw.githubusercontent.com/ocpu/question-deno/10022b8e52555335aa510adb08b0a300df3cf904/mod.ts",
|
||||||
|
|
|
||||||
17
deno.lock
generated
17
deno.lock
generated
|
|
@ -93,7 +93,6 @@
|
||||||
"npm:@scure/base@^1.1.6": "1.1.6",
|
"npm:@scure/base@^1.1.6": "1.1.6",
|
||||||
"npm:@scure/bip32@^1.4.0": "1.4.0",
|
"npm:@scure/bip32@^1.4.0": "1.4.0",
|
||||||
"npm:@scure/bip39@^1.3.0": "1.3.0",
|
"npm:@scure/bip39@^1.3.0": "1.3.0",
|
||||||
"npm:@types/node@*": "18.16.19",
|
|
||||||
"npm:blurhash@2.0.5": "2.0.5",
|
"npm:blurhash@2.0.5": "2.0.5",
|
||||||
"npm:comlink-async-generator@*": "0.0.1",
|
"npm:comlink-async-generator@*": "0.0.1",
|
||||||
"npm:comlink-async-generator@^0.0.1": "0.0.1",
|
"npm:comlink-async-generator@^0.0.1": "0.0.1",
|
||||||
|
|
@ -123,7 +122,6 @@
|
||||||
"npm:nostr-tools@^2.7.0": "2.7.0",
|
"npm:nostr-tools@^2.7.0": "2.7.0",
|
||||||
"npm:nostr-wasm@0.1": "0.1.0",
|
"npm:nostr-wasm@0.1": "0.1.0",
|
||||||
"npm:path-to-regexp@^7.1.0": "7.1.0",
|
"npm:path-to-regexp@^7.1.0": "7.1.0",
|
||||||
"npm:png-to-ico@^2.1.8": "2.1.8",
|
|
||||||
"npm:postgres@3.4.4": "3.4.4",
|
"npm:postgres@3.4.4": "3.4.4",
|
||||||
"npm:prom-client@^15.1.2": "15.1.2",
|
"npm:prom-client@^15.1.2": "15.1.2",
|
||||||
"npm:sharp@~0.33.5": "0.33.5",
|
"npm:sharp@~0.33.5": "0.33.5",
|
||||||
|
|
@ -961,12 +959,6 @@
|
||||||
"@types/trusted-types"
|
"@types/trusted-types"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"@types/node@17.0.45": {
|
|
||||||
"integrity": "sha512-w+tIMs3rq2afQdsPJlODhoUEKzFP1ayaoyl1CcnwtIlsVe7K7bA1NGm4s3PraqTLlXnbIN84zuBlxBWo1u9BLw=="
|
|
||||||
},
|
|
||||||
"@types/node@18.16.19": {
|
|
||||||
"integrity": "sha512-IXl7o+R9iti9eBW4Wg2hx1xQDig183jj7YLn8F7udNceyfkbn1ZxmzZXuak20gR40D7pIkIY1kYGx5VIGbaHKA=="
|
|
||||||
},
|
|
||||||
"@types/trusted-types@2.0.7": {
|
"@types/trusted-types@2.0.7": {
|
||||||
"integrity": "sha512-ScaPdn1dQczgbl0QFTeTOmVHFULt394XJgOQNoyVhZ6r2vLnMLJfBPd53SB52T/3G36VI1/g2MZaX0cwDuXsfw=="
|
"integrity": "sha512-ScaPdn1dQczgbl0QFTeTOmVHFULt394XJgOQNoyVhZ6r2vLnMLJfBPd53SB52T/3G36VI1/g2MZaX0cwDuXsfw=="
|
||||||
},
|
},
|
||||||
|
|
@ -1527,14 +1519,6 @@
|
||||||
"pidtree@0.6.0": {
|
"pidtree@0.6.0": {
|
||||||
"integrity": "sha512-eG2dWTVw5bzqGRztnHExczNxt5VGsE6OwTeCG3fdUf9KBsZzO3R5OIIIzWR+iZA0NtZ+RDVdaoE2dK1cn6jH4g=="
|
"integrity": "sha512-eG2dWTVw5bzqGRztnHExczNxt5VGsE6OwTeCG3fdUf9KBsZzO3R5OIIIzWR+iZA0NtZ+RDVdaoE2dK1cn6jH4g=="
|
||||||
},
|
},
|
||||||
"png-to-ico@2.1.8": {
|
|
||||||
"integrity": "sha512-Nf+IIn/cZ/DIZVdGveJp86NG5uNib1ZXMiDd/8x32HCTeKSvgpyg6D/6tUBn1QO/zybzoMK0/mc3QRgAyXdv9w==",
|
|
||||||
"dependencies": [
|
|
||||||
"@types/node@17.0.45",
|
|
||||||
"minimist",
|
|
||||||
"pngjs"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"pngjs@6.0.0": {
|
"pngjs@6.0.0": {
|
||||||
"integrity": "sha512-TRzzuFRRmEoSW/p1KVAmiOgPco2Irlah+bGFCeNfJXxxYGwSw7YwAOAcd7X28K/m5bjBWKsC29KyoMfHbypayg=="
|
"integrity": "sha512-TRzzuFRRmEoSW/p1KVAmiOgPco2Irlah+bGFCeNfJXxxYGwSw7YwAOAcd7X28K/m5bjBWKsC29KyoMfHbypayg=="
|
||||||
},
|
},
|
||||||
|
|
@ -2473,7 +2457,6 @@
|
||||||
"npm:nostr-tools@2.5.1",
|
"npm:nostr-tools@2.5.1",
|
||||||
"npm:nostr-wasm@0.1",
|
"npm:nostr-wasm@0.1",
|
||||||
"npm:path-to-regexp@^7.1.0",
|
"npm:path-to-regexp@^7.1.0",
|
||||||
"npm:png-to-ico@^2.1.8",
|
|
||||||
"npm:prom-client@^15.1.2",
|
"npm:prom-client@^15.1.2",
|
||||||
"npm:sharp@~0.33.5",
|
"npm:sharp@~0.33.5",
|
||||||
"npm:tldts@^6.0.14",
|
"npm:tldts@^6.0.14",
|
||||||
|
|
|
||||||
|
|
@ -2,9 +2,7 @@ import { AdminSigner } from '@/signers/AdminSigner.ts';
|
||||||
import { Command } from 'commander';
|
import { Command } from 'commander';
|
||||||
import { NostrEvent } from 'nostr-tools';
|
import { NostrEvent } from 'nostr-tools';
|
||||||
import { nostrNow } from '@/utils.ts';
|
import { nostrNow } from '@/utils.ts';
|
||||||
import { Buffer } from 'node:buffer';
|
|
||||||
import { Conf } from '@/config.ts';
|
import { Conf } from '@/config.ts';
|
||||||
import pngToIco from 'png-to-ico';
|
|
||||||
import { Storages } from '@/storages.ts';
|
import { Storages } from '@/storages.ts';
|
||||||
|
|
||||||
function die(code: number, ...args: unknown[]) {
|
function die(code: number, ...args: unknown[]) {
|
||||||
|
|
@ -26,7 +24,6 @@ if (import.meta.main) {
|
||||||
'Lightning address for the server. Can just be your own lightning address.',
|
'Lightning address for the server. Can just be your own lightning address.',
|
||||||
)
|
)
|
||||||
.option('-a --about <string>', 'About text. This shows up whenever a description for your server is needed.')
|
.option('-a --about <string>', 'About text. This shows up whenever a description for your server is needed.')
|
||||||
.option('-i --image <string>', 'Image URL to use for OpenGraph previews and favicon.')
|
|
||||||
.action(async (name, args) => {
|
.action(async (name, args) => {
|
||||||
const { lightning, about, image } = args;
|
const { lightning, about, image } = args;
|
||||||
const content: Record<string, string | boolean> = {};
|
const content: Record<string, string | boolean> = {};
|
||||||
|
|
@ -46,22 +43,7 @@ if (import.meta.main) {
|
||||||
content: JSON.stringify(content),
|
content: JSON.stringify(content),
|
||||||
};
|
};
|
||||||
const signed = await signer.signEvent(bare);
|
const signed = await signer.signEvent(bare);
|
||||||
if (image) {
|
|
||||||
try {
|
|
||||||
await fetch(image)
|
|
||||||
.then((res) => {
|
|
||||||
if (!res.ok) throw new Error('Error attempting to fetch favicon.');
|
|
||||||
if (res.headers.get('content-type') !== 'image/png') throw new Error('Non-png images are not supported!');
|
|
||||||
return res.blob();
|
|
||||||
})
|
|
||||||
.then(async (blob) =>
|
|
||||||
await pngToIco(Buffer.from(await blob.arrayBuffer()))
|
|
||||||
.then(async (buf) => await Deno.writeFile('./public/favicon.ico', new Uint8Array(buf)))
|
|
||||||
);
|
|
||||||
} catch (e) {
|
|
||||||
die(1, `Error generating favicon from url ${image}: "${e}". Please check this or try again without --image.`);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
console.log({ content, signed });
|
console.log({ content, signed });
|
||||||
await Storages.db().then((store) => store.event(signed));
|
await Storages.db().then((store) => store.event(signed));
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue