Compare commits
2 Commits
dc56b6f4ad
...
1432671cbe
Author | SHA1 | Date |
---|---|---|
Inex Code | 1432671cbe | |
Inex Code | ec76484857 |
|
@ -7,7 +7,7 @@ from flask_swagger import swagger
|
||||||
from flask_swagger_ui import get_swaggerui_blueprint
|
from flask_swagger_ui import get_swaggerui_blueprint
|
||||||
|
|
||||||
from selfprivacy_api.resources.users import User, Users
|
from selfprivacy_api.resources.users import User, Users
|
||||||
from selfprivacy_api.resources.common import DecryptDisk
|
from selfprivacy_api.resources.common import ApiVersion, DecryptDisk
|
||||||
from selfprivacy_api.resources.system import api_system
|
from selfprivacy_api.resources.system import api_system
|
||||||
from selfprivacy_api.resources.services import services as api_services
|
from selfprivacy_api.resources.services import services as api_services
|
||||||
|
|
||||||
|
@ -37,6 +37,7 @@ def create_app():
|
||||||
if auth != "Bearer " + app.config["AUTH_TOKEN"]:
|
if auth != "Bearer " + app.config["AUTH_TOKEN"]:
|
||||||
return jsonify({"error": "Invalid token"}), 401
|
return jsonify({"error": "Invalid token"}), 401
|
||||||
|
|
||||||
|
api.add_resource(ApiVersion, "/api/version")
|
||||||
api.add_resource(Users, "/users")
|
api.add_resource(Users, "/users")
|
||||||
api.add_resource(User, "/users/<string:username>")
|
api.add_resource(User, "/users/<string:username>")
|
||||||
api.add_resource(DecryptDisk, "/decryptDisk")
|
api.add_resource(DecryptDisk, "/decryptDisk")
|
||||||
|
@ -48,7 +49,7 @@ def create_app():
|
||||||
def spec():
|
def spec():
|
||||||
if app.config["ENABLE_SWAGGER"] == "1":
|
if app.config["ENABLE_SWAGGER"] == "1":
|
||||||
swag = swagger(app)
|
swag = swagger(app)
|
||||||
swag["info"]["version"] = "1.0"
|
swag["info"]["version"] = "1.0.0"
|
||||||
swag["info"]["title"] = "SelfPrivacy API"
|
swag["info"]["title"] = "SelfPrivacy API"
|
||||||
swag["info"]["description"] = "SelfPrivacy API"
|
swag["info"]["description"] = "SelfPrivacy API"
|
||||||
swag["securityDefinitions"] = {
|
swag["securityDefinitions"] = {
|
||||||
|
|
|
@ -4,6 +4,29 @@ import subprocess
|
||||||
from flask_restful import Resource, reqparse
|
from flask_restful import Resource, reqparse
|
||||||
|
|
||||||
|
|
||||||
|
class ApiVersion(Resource):
|
||||||
|
"""SelfPrivacy API version"""
|
||||||
|
|
||||||
|
def get(self):
|
||||||
|
"""Get API version
|
||||||
|
---
|
||||||
|
tags:
|
||||||
|
- System
|
||||||
|
responses:
|
||||||
|
200:
|
||||||
|
description: API version
|
||||||
|
schema:
|
||||||
|
type: object
|
||||||
|
properties:
|
||||||
|
version:
|
||||||
|
type: string
|
||||||
|
description: API version
|
||||||
|
401:
|
||||||
|
description: Unauthorized
|
||||||
|
"""
|
||||||
|
return {"version": "1.0.0"}
|
||||||
|
|
||||||
|
|
||||||
class DecryptDisk(Resource):
|
class DecryptDisk(Resource):
|
||||||
"""Decrypt disk"""
|
"""Decrypt disk"""
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue