diff --git a/.gitignore b/.gitignore index 85c923b..4ab0350 100644 --- a/.gitignore +++ b/.gitignore @@ -8,4 +8,17 @@ node_modules !.env.example vite.config.js.timestamp-* vite.config.ts.timestamp-* -*.db \ No newline at end of file +*.db + +.vscode/* +!.vscode/settings.json +!.vscode/tasks.json +!.vscode/launch.json +!.vscode/extensions.json +!.vscode/*.code-snippets + +# Local History for Visual Studio Code +.history/ + +# Built Visual Studio Code Extensions +*.vsix \ No newline at end of file diff --git a/openapi.yaml b/openapi.yaml index 6db6d59..0823cef 100644 --- a/openapi.yaml +++ b/openapi.yaml @@ -34,37 +34,11 @@ paths: connections: type: array items: - $ref: '#/components/schemas/Connection' + $ref: '#/components/schemas/ConnectionInfo' '400': description: Bad Request '401': description: Unauthorized - /connections/{connectionId}/info: - get: - summary: Returns unique info from the specified connection - tags: - - Connections - parameters: - - in: path - name: connectionId - schema: - type: string - description: The id of the connection - required: true - responses: - '200': - description: Any info relevant to the connection, such as username, profile picture, etc. - content: - application/json: - schema: - type: object - required: - - info - properties: - info: - $ref: '#/components/schemas/ConnectionInfo' - '401': - description: Unauthorized /users/{userId}/connections: get: summary: Returns all connections for a specified user @@ -90,7 +64,7 @@ paths: connections: type: array items: - $ref: '#/components/schemas/Connection' + $ref: '#/components/schemas/ConnectionInfo' '401': description: Unauthorized @@ -119,84 +93,184 @@ paths: recommendations: type: array items: - $ref: '#/components/schemas/MediaItem' + oneOf: + - $ref: '#/components/schemas/Song' + - $ref: '#/components/schemas/Album' + - $ref: '#/components/schemas/Artist' + - $ref: '#/components/schemas/Playlist' + discriminator: + propertyName: type '401': description: Unauthorized components: schemas: - serviceType: - type: string - enum: ['jellyfin', 'youtube-music'] - Service: - type: object - required: - - type - - userId - - urlOrigin - properties: - type: - $ref: '#/components/schemas/serviceType' - userId: - type: string - urlOrigin: - type: string - Connection: + ConnectionInfo: type: object required: - id - userId - - service - - accessToken + - type properties: id: type: string userId: type: string - service: - $ref: '#/components/schemas/Service' - accessToken: + type: type: string - refreshToken: - type: string - expiry: - type: number - ConnectionInfo: - type: object - required: - - connectionId - - serviceType - properties: - connectionId: - type: string - serviceType: - $ref: '#/components/schemas/serviceType' - username: + enum: + - 'jellyfin' + - 'youtube-music' + serverUrl: type: string serverName: type: string + jellyfinUserId: + type: string + username: + type: string + youtubeUserId: + type: string profilePicture: type: string - MediaItem: + Song: type: object required: - - connectionId - - serviceType - - type + - connection - id - name + - type properties: - connectionId: + connection: type: string - serviceType: - $ref: '#/components/schemas/serviceType' - type: - type: string - enum: ['song', 'album', 'playlist', 'artist'] id: type: string name: type: string + type: + type: string + enum: + - 'song' + duration: + type: number + thumbnail: + type: string + artists: + type: array + items: + type: object + required: + - id + - name + properties: + id: + type: string + name: + type: string + album: + type: object + required: + - id + - name + properties: + id: + type: string + name: + type: string + createdBy: + type: object + required: + - id + - name + properties: + id: + type: string + name: + type: string + releaseDate: + type: string + Album: + type: object + required: + - connection + - id + - name + - type + properties: + connection: + type: string + id: + type: string + name: + type: string + type: + type: string + enum: + - 'album' + duration: + type: number + thumbnail: + type: string + artists: + type: object + required: + - id + - name + properties: + id: + type: string + name: + type: string + releaseDate: + type: string + Artist: + type: object + required: + - connection + - id + - name + - type + properties: + connection: + type: string + id: + type: string + name: + type: string + type: + type: string + enum: + - 'artist' + thumbnail: + type: string + Playlist: + type: object + required: + - connection + - id + - name + - type + properties: + connection: + type: string + id: + type: string + name: + type: string + type: + type: string + enum: + - 'playlist' + createdBy: + type: object + required: + - id + - name + properties: + id: + type: string + name: + type: string thumbnail: type: string \ No newline at end of file diff --git a/src/app.d.ts b/src/app.d.ts index dbba7f1..9a9e06e 100644 --- a/src/app.d.ts +++ b/src/app.d.ts @@ -107,7 +107,6 @@ declare global { name: string } thumbnail?: string - description?: string } } diff --git a/src/routes/(app)/user/connectionProfile.svelte b/src/routes/(app)/user/connectionProfile.svelte index 6ca9074..cf5806d 100644 --- a/src/routes/(app)/user/connectionProfile.svelte +++ b/src/routes/(app)/user/connectionProfile.svelte @@ -11,10 +11,10 @@ $: serviceData = Services[connectionInfo.type] const subHeaderItems: string[] = [] - if ('username' in connectionInfo) { + if ('username' in connectionInfo && connectionInfo.username) { subHeaderItems.push(connectionInfo.username) } - if ('serverName' in connectionInfo) { + if ('serverName' in connectionInfo && connectionInfo.serverName) { subHeaderItems.push(connectionInfo.serverName) }