misc/breaking: remove trailing slashes from endpoints

This commit is contained in:
codey 2025-01-29 15:45:09 -05:00
parent 2e179ca7e6
commit c73180449f
9 changed files with 24 additions and 23 deletions

View File

@ -50,7 +50,7 @@ class AI(FastAPI):
}
for endpoint, handler in self.endpoints.items():
app.add_api_route(f"/{endpoint}/", handler, methods=["POST"] if not endpoint == "testy" else ["POST", "GET"])
app.add_api_route(f"/{endpoint}", handler, methods=["POST"] if not endpoint == "testy" else ["POST", "GET"])
async def respond_via_webhook(self, data: ValidHookSongRequest, originalRequest: Request):
@ -87,7 +87,7 @@ class AI(FastAPI):
async def ai_handler(self, request: Request):
"""
/ai/base/
/ai/base
AI BASE Request
(Requires key)
"""
@ -118,7 +118,7 @@ class AI(FastAPI):
async def ai_openai_handler(self, request: Request):
"""
/ai/openai/
/ai/openai
AI Request
(Requires key)
"""
@ -160,7 +160,7 @@ class AI(FastAPI):
async def ai_song_handler(self, data: ValidAISongRequest, request: Request):
"""
/ai/song/
/ai/song
AI (Song Info) Request [Public]
"""
ai_prompt = "You are a helpful assistant who will provide tidbits of info on songs the user may listen to."

View File

@ -119,12 +119,12 @@ class Karma(FastAPI):
}
for endpoint, handler in self.endpoints.items():
app.add_api_route(f"/{endpoint}/", handler, methods=["POST"])
app.add_api_route(f"/{endpoint}", handler, methods=["POST"])
async def top_karma_handler(self, request: Request, data: ValidTopKarmaRequest | None = None):
"""
/karma/top/
/karma/top
Get top keywords for karma
(Requires key)
"""
@ -149,7 +149,7 @@ class Karma(FastAPI):
async def get_karma_handler(self, data: ValidKarmaRetrievalRequest, request: Request):
"""
/karma/get/
/karma/get
Get current karma value
(Requires key)
"""
@ -173,7 +173,7 @@ class Karma(FastAPI):
async def modify_karma_handler(self, data: ValidKarmaUpdateRequest, request: Request):
"""
/karma/update/
/karma/update
Update karma count
(Requires key)
"""

View File

@ -73,7 +73,7 @@ class LastFM(FastAPI):
}
for endpoint, handler in self.endpoints.items():
app.add_api_route(f"/{endpoint}/", handler, methods=["POST"])
app.add_api_route(f"/{endpoint}", handler, methods=["POST"])
async def artist_by_name_handler(self, data: ValidArtistSearchRequest):
"""

View File

@ -118,7 +118,7 @@ class LyricSearch(FastAPI):
self.lrc_regex = regex.compile(r'\[([0-9]{2}:[0-9]{2})\.[0-9]{1,3}\](\s(.*)){0,}')
for endpoint, handler in self.endpoints.items():
app.add_api_route(f"/{endpoint}/", handler, methods=["POST"])
app.add_api_route(f"/{endpoint}", handler, methods=["POST", "GET"])
# async def lyric_cache_list_handler(self):
# """

View File

@ -32,7 +32,7 @@ class Misc(FastAPI):
}
for endpoint, handler in self.endpoints.items():
app.add_api_route(f"/{endpoint}/", handler, methods=["GET"],
app.add_api_route(f"/{endpoint}", handler, methods=["GET"],
include_in_schema=False)
async def get_radio_np(self) -> dict:
@ -72,7 +72,7 @@ class Misc(FastAPI):
async def homepage_redis_widget(self) -> dict:
"""
/widget/redis/
/widget/redis
Homepage Redis Widget Handler
Args:
None
@ -101,7 +101,7 @@ class Misc(FastAPI):
async def homepage_sqlite_widget(self) -> dict:
"""
/widget/sqlite/
/widget/sqlite
Homepage SQLite Widget Handler
Args:
None
@ -119,7 +119,7 @@ class Misc(FastAPI):
async def homepage_lyrics_widget(self) -> dict:
"""
/widget/lyrics/
/widget/lyrics
Homepage Lyrics Widget Handler
Args:
None
@ -131,7 +131,7 @@ class Misc(FastAPI):
async def homepage_radio_widget(self) -> dict:
"""
/widget/radio/
/widget/radio
Homepage Radio Widget Handler
Args:
None

View File

@ -24,10 +24,11 @@ class RandMsg(FastAPI):
self.endpoint_name = "randmsg"
app.add_api_route(f"/{self.endpoint_name}/", self.randmsg_handler, methods=["POST"])
app.add_api_route(f"/{self.endpoint_name}", self.randmsg_handler, methods=["POST"])
async def randmsg_handler(self, data: RandMsgRequest = None):
"""
/randmsg
Get a randomly generated message
"""
random.seed()

View File

@ -36,11 +36,11 @@ class Transcriptions(FastAPI):
}
for endpoint, handler in self.endpoints.items():
app.add_api_route(f"/{endpoint}/", handler, methods=["POST"])
app.add_api_route(f"/{endpoint}", handler, methods=["POST"])
async def get_episodes_handler(self, data: ValidShowEpisodeListRequest):
"""
/transcriptions/get_episodes/
/transcriptions/get_episodes
Get list of episodes by show id
"""
show_id = data.s
@ -97,7 +97,7 @@ class Transcriptions(FastAPI):
}
async def get_episode_lines_handler(self, data: ValidShowEpisodeLineRequest):
"""/transcriptions/get_episode_lines/
"""/transcriptions/get_episode_lines
Get lines for a particular episode
"""
show_id = data.s

View File

@ -42,7 +42,7 @@ class XC(FastAPI):
app.add_api_websocket_route(f"/{endpoint}/", handler)
for endpoint, handler in self.endpoints.items():
app.add_api_route(f"/{endpoint}/", handler, methods=["POST"])
app.add_api_route(f"/{endpoint}", handler, methods=["POST"])
# async def put_ws_handler(self, ws: WebSocket):
# await ws.accept()
@ -50,7 +50,7 @@ class XC(FastAPI):
async def xc_handler(self, data: ValidXCRequest, request: Request):
"""
/xc/
/xc
Handle XC Commands
"""
key = data.key

View File

@ -27,11 +27,11 @@ class YT(FastAPI):
}
for endpoint, handler in self.endpoints.items():
app.add_api_route(f"/{endpoint}/", handler, methods=["POST"])
app.add_api_route(f"/{endpoint}", handler, methods=["POST"])
async def yt_video_search_handler(self, data: ValidYTSearchRequest):
"""
/yt_video_search/
/yt_video_search
Search for YT Video by Title (closest match returned)
"""