From 88553d223d380b788eeb35d8125f6770c4316fa9 Mon Sep 17 00:00:00 2001 From: Josh Moore Date: Sun, 16 Jul 2023 19:17:02 -0600 Subject: [PATCH] feat: added new interfaces for auth & JSON data --- common/types.d.ts | 49 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) diff --git a/common/types.d.ts b/common/types.d.ts index 77fc8a8..84fe8f8 100644 --- a/common/types.d.ts +++ b/common/types.d.ts @@ -134,6 +134,55 @@ declare module 'ass' { timestamp: string; uploader: NID; } + + /** + * Structure of a token in 0.15.0, allowing more fancy features, maybe + */ + interface UploadToken { + /** + * Token ID to link it to a user + */ + id: NID; + /** + * The token itself. The user will need this for upload auth. + */ + token: string; + /** + * Helps the user know what this token is used for + */ + hint: string; + } + + /** + * Object describing the users of an ass instance + */ + interface AssUser { + id: NID; + username: string; + password: string; + admin: boolean + tokens: NID[]; + files: NID[]; + meta: { [key: string]: any }; + } + + /** + * JSON schema for files.json + */ + interface FilesSchema { + files: AssFile[]; + meta: { [key: string]: any }; + } + + /** + * JSON scheme for users.json + */ + interface UsersSchema { + tokens: UploadToken[]; + users: AssUser[]; + cliKey: string; + meta: { [key: string]: any }; + } } //#region Dummy modules