Skip to content

Commit 77318ed

Browse files
committed
Fix env errors
1 parent 7c3857e commit 77318ed

File tree

3 files changed

+9
-14
lines changed

3 files changed

+9
-14
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ CI/CD via GitHub Actions is set up to test and lint the code. CD requires the re
1919
### Manual Deployment
2020
1. Install dependencies: `npm install` and ensure `wrangler` [is installed](https://developers.cloudflare.com/workers/wrangler/install-and-update/).
2121
2. Run `npm run test` to ensure the code is working as expected.
22-
3. Run `wrangler publish` to deploy the code to Cloudflare Workers.
22+
3. Run `wrangler deploy` to deploy the code to Cloudflare Workers.
2323

2424
## Usage with Tauri
2525
### Tauri >= v1.0.0-rc5:

src/handler.ts

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,6 @@ import { Request, ExecutionContext } from '@cloudflare/workers-types';
1111
import { WritableStream as WebWritableStream } from 'node:stream/web';
1212
import { Env } from '../worker-configuration';
1313

14-
declare global {
15-
const GITHUB_ACCOUNT: string;
16-
const GITHUB_REPO: string;
17-
const GITHUB_API_TOKEN: string;
18-
}
19-
2014
const SendJSON = (data: Record<string, unknown>) => {
2115
return new Response(JSON.stringify(data), {
2216
headers: { 'Content-Type': 'application/json; charset=utf-8' }
@@ -49,7 +43,7 @@ const handleV1Request = async (
4943
if (!target || !arch || !appVersion || !semverValid(appVersion)) {
5044
return responses.NotFound();
5145
}
52-
const release = await getLatestRelease(request, env, ctx);
46+
const release = await getLatestRelease(request, env);
5347

5448
const remoteVersion = sanitizeVersion(release.tag_name.toLowerCase());
5549
if (!remoteVersion || !semverValid(remoteVersion)) {
@@ -72,7 +66,7 @@ const handleV1Request = async (
7266
}
7367

7468
const signature = await findAssetSignature(match.name, release.assets);
75-
const proxy = GITHUB_API_TOKEN?.length;
69+
const proxy = env.GITHUB_API_TOKEN?.length;
7670
const downloadURL = proxy
7771
? createProxiedFileUrl(request, env, ctx, match.browser_download_url)
7872
: match.browser_download_url;
@@ -107,14 +101,15 @@ const createProxiedFileUrl = (
107101
const getLatestAssets = async (
108102
request: Request,
109103
env: Env,
104+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
110105
ctx: ExecutionContext
111106
) => {
112107
const fileName = request.url.split('/')?.at(-1);
113108
if (!fileName) {
114109
throw new Error('Could not get file name from download URL');
115110
}
116111

117-
const release = await getLatestRelease(request, env, ctx);
112+
const release = await getLatestRelease(request, env);
118113
const downloadPath = release.assets.find(
119114
({ name }) => name === fileName
120115
)?.browser_download_url;
@@ -159,5 +154,5 @@ export async function handleRequest(
159154
}
160155
}
161156

162-
return handleLegacyRequest(request, env, ctx);
157+
return handleLegacyRequest(request, env);
163158
}

wrangler.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
name = "tauri-update-server"
2-
compatibility_date = "2024-04-19"
2+
compatibility_date = "2024-06-01"
33
compatibility_flags = ["nodejs_compat"]
44
main = "src/index.ts"
55

66
[vars]
7-
GITHUB_ACCOUNT = 'killeencode'
8-
GITHUB_REPO = 'brancato'
7+
GITHUB_ACCOUNT = 'mackenly'
8+
GITHUB_REPO = 'kavita-import-tool'

0 commit comments

Comments
 (0)