From d5b885aab4a7ac5e4e1a7a7a4a5e8e9931864985 Mon Sep 17 00:00:00 2001 From: John Smith Date: Thu, 6 Feb 2020 19:51:03 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=89=8D=E7=AB=AF=E8=8E=B7?= =?UTF-8?q?=E5=8F=96=E5=90=8E=E7=AB=AF=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/main.py | 17 ++++++++++++++++- frontend/src/views/Home.vue | 16 +++++++++++++++- main.py | 1 + 3 files changed, 32 insertions(+), 2 deletions(-) diff --git a/api/main.py b/api/main.py index e34b0c9..1846619 100644 --- a/api/main.py +++ b/api/main.py @@ -2,9 +2,24 @@ import tornado.web +import api.base +import config +import update + -# noinspection PyAbstractClass class MainHandler(tornado.web.StaticFileHandler): """为了使用Vue Router的history模式,把所有请求转发到index.html""" async def get(self, *args, **kwargs): await super().get('index.html', *args, **kwargs) + + +# noinspection PyAbstractClass +class ServerInfoHandler(api.base.ApiHandler): + async def get(self): + cfg = config.get_config() + self.write({ + 'version': update.VERSION, + 'config': { + 'enableTranslate': cfg.enable_translate + } + }) diff --git a/frontend/src/views/Home.vue b/frontend/src/views/Home.vue index 617c057..238ad54 100644 --- a/frontend/src/views/Home.vue +++ b/frontend/src/views/Home.vue @@ -53,7 +53,7 @@ - + @@ -73,6 +73,7 @@