diff --git a/.config/example.yml b/.config/example.yml index 29f4a6229..900ac0905 100644 --- a/.config/example.yml +++ b/.config/example.yml @@ -145,6 +145,12 @@ id: 'aid' # '127.0.0.1/32' #] +# TWA +#twa: +# nameSpace: android_app +# packageName: tld.domain.twa +# sha256CertFingerprints: ['AB:CD:EF'] + # Upload or download file size limits (bytes) #maxFileSize: 262144000 diff --git a/README.md b/README.md index b0c21fdab..d15d2fa94 100644 --- a/README.md +++ b/README.md @@ -95,7 +95,7 @@ If you have access to a server that supports one of the sources below, I recomme ## 👀 Get folder ready ```sh -git clone https://codeberg.org/calckey/calckey.git +git clone --depth 1 https://codeberg.org/calckey/calckey.git cd calckey/ # git checkout main # if you want only stable versions ``` diff --git a/package.json b/package.json index b5e3feea0..96588b5e8 100644 --- a/package.json +++ b/package.json @@ -1,12 +1,12 @@ { "name": "calckey", - "version": "13.0.8-rc4", + "version": "13.0.9-rc", "codename": "aqua", "repository": { "type": "git", "url": "https://codeberg.org/calckey/calckey.git" }, - "packageManager": "pnpm@7.25.0", + "packageManager": "pnpm@7.26.0", "private": true, "scripts": { "rebuild": "pnpm run clean && pnpm -r run build && pnpm run gulp", diff --git a/packages/backend/assets/icons/maskable.png b/packages/backend/assets/icons/maskable.png new file mode 100644 index 000000000..44b214ca7 Binary files /dev/null and b/packages/backend/assets/icons/maskable.png differ diff --git a/packages/backend/assets/icons/monochrome.png b/packages/backend/assets/icons/monochrome.png new file mode 100644 index 000000000..75894e7a4 Binary files /dev/null and b/packages/backend/assets/icons/monochrome.png differ diff --git a/packages/backend/src/config/types.ts b/packages/backend/src/config/types.ts index 0b9c4e8ba..e9c42c08f 100644 --- a/packages/backend/src/config/types.ts +++ b/packages/backend/src/config/types.ts @@ -64,6 +64,12 @@ export type Source = { mediaProxy?: string; proxyRemoteFiles?: boolean; + twa: { + nameSpace?: string; + packageName?: string; + sha256CertFingerprints?: string[]; + }; + // Managed hosting stuff maxUserSignups?: number; isManagedHosting?: boolean; diff --git a/packages/backend/src/misc/get-ip-hash.ts b/packages/backend/src/misc/get-ip-hash.ts index caf832f90..3bafaee5d 100644 --- a/packages/backend/src/misc/get-ip-hash.ts +++ b/packages/backend/src/misc/get-ip-hash.ts @@ -1,9 +1,14 @@ import IPCIDR from "ip-cidr"; export function getIpHash(ip: string) { - // because a single person may control many IPv6 addresses, - // only a /64 subnet prefix of any IP will be taken into account. - // (this means for IPv4 the entire address is used) - const prefix = IPCIDR.createAddress(ip).mask(64); - return `ip-${BigInt(`0b${prefix}`).toString(36)}`; + try { + // because a single person may control many IPv6 addresses, + // only a /64 subnet prefix of any IP will be taken into account. + // (this means for IPv4 the entire address is used) + const prefix = IPCIDR.createAddress(ip).mask(64); + return `ip-${BigInt(`0b${prefix}`).toString(36)}`; + } catch (e) { + const prefix = IPCIDR.createAddress(ip.replace(/:[0-9]+$/, "")).mask(64); + return `ip-${BigInt(`0b${prefix}`).toString(36)}`; + } } diff --git a/packages/backend/src/server/web/manifest.json b/packages/backend/src/server/web/manifest.json index 2f053fdc4..1e662fb20 100644 --- a/packages/backend/src/server/web/manifest.json +++ b/packages/backend/src/server/web/manifest.json @@ -11,12 +11,26 @@ { "src": "/static-assets/icons/192.png", "sizes": "192x192", - "type": "image/png" + "type": "image/png", + "purpose": "any" }, { "src": "/static-assets/icons/512.png", "sizes": "512x512", - "type": "image/png" + "type": "image/png", + "purpose": "any" + }, + { + "src": "/static-assets/icons/maskable.png", + "sizes": "512x512", + "type": "image/png", + "purpose": "maskable" + }, + { + "src": "/static-assets/icons/monochrome.png", + "sizes": "512x512", + "type": "image/png", + "purpose": "monochrome" } ], "share_target": { @@ -53,5 +67,8 @@ "name": "Chats", "url": "/my/messaging" } - ] + ], + "categories": [ + "social" + ] } diff --git a/packages/backend/src/server/well-known.ts b/packages/backend/src/server/well-known.ts index 4b839c879..5af3b2c84 100644 --- a/packages/backend/src/server/well-known.ts +++ b/packages/backend/src/server/well-known.ts @@ -74,6 +74,22 @@ router.get("/.well-known/host-meta.json", async (ctx) => { }; }); +if (config.twa != null) { + router.get("/.well-known/assetlinks.json", async (ctx) => { + ctx.set("Content-Type", "application/json"); + ctx.body = [ + { + relation: ["delegate_permission/common.handle_all_urls"], + target: { + namespace: config.twa.nameSpace, + package_name: config.twa.packageName, + sha256_cert_fingerprints: config.twa.sha256CertFingerprints, + }, + }, + ]; + }); +} + router.get("/.well-known/nodeinfo", async (ctx) => { ctx.body = { links }; }); diff --git a/packages/client/src/components/MkInstanceCardMini.vue b/packages/client/src/components/MkInstanceCardMini.vue index b4ff5bdc3..11952e46c 100644 --- a/packages/client/src/components/MkInstanceCardMini.vue +++ b/packages/client/src/components/MkInstanceCardMini.vue @@ -1,6 +1,6 @@