2019-06-12 13:55:49 +08:00
|
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
|
|
|
|
|
|
import tornado.web
|
|
|
|
|
|
2020-02-06 19:51:03 +08:00
|
|
|
|
import api.base
|
|
|
|
|
import config
|
|
|
|
|
import update
|
|
|
|
|
|
2019-06-12 13:55:49 +08:00
|
|
|
|
|
|
|
|
|
class MainHandler(tornado.web.StaticFileHandler):
|
|
|
|
|
"""为了使用Vue Router的history模式,把所有请求转发到index.html"""
|
|
|
|
|
async def get(self, *args, **kwargs):
|
|
|
|
|
await super().get('index.html', *args, **kwargs)
|
2020-02-06 19:51:03 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# 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
|
|
|
|
|
}
|
|
|
|
|
})
|