updated palworld config and added webpages for simple restore
This commit is contained in:
1 parent
01d5a95476
commit
dcdc4265cb
7 files changed
+346
-1
No files matched your search
@@ -0,0 +1,37 @@
|
||||
from flask import Flask, render_template, send_from_directory, abort
|
||||
import json
|
||||
import random
|
||||
|
||||
app_base = Flask(__name__)
|
||||
|
||||
|
||||
def get_random_image():
|
||||
try:
|
||||
with open("images/images.json") as f:
|
||||
|
||||
images = json.load(f)
|
||||
return random.choice(images["images"])
|
||||
except Exception as e:
|
||||
return {
|
||||
"filename": "https://picsum.photos/200/300",
|
||||
"author": f"{e}",
|
||||
"source": "picsum.photos"
|
||||
}
|
||||
|
||||
@app_base.route("/")
|
||||
def index():
|
||||
return render_template(
|
||||
"index.html",
|
||||
image=get_random_image()
|
||||
)
|
||||
|
||||
@app_base.route("/images/<filename>")
|
||||
def host_image(filename):
|
||||
try:
|
||||
return send_from_directory("images",filename)
|
||||
except Exception:
|
||||
abort(404)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
app_base.run(host="0.0.0.0", port=5000)
|
||||
Reference in new issue
Block a user