From 37fc708aba046c8b5b392d5d36a99453a58ba3ab Mon Sep 17 00:00:00 2001 From: brokencube Date: Mon, 18 May 2026 16:42:31 +0100 Subject: [PATCH] Add stubs for all OpenSubsonic routes --- src/subsonic/router.ts | 526 ++++++++++++++++++++++++++++++++++++++++- 1 file changed, 519 insertions(+), 7 deletions(-) diff --git a/src/subsonic/router.ts b/src/subsonic/router.ts index ad67c68..62d4cef 100644 --- a/src/subsonic/router.ts +++ b/src/subsonic/router.ts @@ -1,7 +1,9 @@ -import {get, middleware, post, router} from "../core/router"; +import {get, middleware, router} from "../core/router"; import Koa from "koa"; import {extractSubsonicApiContext, subsonicErrorHandler} from "./middleware"; import {Renderer} from "./renderer"; +import {SubsonicError} from "./error"; +import {SubsonicErrorCode} from "../enum"; @router('/rest') @middleware(subsonicErrorHandler) @@ -13,10 +15,520 @@ export class SubsonicRouter { ctx.body = Renderer.render(null, ctx.subsonicContext) } - @get('/ping2') - @post('/ping2') - ping2(ctx: Koa.Context) { - console.log('ping'); - ctx.body = Renderer.render(null, ctx.subsonicContext) + @get('/addChatMessage') + addChatMessage(ctx: Koa.Context) { + console.log(ctx.body, ctx.subsonicContext); + throw new SubsonicError(SubsonicErrorCode.Generic, 'addChatMessage'); } -} \ No newline at end of file + + @get('/changePassword') + changePassword(ctx: Koa.Context) { + console.log(ctx.body, ctx.subsonicContext); + throw new SubsonicError(SubsonicErrorCode.NotFound, 'changePassword'); + } + + @get('/createBookmark') + createBookmark(ctx: Koa.Context) { + console.log(ctx.body, ctx.subsonicContext); + throw new SubsonicError(SubsonicErrorCode.Generic, 'createBookmark'); + } + + @get('/createInternetRadioStation') + createInternetRadioStation(ctx: Koa.Context) { + console.log(ctx.body, ctx.subsonicContext); + throw new SubsonicError(SubsonicErrorCode.Generic, 'createInternetRadioStation'); + } + + @get('/createPlaylist') + createPlaylist(ctx: Koa.Context) { + console.log(ctx.body, ctx.subsonicContext); + throw new SubsonicError(SubsonicErrorCode.Generic, 'createPlaylist'); + } + + @get('/createPodcastChannel') + createPodcastChannel(ctx: Koa.Context) { + console.log(ctx.body, ctx.subsonicContext); + throw new SubsonicError(SubsonicErrorCode.Generic, 'createPodcastChannel'); + } + + @get('/createShare') + createShare(ctx: Koa.Context) { + console.log(ctx.body, ctx.subsonicContext); + throw new SubsonicError(SubsonicErrorCode.Generic, 'createShare'); + } + + @get('/createUser') + createUser(ctx: Koa.Context) { + console.log(ctx.body, ctx.subsonicContext); + throw new SubsonicError(SubsonicErrorCode.NotFound, 'createUser'); + } + + @get('/deleteBookmark') + deleteBookmark(ctx: Koa.Context) { + console.log(ctx.body, ctx.subsonicContext); + throw new SubsonicError(SubsonicErrorCode.Generic, 'deleteBookmark'); + } + + @get('/deleteInternetRadioStation') + deleteInternetRadioStation(ctx: Koa.Context) { + console.log(ctx.body, ctx.subsonicContext); + throw new SubsonicError(SubsonicErrorCode.Generic, 'deleteInternetRadioStation'); + } + + @get('/deletePlaylist') + deletePlaylist(ctx: Koa.Context) { + console.log(ctx.body, ctx.subsonicContext); + throw new SubsonicError(SubsonicErrorCode.Generic, 'deletePlaylist'); + } + + @get('/deletePodcastChannel') + deletePodcastChannel(ctx: Koa.Context) { + console.log(ctx.body, ctx.subsonicContext); + throw new SubsonicError(SubsonicErrorCode.Generic, 'deletePodcastChannel'); + } + + @get('/deletePodcastEpisode') + deletePodcastEpisode(ctx: Koa.Context) { + console.log(ctx.body, ctx.subsonicContext); + throw new SubsonicError(SubsonicErrorCode.Generic, 'deletePodcastEpisode'); + } + + @get('/deleteShare') + deleteShare(ctx: Koa.Context) { + console.log(ctx.body, ctx.subsonicContext); + throw new SubsonicError(SubsonicErrorCode.Generic, 'deleteShare'); + } + + @get('/deleteUser') + deleteUser(ctx: Koa.Context) { + console.log(ctx.body, ctx.subsonicContext); + throw new SubsonicError(SubsonicErrorCode.NotFound, 'deleteUser'); + } + + @get('/download') + download(ctx: Koa.Context) { + console.log(ctx.body, ctx.subsonicContext); + throw new SubsonicError(SubsonicErrorCode.Generic, 'download'); + } + + @get('/downloadPodcastEpisode') + downloadPodcastEpisode(ctx: Koa.Context) { + console.log(ctx.body, ctx.subsonicContext); + throw new SubsonicError(SubsonicErrorCode.Generic, 'downloadPodcastEpisode'); + } + + @get('/findSonicPath') + findSonicPath(ctx: Koa.Context) { + console.log(ctx.body, ctx.subsonicContext); + throw new SubsonicError(SubsonicErrorCode.Generic, 'findSonicPath'); + } + + @get('/getAlbum') + getAlbum(ctx: Koa.Context) { + console.log(ctx.body, ctx.subsonicContext); + throw new SubsonicError(SubsonicErrorCode.Generic, 'getAlbum'); + } + + @get('/getAlbumInfo') + getAlbumInfo(ctx: Koa.Context) { + console.log(ctx.body, ctx.subsonicContext); + throw new SubsonicError(SubsonicErrorCode.Generic, 'getAlbumInfo'); + } + + @get('/getAlbumInfo2') + getAlbumInfo2(ctx: Koa.Context) { + console.log(ctx.body, ctx.subsonicContext); + throw new SubsonicError(SubsonicErrorCode.Generic, 'getAlbumInfo2'); + } + + @get('/getAlbumList') + getAlbumList(ctx: Koa.Context) { + console.log(ctx.body, ctx.subsonicContext); + throw new SubsonicError(SubsonicErrorCode.Generic, 'getAlbumList'); + } + + @get('/getAlbumList2') + getAlbumList2(ctx: Koa.Context) { + console.log(ctx.body, ctx.subsonicContext); + throw new SubsonicError(SubsonicErrorCode.Generic, 'getAlbumList2'); + } + + @get('/getArtist') + getArtist(ctx: Koa.Context) { + console.log(ctx.body, ctx.subsonicContext); + throw new SubsonicError(SubsonicErrorCode.Generic, 'getArtist'); + } + + @get('/getArtistInfo') + getArtistInfo(ctx: Koa.Context) { + console.log(ctx.body, ctx.subsonicContext); + throw new SubsonicError(SubsonicErrorCode.Generic, 'getArtistInfo'); + } + + @get('/getArtistInfo2') + getArtistInfo2(ctx: Koa.Context) { + console.log(ctx.body, ctx.subsonicContext); + throw new SubsonicError(SubsonicErrorCode.Generic, 'getArtistInfo2'); + } + + @get('/getArtists') + getArtists(ctx: Koa.Context) { + console.log(ctx.body, ctx.subsonicContext); + throw new SubsonicError(SubsonicErrorCode.Generic, 'getArtists'); + } + + @get('/getAvatar') + getAvatar(ctx: Koa.Context) { + console.log(ctx.body, ctx.subsonicContext); + throw new SubsonicError(SubsonicErrorCode.Generic, 'getAvatar'); + } + + @get('/getBookmarks') + getBookmarks(ctx: Koa.Context) { + console.log(ctx.body, ctx.subsonicContext); + throw new SubsonicError(SubsonicErrorCode.Generic, 'getBookmarks'); + } + + @get('/getCaptions') + getCaptions(ctx: Koa.Context) { + console.log(ctx.body, ctx.subsonicContext); + throw new SubsonicError(SubsonicErrorCode.Generic, 'getCaptions'); + } + + @get('/getChatMessages') + getChatMessages(ctx: Koa.Context) { + console.log(ctx.body, ctx.subsonicContext); + throw new SubsonicError(SubsonicErrorCode.Generic, 'getChatMessages'); + } + + @get('/getCoverArt') + getCoverArt(ctx: Koa.Context) { + console.log(ctx.body, ctx.subsonicContext); + throw new SubsonicError(SubsonicErrorCode.Generic, 'getCoverArt'); + } + + @get('/getGenres') + getGenres(ctx: Koa.Context) { + console.log(ctx.body, ctx.subsonicContext); + throw new SubsonicError(SubsonicErrorCode.Generic, 'getGenres'); + } + + @get('/getIndexes') + getIndexes(ctx: Koa.Context) { + console.log(ctx.body, ctx.subsonicContext); + throw new SubsonicError(SubsonicErrorCode.Generic, 'getIndexes'); + } + + @get('/getInternetRadioStations') + getInternetRadioStations(ctx: Koa.Context) { + console.log(ctx.body, ctx.subsonicContext); + throw new SubsonicError(SubsonicErrorCode.Generic, 'getInternetRadioStations'); + } + + @get('/getLicense') + getLicense(ctx: Koa.Context) { + console.log(ctx.body, ctx.subsonicContext); + throw new SubsonicError(SubsonicErrorCode.Generic, 'getLicense'); + } + + @get('/getLyrics') + getLyrics(ctx: Koa.Context) { + console.log(ctx.body, ctx.subsonicContext); + throw new SubsonicError(SubsonicErrorCode.Generic, 'getLyrics'); + } + + @get('/getLyricsBySongId') + getLyricsBySongId(ctx: Koa.Context) { + console.log(ctx.body, ctx.subsonicContext); + throw new SubsonicError(SubsonicErrorCode.Generic, 'getLyricsBySongId'); + } + + @get('/getMusicDirectory') + getMusicDirectory(ctx: Koa.Context) { + console.log(ctx.body, ctx.subsonicContext); + throw new SubsonicError(SubsonicErrorCode.Generic, 'getMusicDirectory'); + } + + @get('/getMusicFolders') + getMusicFolders(ctx: Koa.Context) { + console.log(ctx.body, ctx.subsonicContext); + throw new SubsonicError(SubsonicErrorCode.Generic, 'getMusicFolders'); + } + + @get('/getNewestPodcasts') + getNewestPodcasts(ctx: Koa.Context) { + console.log(ctx.body, ctx.subsonicContext); + throw new SubsonicError(SubsonicErrorCode.Generic, 'getNewestPodcasts'); + } + + @get('/getNowPlaying') + getNowPlaying(ctx: Koa.Context) { + console.log(ctx.body, ctx.subsonicContext); + throw new SubsonicError(SubsonicErrorCode.Generic, 'getNowPlaying'); + } + + @get('/getOpenSubsonicExtensions') + getOpenSubsonicExtensions(ctx: Koa.Context) { + console.log(ctx.body, ctx.subsonicContext); + throw new SubsonicError(SubsonicErrorCode.Generic, 'getOpenSubsonicExtensions'); + } + + @get('/getPlaylist') + getPlaylist(ctx: Koa.Context) { + console.log(ctx.body, ctx.subsonicContext); + throw new SubsonicError(SubsonicErrorCode.Generic, 'getPlaylist'); + } + + @get('/getPlaylists') + getPlaylists(ctx: Koa.Context) { + console.log(ctx.body, ctx.subsonicContext); + throw new SubsonicError(SubsonicErrorCode.Generic, 'getPlaylists'); + } + + @get('/getPlayQueue') + getPlayQueue(ctx: Koa.Context) { + console.log(ctx.body, ctx.subsonicContext); + throw new SubsonicError(SubsonicErrorCode.Generic, 'getPlayQueue'); + } + + @get('/getPlayQueueByIndex') + getPlayQueueByIndex(ctx: Koa.Context) { + console.log(ctx.body, ctx.subsonicContext); + throw new SubsonicError(SubsonicErrorCode.Generic, 'getPlayQueueByIndex'); + } + + @get('/getPodcastEpisode') + getPodcastEpisode(ctx: Koa.Context) { + console.log(ctx.body, ctx.subsonicContext); + throw new SubsonicError(SubsonicErrorCode.Generic, 'getPodcastEpisode'); + } + + @get('/getPodcasts') + getPodcasts(ctx: Koa.Context) { + console.log(ctx.body, ctx.subsonicContext); + throw new SubsonicError(SubsonicErrorCode.Generic, 'getPodcasts'); + } + + @get('/getRandomSongs') + getRandomSongs(ctx: Koa.Context) { + console.log(ctx.body, ctx.subsonicContext); + throw new SubsonicError(SubsonicErrorCode.Generic, 'getRandomSongs'); + } + + @get('/getScanStatus') + getScanStatus(ctx: Koa.Context) { + console.log(ctx.body, ctx.subsonicContext); + throw new SubsonicError(SubsonicErrorCode.Generic, 'getScanStatus'); + } + + @get('/getShares') + getShares(ctx: Koa.Context) { + console.log(ctx.body, ctx.subsonicContext); + throw new SubsonicError(SubsonicErrorCode.Generic, 'getShares'); + } + + @get('/getSimilarSongs') + getSimilarSongs(ctx: Koa.Context) { + console.log(ctx.body, ctx.subsonicContext); + throw new SubsonicError(SubsonicErrorCode.Generic, 'getSimilarSongs'); + } + + @get('/getSimilarSongs2') + getSimilarSongs2(ctx: Koa.Context) { + console.log(ctx.body, ctx.subsonicContext); + throw new SubsonicError(SubsonicErrorCode.Generic, 'getSimilarSongs2'); + } + + @get('/getSong') + getSong(ctx: Koa.Context) { + console.log(ctx.body, ctx.subsonicContext); + throw new SubsonicError(SubsonicErrorCode.Generic, 'getSong'); + } + + @get('/getSongsByGenre') + getSongsByGenre(ctx: Koa.Context) { + console.log(ctx.body, ctx.subsonicContext); + throw new SubsonicError(SubsonicErrorCode.Generic, 'getSongsByGenre'); + } + + @get('/getSonicSimilarTracks') + getSonicSimilarTracks(ctx: Koa.Context) { + console.log(ctx.body, ctx.subsonicContext); + throw new SubsonicError(SubsonicErrorCode.Generic, 'getSonicSimilarTracks'); + } + + @get('/getStarred') + getStarred(ctx: Koa.Context) { + console.log(ctx.body, ctx.subsonicContext); + throw new SubsonicError(SubsonicErrorCode.Generic, 'getStarred'); + } + + @get('/getStarred2') + getStarred2(ctx: Koa.Context) { + console.log(ctx.body, ctx.subsonicContext); + throw new SubsonicError(SubsonicErrorCode.Generic, 'getStarred2'); + } + + @get('/getTopSongs') + getTopSongs(ctx: Koa.Context) { + console.log(ctx.body, ctx.subsonicContext); + throw new SubsonicError(SubsonicErrorCode.Generic, 'getTopSongs'); + } + + @get('/getTranscodeDecision') + getTranscodeDecision(ctx: Koa.Context) { + console.log(ctx.body, ctx.subsonicContext); + throw new SubsonicError(SubsonicErrorCode.Generic, 'getTranscodeDecision'); + } + + @get('/getTranscodeStream') + getTranscodeStream(ctx: Koa.Context) { + console.log(ctx.body, ctx.subsonicContext); + throw new SubsonicError(SubsonicErrorCode.Generic, 'getTranscodeStream'); + } + + @get('/getUser') + getUser(ctx: Koa.Context) { + console.log(ctx.body, ctx.subsonicContext); + throw new SubsonicError(SubsonicErrorCode.Generic, 'getUser'); + } + + @get('/getUsers') + getUsers(ctx: Koa.Context) { + console.log(ctx.body, ctx.subsonicContext); + throw new SubsonicError(SubsonicErrorCode.Generic, 'getUsers'); + } + + @get('/getVideoInfo') + getVideoInfo(ctx: Koa.Context) { + console.log(ctx.body, ctx.subsonicContext); + throw new SubsonicError(SubsonicErrorCode.Generic, 'getVideoInfo'); + } + + @get('/getVideos') + getVideos(ctx: Koa.Context) { + console.log(ctx.body, ctx.subsonicContext); + throw new SubsonicError(SubsonicErrorCode.Generic, 'getVideos'); + } + + @get('/hls') + @get('/hls.m3u8') + hls(ctx: Koa.Context) { + console.log(ctx.body, ctx.subsonicContext); + throw new SubsonicError(SubsonicErrorCode.Generic, 'hls'); + } + + @get('/jukeboxControl') + jukeboxControl(ctx: Koa.Context) { + console.log(ctx.body, ctx.subsonicContext); + throw new SubsonicError(SubsonicErrorCode.Generic, 'jukeboxControl'); + } + + @get('/refreshPodcasts') + refreshPodcasts(ctx: Koa.Context) { + console.log(ctx.body, ctx.subsonicContext); + throw new SubsonicError(SubsonicErrorCode.Generic, 'refreshPodcasts'); + } + + @get('/reportPlayback') + reportPlayback(ctx: Koa.Context) { + console.log(ctx.body, ctx.subsonicContext); + throw new SubsonicError(SubsonicErrorCode.Generic, 'reportPlayback'); + } + + @get('/savePlayQueue') + savePlayQueue(ctx: Koa.Context) { + console.log(ctx.body, ctx.subsonicContext); + throw new SubsonicError(SubsonicErrorCode.Generic, 'savePlayQueue'); + } + + @get('/savePlayQueueByIndex') + savePlayQueueByIndex(ctx: Koa.Context) { + console.log(ctx.body, ctx.subsonicContext); + throw new SubsonicError(SubsonicErrorCode.Generic, 'savePlayQueueByIndex'); + } + + @get('/scrobble') + scrobble(ctx: Koa.Context) { + console.log(ctx.body, ctx.subsonicContext); + throw new SubsonicError(SubsonicErrorCode.Generic, 'scrobble'); + } + + @get('/search') + search(ctx: Koa.Context) { + console.log(ctx.body, ctx.subsonicContext); + throw new SubsonicError(SubsonicErrorCode.Generic, 'search'); + } + + @get('/search2') + search2(ctx: Koa.Context) { + console.log(ctx.body, ctx.subsonicContext); + throw new SubsonicError(SubsonicErrorCode.Generic, 'search2'); + } + + @get('/search3') + search3(ctx: Koa.Context) { + console.log(ctx.body, ctx.subsonicContext); + throw new SubsonicError(SubsonicErrorCode.Generic, 'search3'); + } + + @get('/setRating') + setRating(ctx: Koa.Context) { + console.log(ctx.body, ctx.subsonicContext); + throw new SubsonicError(SubsonicErrorCode.Generic, 'setRating'); + } + + @get('/star') + star(ctx: Koa.Context) { + console.log(ctx.body, ctx.subsonicContext); + throw new SubsonicError(SubsonicErrorCode.Generic, 'star'); + } + + @get('/startScan') + startScan(ctx: Koa.Context) { + console.log(ctx.body, ctx.subsonicContext); + throw new SubsonicError(SubsonicErrorCode.Generic, 'startScan'); + } + + @get('/stream') + stream(ctx: Koa.Context) { + console.log(ctx.body, ctx.subsonicContext); + throw new SubsonicError(SubsonicErrorCode.Generic, 'stream'); + } + + @get('/tokenInfo') + tokenInfo(ctx: Koa.Context) { + console.log(ctx.body, ctx.subsonicContext); + throw new SubsonicError(SubsonicErrorCode.Generic, 'tokenInfo'); + } + + @get('/unstar') + unstar(ctx: Koa.Context) { + console.log(ctx.body, ctx.subsonicContext); + throw new SubsonicError(SubsonicErrorCode.Generic, 'unstar'); + } + + @get('/updateInternetRadioStation') + updateInternetRadioStation(ctx: Koa.Context) { + console.log(ctx.body, ctx.subsonicContext); + throw new SubsonicError(SubsonicErrorCode.Generic, 'updateInternetRadioStation'); + } + + @get('/updatePlaylist') + updatePlaylist(ctx: Koa.Context) { + console.log(ctx.body, ctx.subsonicContext); + throw new SubsonicError(SubsonicErrorCode.Generic, 'updatePlaylist'); + } + + @get('/updateShare') + updateShare(ctx: Koa.Context) { + console.log(ctx.body, ctx.subsonicContext); + throw new SubsonicError(SubsonicErrorCode.Generic, 'updateShare'); + } + + @get('/updateUser') + updateUser(ctx: Koa.Context) { + console.log(ctx.body, ctx.subsonicContext); + throw new SubsonicError(SubsonicErrorCode.Generic, 'updateUser'); + } +}