mirror of
https://github.com/house-of-vanity/hexound.ru.git
synced 2025-07-06 14:24:08 +00:00
add limit and offset to mods uri
This commit is contained in:
14
hexound.py
14
hexound.py
@ -1,8 +1,7 @@
|
||||
from flask import Response, render_template, request, Flask, send_file, jsonify
|
||||
import json
|
||||
import sqlite3
|
||||
#import sqlite3
|
||||
from flask_cors import CORS
|
||||
from pprint import pprint
|
||||
|
||||
app = Flask(__name__, static_folder='mods')
|
||||
CORS(app)
|
||||
@ -16,6 +15,8 @@ def isset(i):
|
||||
@app.route("/mods")
|
||||
def mods():
|
||||
mods = None
|
||||
limit = request.args.get('limit', default = 20, type = int)
|
||||
offset = request.args.get('offset', default = 0, type = int)
|
||||
with open('mods.json') as f:
|
||||
mods = json.load(f)
|
||||
for mod in mods:
|
||||
@ -23,12 +24,9 @@ def mods():
|
||||
isinstance(mod['time'], str)
|
||||
except:
|
||||
mod['time'] = '1522011600'
|
||||
return jsonify(mods)
|
||||
|
||||
@app.route('/login', methods=['GET', 'POST'])
|
||||
def login():
|
||||
if request.method == 'POST':
|
||||
return '213'
|
||||
#limit = len(mods) if limit > len(mods) else limit
|
||||
#offset = len(mods)-limit if offset > len(mods) else offset
|
||||
return jsonify(mods[offset:offset+limit])
|
||||
|
||||
@app.route("/usr", methods = ['POST'])
|
||||
def usr_reg():
|
||||
|
Reference in New Issue
Block a user