summary refs log tree commit diff
diff options
context:
space:
mode:
authorPuyodead1 <puyodead@proton.me>2023-12-20 02:43:28 -0500
committerPuyodead1 <puyodead@proton.me>2023-12-20 02:43:58 -0500
commit07db919bc93c3aef0b55666176e877456b064cbe (patch)
tree216fd4dea206e69ab081b1ff5d64d7ab9be8a1e7
parentadd missing license headers (diff)
downloadserver-07db919bc93c3aef0b55666176e877456b064cbe.tar.xz
updated updates route for spacebar client
-rw-r--r--src/api/routes/updates.ts23
-rw-r--r--src/util/entities/ClientRelease.ts18
-rw-r--r--src/util/schemas/responses/UpdatesResponse.ts26
3 files changed, 62 insertions, 5 deletions
diff --git a/src/api/routes/updates.ts b/src/api/routes/updates.ts

index 101bd3bc..8d71cd98 100644 --- a/src/api/routes/updates.ts +++ b/src/api/routes/updates.ts
@@ -36,9 +36,26 @@ router.get( body: "APIErrorResponse", }, }, + query: { + platform: { + type: "string", + required: true, + description: "The platform to get the manifest for", + }, + arch: { + type: "string", + required: true, + description: "The architecture to get the manifest for", + }, + channel: { + type: "string", + required: true, + description: "The release channel to get the manifest for", + }, + }, }), async (req: Request, res: Response) => { - const platform = req.query.platform; + const { platform, arch, channel } = req.query; if (!platform) throw FieldErrors({ @@ -52,15 +69,19 @@ router.get( where: { enabled: true, platform: platform as string, + arch: arch as string, + channel: channel as string, }, order: { pub_date: "DESC" }, }); res.json({ + version: release.version, name: release.name, pub_date: release.pub_date, url: release.url, notes: release.notes, + signature: release.signature, }); }, ); diff --git a/src/util/entities/ClientRelease.ts b/src/util/entities/ClientRelease.ts
index cfbc3a9b..776f882c 100644 --- a/src/util/entities/ClientRelease.ts +++ b/src/util/entities/ClientRelease.ts
@@ -25,17 +25,29 @@ export class Release extends BaseClass { name: string; @Column() - pub_date: Date; + version: string; @Column() - url: string; + pub_date: Date; + + @Column({ nullable: true }) + url: string | null; @Column() platform: string; @Column() + arch: string; + + @Column() enabled: boolean; @Column({ nullable: true }) - notes?: string; + notes: string | null; + + @Column({ nullable: true }) + signature: string | null; + + @Column({ default: "stable" }) + channel: string; } diff --git a/src/util/schemas/responses/UpdatesResponse.ts b/src/util/schemas/responses/UpdatesResponse.ts
index d8770b4e..38076b1b 100644 --- a/src/util/schemas/responses/UpdatesResponse.ts +++ b/src/util/schemas/responses/UpdatesResponse.ts
@@ -17,8 +17,32 @@ */ export interface UpdatesResponse { + /** + * Version to install. + * Tauri Specific + */ + version: string; + /** + * The latest host version. + */ name: string; + /** + * When the update was published + */ pub_date: string; - url: string; + /** + * The URL to the corresponding installer. + * Only provided if auto updates are available for the selected platform. + */ + url: string | null; + /** + * Any extra notes for the update + * Only provided if auto updates are available for the selected platform. + */ notes: string | null; + /** + * The signature of the update. + * Tauri Specific + */ + signature: string | null; }