web: add local processing setting & api type

response is not handled at all yet, this is a raw draft
This commit is contained in:
wukko
2025-01-29 15:06:16 +06:00
parent c7c9cf2f0f
commit a43e7a629b
10 changed files with 49 additions and 19 deletions

View File

@@ -66,6 +66,7 @@ const request = async (url: string) => {
tiktokH265: getSetting("save", "tiktokH265"),
alwaysProxy: getSetting("privacy", "alwaysProxy"),
localProcessing: getSetting("advanced", "localProcessing"),
}
await getServerInfo();

View File

@@ -5,7 +5,7 @@ const defaultSettings: CobaltSettings = {
schemaVersion: 5,
advanced: {
debug: false,
duck: false,
localProcessing: false,
},
appearance: {
theme: "auto",

View File

@@ -3,6 +3,7 @@ enum CobaltResponseType {
Picker = 'picker',
Redirect = 'redirect',
Tunnel = 'tunnel',
LocalProcessing = 'local-processing',
}
export type CobaltErrorResponse = {
@@ -40,6 +41,33 @@ type CobaltTunnelResponse = {
status: CobaltResponseType.Tunnel,
} & CobaltPartialURLResponse;
type CobaltLocalProcessingResponse = {
status: CobaltResponseType.LocalProcessing,
tunnel: string[],
// TODO: proper type for processing types
type: string,
service: string,
filename?: string,
metadata?: {
album?: string,
copyright?: string,
title?: string,
artist?: string,
track?: string,
date?: string
},
audio?: {
copy: boolean,
format: string,
bitrate: string,
},
isHLS?: boolean,
}
export type CobaltFileUrlType = "redirect" | "tunnel";
export type CobaltSession = {
@@ -69,4 +97,5 @@ export type CobaltServerInfoResponse = CobaltServerInfo | CobaltErrorResponse;
export type CobaltAPIResponse = CobaltErrorResponse
| CobaltPickerResponse
| CobaltRedirectResponse
| CobaltTunnelResponse;
| CobaltTunnelResponse
| CobaltLocalProcessingResponse;

View File

@@ -3,6 +3,6 @@ import { type CobaltSettingsV4 } from "$lib/types/settings/v4";
export type CobaltSettingsV5 = Omit<CobaltSettingsV4, 'schemaVersion' | 'advanced'> & {
schemaVersion: 5,
advanced: CobaltSettingsV4['advanced'] & {
duck: boolean;
localProcessing: boolean;
};
};