diff --git a/src/client.py b/src/client.py index bbaf039..8b06e61 100644 --- a/src/client.py +++ b/src/client.py @@ -1,9 +1,27 @@ -from flask import Blueprint, render_template, abort +from flask import Blueprint, render_template, abort, request, Flask, current_app import os - client = Blueprint('client', __name__, template_folder=os.path.abspath("./static/client/dist")) +def ResponseObject(status=True, message=None, data=None, status_code = 200) -> Flask.response_class: + response = Flask.make_response(current_app, { + "status": status, + "message": message, + "data": data + }) + response.status_code = status_code + response.content_type = "application/json" + return response -@client.get(f'/client') + +prefix = '/client' + + +@client.before_request +def clientBeforeRequest(): + if request.method.lower() == 'options': + return ResponseObject(True) + +@client.get(prefix) def clientIndex(): return render_template('client.html') + diff --git a/src/static/client/index.html b/src/static/client/index.html index bc95402..588654c 100644 --- a/src/static/client/index.html +++ b/src/static/client/index.html @@ -1,13 +1,13 @@ - - - - - Vite App - - -
- - + + + + + Vite App + + +
+ + diff --git a/src/static/client/proxy.js b/src/static/client/proxy.js new file mode 100644 index 0000000..c65fc32 --- /dev/null +++ b/src/static/client/proxy.js @@ -0,0 +1 @@ +export const proxy = "http://wg.local:10086/" \ No newline at end of file diff --git a/src/static/client/src/App.vue b/src/static/client/src/App.vue index 9633cd9..ae79e28 100644 --- a/src/static/client/src/App.vue +++ b/src/static/client/src/App.vue @@ -1,9 +1,11 @@ \ No newline at end of file diff --git a/src/static/client/src/views/signup.vue b/src/static/client/src/views/signup.vue new file mode 100644 index 0000000..7be2555 --- /dev/null +++ b/src/static/client/src/views/signup.vue @@ -0,0 +1,21 @@ + + + + + \ No newline at end of file diff --git a/src/static/client/vite.config.js b/src/static/client/vite.config.js index 79d08ce..604eda8 100644 --- a/src/static/client/vite.config.js +++ b/src/static/client/vite.config.js @@ -3,17 +3,32 @@ import { fileURLToPath, URL } from 'node:url' import { defineConfig } from 'vite' import vue from '@vitejs/plugin-vue' import vueDevTools from 'vite-plugin-vue-devtools' +import {proxy} from "./proxy.js"; + -// https://vite.dev/config/ export default defineConfig({ plugins: [ vue(), vueDevTools(), + { + name: 'rename', + enforce: 'post', + generateBundle(options, bundle) { + bundle['index.html'].fileName = "client.html" + } + } ], resolve: { alias: { '@': fileURLToPath(new URL('./src', import.meta.url)) }, }, + server:{ + proxy: { + '/api': proxy, + '/fileDownload':proxy + }, + host: '0.0.0.0' + }, base: '/static/client/dist' })