|
@@ -116,6 +116,7 @@ class test_path(Load):
|
|
|
|
|
|
|
|
|
# 请求转换 /main/convert 接口必须后端获取,token不允许暴露
|
|
|
+#http://192.168.33.10:8088/main/convert?signature=44e3cd684a9fe697792a235c8c57838211f5823a&key=mo1209&nonce=1529659172&file=http%3A%2F%2F192.168.33.10%2Fsystem%2Fdata%2Fupload%2Fdoc_con%2F5b2cbf1064fd8.doc&uid=1
|
|
|
class convert_path(Load):
|
|
|
@Web.setting
|
|
|
def get(self):
|
|
@@ -227,6 +228,7 @@ class view_path(Load):
|
|
|
file = self.input('file')
|
|
|
uid = self.input('uid')
|
|
|
page = self.input('page')
|
|
|
+ path = self.input('path')
|
|
|
|
|
|
self.data = {}
|
|
|
Common.signature(self)
|
|
@@ -238,7 +240,7 @@ class view_path(Load):
|
|
|
self.out('未生成文件信息')
|
|
|
|
|
|
if page:
|
|
|
- page = Demeter.path + 'runtime' + page
|
|
|
+ page = Demeter.path + 'runtime' + path + page
|
|
|
content = File.readContent(page)
|
|
|
else:
|
|
|
user = service.getAuth(self.data['site']['id'], uid, file['id'])
|
|
@@ -249,23 +251,22 @@ class view_path(Load):
|
|
|
limit = self.data['site']['page']
|
|
|
|
|
|
path = file['path']
|
|
|
- file = file['html']
|
|
|
- view = file['html'] + '_p' + limit + '.html'
|
|
|
+ view = file['html'] + '_p' + str(limit) + '.html'
|
|
|
if File.exists(view):
|
|
|
content = File.readContent(view)
|
|
|
File.write(view, content)
|
|
|
else:
|
|
|
url = self.request.protocol + "://" + self.request.host
|
|
|
static = url + '/static/'
|
|
|
- content = File.readContent(file)
|
|
|
+ content = File.readContent(file['html'])
|
|
|
content = content.replace('src="', 'src="' + static)
|
|
|
|
|
|
if limit > 0:
|
|
|
pattern = '<div id="pf([0-9][a-zA-Z]+|[a-zA-Z0]+|['+str(limit+1)+'-9]|([1-9][0-9]+))"(.*?)<\/div>'
|
|
|
content = re.sub(pattern, '', content)
|
|
|
|
|
|
- page = path.replace(Demeter.path + 'runtime', '')
|
|
|
- url = url + 'main/view?page=' + str(page) + '&file=' + file + '&nonce=' + nonce + '&key=' + key + '&signature=' + signature + '&uid=' + uid
|
|
|
+ path = path.replace(Demeter.path + 'runtime', '')
|
|
|
+ url = url + '/main/view?path=' + str(path) + '&file=' + file['key'] + '&nonce=' + nonce + '&key=' + key + '&signature=' + signature + '&uid=' + uid + '&page='
|
|
|
content = content.replace('data-page-url="', 'data-page-url="' + url)
|
|
|
|
|
|
self.write(content)
|