Finish documentation for all endpoints

+ fix #193 (settings https redirect)
+ fix open api docs on binary
+ fix git error on binary
+ remove flask-restful

hopefully, I didn't break something 😩
This commit is contained in:
mungai-njoroge
2024-03-24 15:57:58 +03:00
committed by Mungai Njoroge
parent 99ec11565c
commit 0af1ae1d8e
22 changed files with 547 additions and 418 deletions
+33 -3
View File
@@ -3,6 +3,7 @@ Contains default configs
"""
import os
import subprocess
import sys
from typing import Any
@@ -103,6 +104,7 @@ class Defaults:
API_TRACKHASH = "0853280a12"
API_ALBUMNAME = "Rumours"
API_ARTISTNAME = "girl in red"
API_TRACKNAME = "Apartment 402"
API_CARD_LIMIT = 6
@@ -242,21 +244,49 @@ class TCOLOR:
# credits: https://stackoverflow.com/a/287944
def getLatestCommitHash():
"""
Returns the latest git commit hash for the current branch
"""
try:
hash = subprocess.check_output(["git", "rev-parse", "--short", "HEAD"])
return hash.decode("utf-8").strip()
except:
return ""
def getCurrentBranch():
"""
Returns the current git branch
"""
try:
branch = subprocess.check_output(["git", "rev-parse", "--abbrev-ref", "HEAD"])
return branch.decode("utf-8").strip()
except:
return ""
class Keys:
SWINGMUSIC_APP_VERSION = os.environ.get("SWINGMUSIC_APP_VERSION")
GIT_LATEST_COMMIT_HASH = "<unset>"
GIT_CURRENT_BRANCH = "<unset>"
@classmethod
def load(cls):
if IS_BUILD:
cls.SWINGMUSIC_APP_VERSION = configs.SWINGMUSIC_APP_VERSION
cls.GIT_LATEST_COMMIT_HASH = configs.GIT_LATEST_COMMIT_HASH
cls.GIT_CURRENT_BRANCH = configs.GIT_CURRENT_BRANCH
else:
cls.GIT_LATEST_COMMIT_HASH = getLatestCommitHash()
cls.GIT_CURRENT_BRANCH = getCurrentBranch()
cls.verify_keys()
@classmethod
def verify_keys(cls):
# if not cls.LASTFM_API_KEY:
# print("ERROR: LASTFM_API_KEY not set in environment")
# sys.exit(0)
pass
@classmethod