add frontend
This commit is contained in:
parent
0ab6b70e6f
commit
49789dddc2
3
.gitmodules
vendored
3
.gitmodules
vendored
@ -1,3 +1,6 @@
|
|||||||
[submodule "webpub1c"]
|
[submodule "webpub1c"]
|
||||||
path = webpub1c
|
path = webpub1c
|
||||||
url = https://github.com/b4tman/webpub1c.git
|
url = https://github.com/b4tman/webpub1c.git
|
||||||
|
[submodule "frontend"]
|
||||||
|
path = frontend
|
||||||
|
url = ssh://git@gitea.b4tman.ru:4222/b4tman/pub1c-web.frontend.git
|
||||||
|
1
frontend
Submodule
1
frontend
Submodule
@ -0,0 +1 @@
|
|||||||
|
Subproject commit daadee919029f7dea5d7061b9b73280948ddddbe
|
@ -4,7 +4,7 @@ from typing import List, Optional, Dict
|
|||||||
import traceback
|
import traceback
|
||||||
|
|
||||||
import yaml
|
import yaml
|
||||||
from flask import Flask, g
|
from flask import Flask, g, render_template
|
||||||
from flask_restful import Resource, Api, reqparse, abort
|
from flask_restful import Resource, Api, reqparse, abort
|
||||||
from flask_cors import CORS
|
from flask_cors import CORS
|
||||||
from pathvalidate import is_valid_filepath
|
from pathvalidate import is_valid_filepath
|
||||||
@ -339,7 +339,8 @@ class APIIndex(Resource):
|
|||||||
'module', 'config', 'config-test', 'apache-restart']
|
'module', 'config', 'config-test', 'apache-restart']
|
||||||
|
|
||||||
|
|
||||||
app = Flask(__name__)
|
frontend_dir = 'frontend/dist'
|
||||||
|
app = Flask(__name__, static_url_path='/', static_folder=frontend_dir, template_folder=frontend_dir)
|
||||||
api = Api(app, '/api/v1/')
|
api = Api(app, '/api/v1/')
|
||||||
cors = CORS(app, resources={r"/api/*": {"origins": "*"}})
|
cors = CORS(app, resources={r"/api/*": {"origins": "*"}})
|
||||||
|
|
||||||
@ -354,9 +355,16 @@ api.add_resource(ConfigTest, '/config-test')
|
|||||||
api.add_resource(ApacheRestartFlag, '/apache-restart')
|
api.add_resource(ApacheRestartFlag, '/apache-restart')
|
||||||
api.add_resource(APIIndex, '/')
|
api.add_resource(APIIndex, '/')
|
||||||
|
|
||||||
|
|
||||||
|
@app.route('/')
|
||||||
|
def index():
|
||||||
|
return index_content
|
||||||
|
|
||||||
|
|
||||||
with app.app_context():
|
with app.app_context():
|
||||||
get_config()
|
get_config()
|
||||||
get_webpub1c()
|
get_webpub1c()
|
||||||
|
index_content = render_template("index.html")
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
Loading…
Reference in New Issue
Block a user