mirror of
https://codeberg.org/gothub/RandomInstance
synced 2024-12-06 19:16:49 +01:00
Merge branch 'master' of https://codeberg.org/gothub/RandomInstance
This commit is contained in:
+1
-1
@@ -8,4 +8,4 @@ RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt
|
||||
|
||||
COPY . /code
|
||||
|
||||
CMD ["uvicorn", "code.main:app", "--host", "0.0.0.0", "--port", "8080"]
|
||||
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8080"]
|
||||
|
||||
@@ -11,7 +11,7 @@ app = FastAPI()
|
||||
def read_root():
|
||||
return {"Response": "Hello World"}
|
||||
|
||||
@app.get("/redirect")
|
||||
@app.get("/random")
|
||||
def redirect():
|
||||
# get GotHub instances json from codeberg
|
||||
r = requests.get("https://codeberg.org/gothub/gothub-instances/raw/branch/master/instances.json")
|
||||
@@ -22,7 +22,7 @@ def redirect():
|
||||
# redirect to random instance
|
||||
return RedirectResponse(url=instance["link"])
|
||||
|
||||
@app.get("/redirect/dev")
|
||||
@app.get("/random/dev")
|
||||
def redirect_dev():
|
||||
# get GotHub instances json from codeberg
|
||||
r = requests.get("https://codeberg.org/gothub/gothub-instances/raw/branch/master/instances.json")
|
||||
@@ -33,7 +33,7 @@ def redirect_dev():
|
||||
# redirect to random instance
|
||||
return RedirectResponse(url=instance["link"])
|
||||
|
||||
@app.get("/redirect/master")
|
||||
@app.get("/random/master")
|
||||
def redirect_master():
|
||||
# get GotHub instances json from codeberg
|
||||
r = requests.get("https://codeberg.org/gothub/gothub-instances/raw/branch/master/instances.json")
|
||||
@@ -42,4 +42,4 @@ def redirect_master():
|
||||
instance = random.choice([i for i in r.json() if i["branch" == "master"]])
|
||||
|
||||
# redirect to random instance
|
||||
return RedirectResponse(url=instance["link"])
|
||||
return RedirectResponse(url=instance["link"])
|
||||
|
||||
Reference in New Issue
Block a user