This commit is contained in:
xaoyaoo committed 2024-02-26 00:48:47 +08:00
1 parent 1184676742
commit 1f7164fe85
2 files changed
+24 -3

No files matched your search

+3 -3
View File
@@ -60,12 +60,12 @@ jobs:
run: |
cd ..
cd wxdump_web
cp src/App.vue src/t.vue
cp src/Appexport.vue src/App.vue
cp src/main.ts src/t.ts
cp src/main.ts.export src/main.ts
npm install
npm run build
- name: copy Export UI to pywxdump/ui/web
- name: copy Export UI and Export UI to pywxdump/ui/web and pywxdump/ui/export
run: |
cd ..
ls -l wxdump_web/dist
+21
View File
@@ -5,8 +5,10 @@
# Author: xaoyaoo
# Date: 2024/01/16
# -------------------------------------------------------------------------------
import base64
import json
import logging
import os
import traceback
from .rjson import ReJson
from functools import wraps
@@ -41,3 +43,22 @@ def error9999(func):
return ReJson(9999, body=rdata)
return wrapper
def gen_base64(path):
# 获取文件名后缀
extension = os.path.splitext(path)[1]
if extension == '.js':
start_str = 'data:text/javascript;base64,'
elif extension == '.css':
start_str = 'data:text/css;base64,'
elif extension == '.html':
start_str = 'data:text/html;base64,'
elif extension == '.json':
start_str = 'data:application/json;base64,'
else:
start_str = 'data:text/plain;base64,'
with open(path, 'rb') as file:
js_code = file.read()
base64_encoded_js = base64.b64encode(js_code).decode('utf-8')
return start_str + base64_encoded_js