diff --git a/.config/example.yml b/.config/example.yml index 29f4a62290..900ac09051 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 b0c21fdab2..d15d2fa94e 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 b5e3feea07..96588b5e82 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 0000000000..44b214ca7c 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 0000000000..75894e7a4e 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 0b9c4e8ba6..e9c42c08f6 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 caf832f904..3bafaee5df 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 2f053fdc42..1e662fb202 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 4b839c879d..5af3b2c84b 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 b4ff5bdc35..11952e46ca 100644 --- a/packages/client/src/components/MkInstanceCardMini.vue +++ b/packages/client/src/components/MkInstanceCardMini.vue @@ -1,6 +1,6 @@