Fix: Stub Capacitor, Fix Tauri-Build, Fix Static-Build

This commit is contained in:
Youwes09
2026-05-25 10:21:12 -05:00
parent d9a9427e3b
commit cbdf9e8be1
10 changed files with 213 additions and 89 deletions
+9 -2
View File
@@ -13,7 +13,7 @@
"build:node": "MOKU_TARGET=node vite build",
"build:tauri": "MOKU_TARGET=static vite build",
"build:android": "MOKU_TARGET=static vite build",
"tauri:dev": "tauri dev",
"tauri:dev": "tauri dev --config src-tauri/tauri.dev.conf.json",
"tauri:build": "tauri build"
},
"devDependencies": {
@@ -21,18 +21,25 @@
"@sveltejs/adapter-static": "^3.0.10",
"@sveltejs/kit": "^2.57.0",
"@sveltejs/vite-plugin-svelte": "^7.0.0",
"@tauri-apps/cli": "^2.0.0",
"@tauri-apps/cli": "^2.1.0",
"svelte": "^5.55.2",
"svelte-check": "^4.4.6",
"typescript": "^6.0.2",
"vite": "^8.0.7"
},
"dependencies": {
"@capacitor/browser": "^8.0.3",
"@capacitor/core": "^8.3.4",
"@capacitor/filesystem": "^8.1.2",
"@tauri-apps/api": "^2.0.0",
"@tauri-apps/plugin-dialog": "^2.7.1",
"@tauri-apps/plugin-fs": "^2.5.1",
"@tauri-apps/plugin-http": "^2.5.9",
"@tauri-apps/plugin-os": "^2.3.2",
"@tauri-apps/plugin-process": "^2.3.1",
"@tauri-apps/plugin-shell": "^2.3.5",
"@tauri-apps/plugin-store": "^2.4.3",
"capacitor-native-biometric": "^4.2.2",
"phosphor-svelte": "^3.1.0"
}
}
+133 -58
View File
@@ -8,21 +8,42 @@ importers:
.:
dependencies:
'@capacitor/browser':
specifier: ^8.0.3
version: 8.0.3(@capacitor/core@8.3.4)
'@capacitor/core':
specifier: ^8.3.4
version: 8.3.4
'@capacitor/filesystem':
specifier: ^8.1.2
version: 8.1.2(@capacitor/core@8.3.4)
'@tauri-apps/api':
specifier: ^2.0.0
version: 2.11.0
'@tauri-apps/plugin-dialog':
specifier: ^2.7.1
version: 2.7.1
'@tauri-apps/plugin-fs':
specifier: ^2.5.1
version: 2.5.1
'@tauri-apps/plugin-http':
specifier: ^2.5.9
version: 2.5.9
'@tauri-apps/plugin-os':
specifier: ^2.3.2
version: 2.3.2
'@tauri-apps/plugin-process':
specifier: ^2.3.1
version: 2.3.1
'@tauri-apps/plugin-shell':
specifier: ^2.3.5
version: 2.3.5
'@tauri-apps/plugin-store':
specifier: ^2.4.3
version: 2.4.3
capacitor-native-biometric:
specifier: ^4.2.2
version: 4.2.2
phosphor-svelte:
specifier: ^3.1.0
version: 3.1.0(svelte@5.55.5(@typescript-eslint/types@8.57.1))(vite@8.0.10)
@@ -40,8 +61,8 @@ importers:
specifier: ^7.0.0
version: 7.0.0(svelte@5.55.5(@typescript-eslint/types@8.57.1))(vite@8.0.10)
'@tauri-apps/cli':
specifier: ^2.0.0
version: 2.11.2
specifier: ^2.1.0
version: 2.1.0
svelte:
specifier: ^5.55.2
version: 5.55.5(@typescript-eslint/types@8.57.1)
@@ -57,6 +78,25 @@ importers:
packages:
'@capacitor/browser@8.0.3':
resolution: {integrity: sha512-WJWPHEPbweiFoHYmVlCbZf5yrqJ2Rchx2Xvbmd+3Lf+Zkpq3nXBThThY2CF69lYEg1NINGF9BcHThIOEU1gZlQ==}
peerDependencies:
'@capacitor/core': '>=8.0.0'
'@capacitor/core@3.9.0':
resolution: {integrity: sha512-j1lL0+/7stY8YhIq1Lm6xixvUqIn89vtyH5ZpJNNmcZ0kwz6K9eLkcG6fvq1UWMDgSVZg9JrRGSFhb4LLoYOsw==}
'@capacitor/core@8.3.4':
resolution: {integrity: sha512-CqRQCkb6HXxcx/N7s+hHTN6ef2CmamFiRMITwm4qB840ph56mS42bzUgn6tKCP+RZjdDweiRHj9ytDDeN6jFag==}
'@capacitor/filesystem@8.1.2':
resolution: {integrity: sha512-doaaMfGoFR2hWU6aV6u83I+5ZsGyJVq+Gz4r9lMpJzUKMm1eMu0hLnFdV1aXZlU9FlK/RndFrVD8oRZfNOqWgQ==}
peerDependencies:
'@capacitor/core': '>=8.0.0'
'@capacitor/synapse@1.0.4':
resolution: {integrity: sha512-/C1FUo8/OkKuAT4nCIu/34ny9siNHr9qtFezu4kxm6GY1wNFxrCFWjfYx5C1tUhVGz3fxBABegupkpjXvjCHrw==}
'@emnapi/core@1.10.0':
resolution: {integrity: sha512-yq6OkJ4p82CAfPl0u9mQebQHKPJkY7WrIuk205cTYnYe+k2Z8YBh11FrbRG/H6ihirqcacOgl2BIO8oyMQLeXw==}
@@ -410,88 +450,90 @@ packages:
'@tauri-apps/api@2.11.0':
resolution: {integrity: sha512-7CinYODhky9lmO23xHnUFv0Xt43fbtWMyxZcLcRBlFkcgXKuEirBvHpmtJ89YMhyeGcq20Wuc47Fa4XjyniywA==}
'@tauri-apps/cli-darwin-arm64@2.11.2':
resolution: {integrity: sha512-+4UZzLt+eOAEQCwgd+TqKgyUJMrvx+BgdXLLaqJYmPqzP+nE6YZr/hY6CWLYGQb8jFn99jEkmC6uA3tNvamA1w==}
'@tauri-apps/cli-darwin-arm64@2.1.0':
resolution: {integrity: sha512-ESc6J6CE8hl1yKH2vJ+ALF+thq4Be+DM1mvmTyUCQObvezNCNhzfS6abIUd3ou4x5RGH51ouiANeT3wekU6dCw==}
engines: {node: '>= 10'}
cpu: [arm64]
os: [darwin]
'@tauri-apps/cli-darwin-x64@2.11.2':
resolution: {integrity: sha512-VjYYtZUPqDMLutSfJEyxFE3Bz+DPi7c8wC3imckgvciLDZLq4qwKJxBicg0BXGhXjJsl8vKWgWRFNMPELQ+Xyg==}
'@tauri-apps/cli-darwin-x64@2.1.0':
resolution: {integrity: sha512-TasHS442DFs8cSH2eUQzuDBXUST4ECjCd0yyP+zZzvAruiB0Bg+c8A+I/EnqCvBQ2G2yvWLYG8q/LI7c87A5UA==}
engines: {node: '>= 10'}
cpu: [x64]
os: [darwin]
'@tauri-apps/cli-linux-arm-gnueabihf@2.11.2':
resolution: {integrity: sha512-yMemD6f4i95AQriS8EazyOFzbE34yjnP16i3IOzpHGQvBoy2DjypFMFBq0NtPuITURv/cOGguRtHR5d79/9CSA==}
'@tauri-apps/cli-linux-arm-gnueabihf@2.1.0':
resolution: {integrity: sha512-aP7ZBGNL4ny07Cbb6kKpUOSrmhcIK2KhjviTzYlh+pPhAptxnC78xQGD3zKQkTi2WliJLPmBYbOHWWQa57lQ9w==}
engines: {node: '>= 10'}
cpu: [arm]
os: [linux]
'@tauri-apps/cli-linux-arm64-gnu@2.11.2':
resolution: {integrity: sha512-cgI91D2wL8GSgoWwZXDqt+DwnuZCP2/bz03QAE4TrhgAKIsrB4hX26W/H1EONPUUNkqrsgeCD0wU6pcNjV/5kw==}
'@tauri-apps/cli-linux-arm64-gnu@2.1.0':
resolution: {integrity: sha512-ZTdgD5gLeMCzndMT2f358EkoYkZ5T+Qy6zPzU+l5vv5M7dHVN9ZmblNAYYXmoOuw7y+BY4X/rZvHV9pcGrcanQ==}
engines: {node: '>= 10'}
cpu: [arm64]
os: [linux]
libc: [glibc]
'@tauri-apps/cli-linux-arm64-musl@2.11.2':
resolution: {integrity: sha512-X1rm0BERqAAggtYTESSgXrS3sz4Sb/OiPiz54UqISlXW+GkR3vNIGnsy/lejNmoXGVqri3Q53BCfQiclOIyRPw==}
'@tauri-apps/cli-linux-arm64-musl@2.1.0':
resolution: {integrity: sha512-NzwqjUCilhnhJzusz3d/0i0F1GFrwCQbkwR6yAHUxItESbsGYkZRJk0yMEWkg3PzFnyK4cWTlQJMEU52TjhEzA==}
engines: {node: '>= 10'}
cpu: [arm64]
os: [linux]
libc: [musl]
'@tauri-apps/cli-linux-riscv64-gnu@2.11.2':
resolution: {integrity: sha512-usbMLJbT3KtkOrBMDVeGYNM35aTHXx38SJSzTMSqqjeUIOQ+iVPjb2yAGNAE+KqmBbAx4FOFIyMeKXx2M/JKGQ==}
engines: {node: '>= 10'}
cpu: [riscv64]
os: [linux]
libc: [glibc]
'@tauri-apps/cli-linux-x64-gnu@2.11.2':
resolution: {integrity: sha512-Ru4gwJKPG0ctVGchRGpRup4Y4lW2SSfFnrbQcyHhCliKy4g8Qz97TrUgCur4CbWyAgKxvGh3SjrkA0LDYzDGiw==}
'@tauri-apps/cli-linux-x64-gnu@2.1.0':
resolution: {integrity: sha512-TyiIpMEtZxNOQmuFyfJwaaYbg3movSthpBJLIdPlKxSAB2BW0VWLY3/ZfIxm/G2YGHyREkjJvimzYE0i37PnMA==}
engines: {node: '>= 10'}
cpu: [x64]
os: [linux]
libc: [glibc]
'@tauri-apps/cli-linux-x64-musl@2.11.2':
resolution: {integrity: sha512-eUm7T6clN1MMmNSRQ9gaWsQdyehQx2Gmn5hht/QUlqZQI/qcP2OJK5dnaxqwFzCr2HdsEo9ydxaqcS1oJzMvUw==}
'@tauri-apps/cli-linux-x64-musl@2.1.0':
resolution: {integrity: sha512-/dQd0TlaxBdJACrR72DhynWftzHDaX32eBtS5WBrNJ+nnNb+znM3gON6nJ9tSE9jgDa6n1v2BkI/oIDtypfUXw==}
engines: {node: '>= 10'}
cpu: [x64]
os: [linux]
libc: [musl]
'@tauri-apps/cli-win32-arm64-msvc@2.11.2':
resolution: {integrity: sha512-HeeZW80jU+gVTOEX4X/hC6NVSAdDVXajwP5fxIZ/3z9WvUC7qrudX2GMTilYq6Dg0e0sk0XgsAJD1hZ5wPBXUA==}
'@tauri-apps/cli-win32-arm64-msvc@2.1.0':
resolution: {integrity: sha512-NdQJO7SmdYqOcE+JPU7bwg7+odfZMWO6g8xF9SXYCMdUzvM2Gv/AQfikNXz5yS7ralRhNFuW32i5dcHlxh4pDg==}
engines: {node: '>= 10'}
cpu: [arm64]
os: [win32]
'@tauri-apps/cli-win32-ia32-msvc@2.11.2':
resolution: {integrity: sha512-YhjQNZcXfbkCLyazSv1nPnJ9iRFE1wm6kc51FDbU10/Dk09io+6PAGMLjkxnX2GdM0qMnDmTjstY8mTDVvtKeA==}
'@tauri-apps/cli-win32-ia32-msvc@2.1.0':
resolution: {integrity: sha512-f5h8gKT/cB8s1ticFRUpNmHqkmaLutT62oFDB7N//2YTXnxst7EpMIn1w+QimxTvTk2gcx6EcW6bEk/y2hZGzg==}
engines: {node: '>= 10'}
cpu: [ia32]
os: [win32]
'@tauri-apps/cli-win32-x64-msvc@2.11.2':
resolution: {integrity: sha512-d2JchlFIpZevZVReyqhQOekJmb1UH3rhZ5VX6sH3ty9ETE0TKQavpihvoScUXfKKpW6HZC0MrFGRU0ZtD+w3gA==}
'@tauri-apps/cli-win32-x64-msvc@2.1.0':
resolution: {integrity: sha512-P/+LrdSSb5Xbho1LRP4haBjFHdyPdjWvGgeopL96OVtrFpYnfC+RctB45z2V2XxqFk3HweDDxk266btjttfjGw==}
engines: {node: '>= 10'}
cpu: [x64]
os: [win32]
'@tauri-apps/cli@2.11.2':
resolution: {integrity: sha512-bk3HemqvGRoy+5D/dVMUQHKMYLglD0jVnMm/0iGMH6ufZ+p8r14m6BpIixwij3PBvZdvORUp1YifTD8QxVZ1Nw==}
'@tauri-apps/cli@2.1.0':
resolution: {integrity: sha512-K2VhcKqBhAeS5pNOVdnR/xQRU6jwpgmkSL2ejHXcl0m+kaTggT0WRDQnFtPq6NljA7aE03cvwsbCAoFG7vtkJw==}
engines: {node: '>= 10'}
hasBin: true
'@tauri-apps/plugin-dialog@2.7.1':
resolution: {integrity: sha512-OK1UBXYt+ojcmxMktzzuyonYIFta8CmAASpX+CA+DTGK24KlHjhYI6x2iOJ/TjZF4N7/ACK1oFmEOjIY9IhzOQ==}
'@tauri-apps/plugin-fs@2.5.1':
resolution: {integrity: sha512-9Lz+Jopp6QyeEWhlpkMx4R/+P9HgR+AVAI4vOZhlT8Xaymtz8iVI/Ov984/XTqgJz/5gz5NretqPB/XEMS3NhQ==}
'@tauri-apps/plugin-http@2.5.9':
resolution: {integrity: sha512-lCiY0+vs4HvIUSvZrBs8TC3TiCB0MOPRmiUjTq4prW7SlcJE2jdLeT6KBsJrT9Tlplufl7W1pY6SFAO3gCWxDA==}
'@tauri-apps/plugin-os@2.3.2':
resolution: {integrity: sha512-n+nXWeuSeF9wcEsSPmRnBEGrRgOy6jjkSU+UVCOV8YUGKb2erhDOxis7IqRXiRVHhY8XMKks00BJ0OAdkpf6+A==}
'@tauri-apps/plugin-process@2.3.1':
resolution: {integrity: sha512-nCa4fGVaDL/B9ai03VyPOjfAHRHSBz5v6F/ObsB73r/dA3MHHhZtldaDMIc0V/pnUw9ehzr2iEG+XkSEyC0JJA==}
'@tauri-apps/plugin-shell@2.3.5':
resolution: {integrity: sha512-jewtULhiQ7lI7+owCKAjc8tYLJr92U16bPOeAa472LHJdgaibLP83NcfAF2e+wkEcA53FxKQAZ7byDzs2eeizg==}
@@ -530,6 +572,9 @@ packages:
resolution: {integrity: sha512-qIj0G9wZbMGNLjLmg1PT6v2mE9AH2zlnADJD/2tC6E00hgmhUOfEB6greHPAfLRSufHqROIUTkw6E+M3lH0PTQ==}
engines: {node: '>= 0.4'}
capacitor-native-biometric@4.2.2:
resolution: {integrity: sha512-stg0h48UxgkNuNcCAgCXLp2DUspRQs79bCBPntpCBhsDxk2bhDRUu+J/QpFtDQHG4M4DioSUcYaAsVw2N6N7wA==}
chokidar@4.0.3:
resolution: {integrity: sha512-Qgzu8kfBvo+cA4962jnP1KkS6Dop5NS6g7R5LFYJr4b8Ub94PPQXUksCw9PvXoeXPRRddRNC5C1JQUR2SMGtnA==}
engines: {node: '>= 14.16.0'}
@@ -859,6 +904,25 @@ packages:
snapshots:
'@capacitor/browser@8.0.3(@capacitor/core@8.3.4)':
dependencies:
'@capacitor/core': 8.3.4
'@capacitor/core@3.9.0':
dependencies:
tslib: 2.8.1
'@capacitor/core@8.3.4':
dependencies:
tslib: 2.8.1
'@capacitor/filesystem@8.1.2(@capacitor/core@8.3.4)':
dependencies:
'@capacitor/core': 8.3.4
'@capacitor/synapse': 1.0.4
'@capacitor/synapse@1.0.4': {}
'@emnapi/core@1.10.0':
dependencies:
'@emnapi/wasi-threads': 1.2.1
@@ -1116,52 +1180,56 @@ snapshots:
'@tauri-apps/api@2.11.0': {}
'@tauri-apps/cli-darwin-arm64@2.11.2':
'@tauri-apps/cli-darwin-arm64@2.1.0':
optional: true
'@tauri-apps/cli-darwin-x64@2.11.2':
'@tauri-apps/cli-darwin-x64@2.1.0':
optional: true
'@tauri-apps/cli-linux-arm-gnueabihf@2.11.2':
'@tauri-apps/cli-linux-arm-gnueabihf@2.1.0':
optional: true
'@tauri-apps/cli-linux-arm64-gnu@2.11.2':
'@tauri-apps/cli-linux-arm64-gnu@2.1.0':
optional: true
'@tauri-apps/cli-linux-arm64-musl@2.11.2':
'@tauri-apps/cli-linux-arm64-musl@2.1.0':
optional: true
'@tauri-apps/cli-linux-riscv64-gnu@2.11.2':
'@tauri-apps/cli-linux-x64-gnu@2.1.0':
optional: true
'@tauri-apps/cli-linux-x64-gnu@2.11.2':
'@tauri-apps/cli-linux-x64-musl@2.1.0':
optional: true
'@tauri-apps/cli-linux-x64-musl@2.11.2':
'@tauri-apps/cli-win32-arm64-msvc@2.1.0':
optional: true
'@tauri-apps/cli-win32-arm64-msvc@2.11.2':
'@tauri-apps/cli-win32-ia32-msvc@2.1.0':
optional: true
'@tauri-apps/cli-win32-ia32-msvc@2.11.2':
'@tauri-apps/cli-win32-x64-msvc@2.1.0':
optional: true
'@tauri-apps/cli-win32-x64-msvc@2.11.2':
optional: true
'@tauri-apps/cli@2.11.2':
'@tauri-apps/cli@2.1.0':
optionalDependencies:
'@tauri-apps/cli-darwin-arm64': 2.11.2
'@tauri-apps/cli-darwin-x64': 2.11.2
'@tauri-apps/cli-linux-arm-gnueabihf': 2.11.2
'@tauri-apps/cli-linux-arm64-gnu': 2.11.2
'@tauri-apps/cli-linux-arm64-musl': 2.11.2
'@tauri-apps/cli-linux-riscv64-gnu': 2.11.2
'@tauri-apps/cli-linux-x64-gnu': 2.11.2
'@tauri-apps/cli-linux-x64-musl': 2.11.2
'@tauri-apps/cli-win32-arm64-msvc': 2.11.2
'@tauri-apps/cli-win32-ia32-msvc': 2.11.2
'@tauri-apps/cli-win32-x64-msvc': 2.11.2
'@tauri-apps/cli-darwin-arm64': 2.1.0
'@tauri-apps/cli-darwin-x64': 2.1.0
'@tauri-apps/cli-linux-arm-gnueabihf': 2.1.0
'@tauri-apps/cli-linux-arm64-gnu': 2.1.0
'@tauri-apps/cli-linux-arm64-musl': 2.1.0
'@tauri-apps/cli-linux-x64-gnu': 2.1.0
'@tauri-apps/cli-linux-x64-musl': 2.1.0
'@tauri-apps/cli-win32-arm64-msvc': 2.1.0
'@tauri-apps/cli-win32-ia32-msvc': 2.1.0
'@tauri-apps/cli-win32-x64-msvc': 2.1.0
'@tauri-apps/plugin-dialog@2.7.1':
dependencies:
'@tauri-apps/api': 2.11.0
'@tauri-apps/plugin-fs@2.5.1':
dependencies:
'@tauri-apps/api': 2.11.0
'@tauri-apps/plugin-http@2.5.9':
dependencies:
@@ -1171,6 +1239,10 @@ snapshots:
dependencies:
'@tauri-apps/api': 2.11.0
'@tauri-apps/plugin-process@2.3.1':
dependencies:
'@tauri-apps/api': 2.11.0
'@tauri-apps/plugin-shell@2.3.5':
dependencies:
'@tauri-apps/api': 2.11.0
@@ -1201,6 +1273,10 @@ snapshots:
axobject-query@4.1.0: {}
capacitor-native-biometric@4.2.2:
dependencies:
'@capacitor/core': 3.9.0
chokidar@4.0.3:
dependencies:
readdirp: 4.1.2
@@ -1464,8 +1540,7 @@ snapshots:
totalist@3.0.1: {}
tslib@2.8.1:
optional: true
tslib@2.8.1: {}
typescript@6.0.3: {}
+1
View File
@@ -4,6 +4,7 @@
"version": "0.9.4",
"identifier": "io.github.MokuProject.Moku",
"build": {
"devUrl": "http://localhost:1420",
"frontendDist": "../dist",
"beforeBuildCommand": "pnpm build"
},
-1
View File
@@ -1,6 +1,5 @@
{
"build": {
"devUrl": "http://localhost:1420",
"beforeDevCommand": "pnpm dev"
},
"app": {
+21 -19
View File
@@ -4,8 +4,6 @@ import { open } from '@tauri-apps/plugin-dialog'
import { readFile, writeFile } from '@tauri-apps/plugin-fs'
import { open as openUrl } from '@tauri-apps/plugin-shell'
import { getVersion } from '@tauri-apps/api/app'
import { check } from '@tauri-apps/plugin-updater'
import { relaunch } from '@tauri-apps/plugin-process'
import type {
PlatformAdapter,
PlatformFeature,
@@ -69,19 +67,20 @@ export class TauriAdapter implements PlatformAdapter {
}
async setTitle(title: string) {
await invoke('set_window_title', { title })
await getCurrentWindow().setTitle(title)
}
async minimize() {
await invoke('minimize_window')
await getCurrentWindow().minimize()
}
async maximize() {
await invoke('maximize_window')
const win = getCurrentWindow()
await (await win.isMaximized() ? win.unmaximize() : win.maximize())
}
async close() {
await invoke('close_window')
await getCurrentWindow().close()
}
async toggleFullscreen() {
@@ -106,20 +105,23 @@ export class TauriAdapter implements PlatformAdapter {
}
async checkForAppUpdate(): Promise<AppUpdateInfo | null> {
const update = await check()
if (!update?.available) return null
return {
version: update.version,
url: update.body ?? '',
notes: update.body,
}
const releases = await invoke<Array<{ tag_name: string; html_url: string; body: string }>>('list_releases')
const current = await getVersion()
const valid = releases.filter(r => r.tag_name?.trim())
if (!valid.length) return null
const parse = (v: string) => v.replace(/^v/, '').split('.').map(Number)
const latest = valid.map(r => r.tag_name).sort((a, b) => {
const pa = parse(a), pb = parse(b)
for (let i = 0; i < 3; i++) if ((pb[i] ?? 0) !== (pa[i] ?? 0)) return (pb[i] ?? 0) - (pa[i] ?? 0)
return 0
})[0]
const pa = parse(latest), pb = parse(current)
if (!pa.some((n, i) => n > (pb[i] ?? 0))) return null
const rel = valid.find(r => r.tag_name === latest)!
return { version: latest.replace(/^v/, ''), url: rel.html_url, notes: rel.body }
}
async installAppUpdate() {
const update = await check()
if (update?.available) {
await update.downloadAndInstall()
await relaunch()
}
async installAppUpdate(tag: string) {
await invoke('download_and_install_update', { tag })
}
}
+2 -1
View File
@@ -86,7 +86,7 @@ import {
mapDownloadItem,
mapCategory,
} from './types'
import { clearPageCache as _clearPageCache } from './pageCache'
import { initPageCache, clearPageCache as _clearPageCache } from './pageCache'
const SET_SOCKS_PROXY = `
mutation SetSocksProxy(
@@ -142,6 +142,7 @@ export class SuwayomiAdapter implements ServerAdapter {
const { username, password } = config.credentials
this.authHeader = 'Basic ' + btoa(`${username}:${password}`)
}
initPageCache(this.gql.bind(this), this.getServerUrl.bind(this))
}
getServerUrl(): string {
+15 -6
View File
@@ -1,7 +1,16 @@
import { gql, getServerUrl } from "$lib/server-adapters/suwayomi";
import { getBlobUrl, preloadBlobUrls } from "$lib/core/cache/imageCache";
import { dedupeRequest } from "$lib/core/async/batchRequests";
import { FETCH_CHAPTER_PAGES } from "$lib/server-adapters/suwayomi/chapters";
import { getBlobUrl, preloadBlobUrls } from "$lib/core/cache/imageCache";
import { dedupeRequest } from "$lib/core/async/batchRequests";
import { FETCH_CHAPTER_PAGES } from "$lib/server-adapters/suwayomi/chapters";
type GqlFn = <T>(query: string, vars?: Record<string, unknown>, signal?: AbortSignal) => Promise<T>;
let _gql: GqlFn;
let _getServerUrl: () => string;
export function initPageCache(gql: GqlFn, getServerUrl: () => string): void {
_gql = gql;
_getServerUrl = getServerUrl;
}
const pageCache = new Map<number, string[]>();
const inflight = new Map<number, Promise<string[]>>();
@@ -32,9 +41,9 @@ export function fetchPages(
if (!inflight.has(chapterId)) {
const p = dedupeRequest(`chapter-pages:${chapterId}`, () =>
gql<{ fetchChapterPages: { pages: string[] } }>(FETCH_CHAPTER_PAGES, { chapterId })
_gql<{ fetchChapterPages: { pages: string[] } }>(FETCH_CHAPTER_PAGES, { chapterId })
.then(d => {
const urls = d.fetchChapterPages.pages.map(p => p.startsWith("http") ? p : `${getServerUrl()}${p}`);
const urls = d.fetchChapterPages.pages.map(p => p.startsWith("http") ? p : `${_getServerUrl()}${p}`);
if (useBlob && urls[priorityPage]) getBlobUrl(urls[priorityPage], 999);
pageCache.set(chapterId, urls);
return urls;
+1 -1
View File
@@ -1,2 +1,2 @@
export const ssr = false
export const prerender = true
export const prerender = false
+22
View File
@@ -0,0 +1,22 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512">
<rect width="512" height="512" rx="112" ry="112" fill="#091209"/>
<g transform="translate(256,265) rotate(7) scale(0.098,-0.098) translate(-5000,-4800)" fill="#2d7a5f" stroke="none">
<path d="M4908 6615 c-597 -629 -935 -1264 -934 -1755 0 -508 195 -778 790
-1098 l194 -104 22 -114 c33 -164 76 -271 140 -347 80 -94 106 -62 77 94 -47
255 43 443 294 613 797 539 714 1392 -250 2551 -230 278 -224 275 -333 160z
m52 -945 c0 -472 -8 -850 -17 -850 -36 0 -693 703 -692 740 2 48 167 321 309
509 175 233 359 451 380 451 13 0 20 -304 20 -850z m183 775 c120 -126 357
-447 356 -482 0 -18 -47 -83 -105 -144 -57 -61 -151 -163 -208 -225 -151 -166
-146 -180 -146 406 0 286 7 520 16 520 9 0 48 -34 87 -75z m541 -750 c86 -150
196 -391 196 -430 0 -8 -25 -42 -55 -75 -31 -33 -149 -163 -264 -290 -339
-374 -480 -520 -501 -520 -13 0 -20 167 -20 465 l1 465 151 170 c83 94 193
217 244 275 122 138 137 135 248 -60z m-1098 -633 l374 -378 0 -462 c0 -254
-5 -462 -11 -462 -6 0 -55 23 -110 50 l-99 51 0 208 c0 259 -11 288 -176 457
-196 200 -188 199 -326 62 l-117 -116 -35 79 c-71 161 -39 569 64 816 42 100
20 116 436 -305z m1349 23 c109 -390 -87 -848 -475 -1111 -207 -139 -305 -262
-338 -420 -7 -31 -21 -56 -32 -56 -36 -1 -46 86 -48 405 l-2 313 123 137 c68
75 214 236 325 357 454 493 421 466 447 375z m-1292 -785 c12 -29 15 -118 7
-215 l-14 -166 -73 44 c-174 104 -403 341 -403 416 0 15 47 70 105 123 l104
98 127 -125 c70 -69 136 -147 147 -175z"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 1.5 KiB

+8
View File
@@ -19,5 +19,13 @@ export default defineConfig({
target: ['es2021', 'chrome100', 'safari13'],
minify: !process.env.TAURI_DEBUG ? 'oxc' : false,
sourcemap: !!process.env.TAURI_DEBUG,
rollupOptions: {
external: [
'@capacitor/filesystem',
'@capacitor/app',
'@capacitor/browser',
'capacitor-native-biometric',
],
},
},
})