bugfix
This commit is contained in:
parent
4dca779f40
commit
780ab5fe36
@ -10,6 +10,8 @@ import time
|
||||
import base64
|
||||
from urllib.parse import quote
|
||||
from appPublic.worker import get_event_loop
|
||||
from appPublic.uniqueID import getID
|
||||
from appPublic.qr import gen_qr, gen_qr_withlogo
|
||||
from appPublic.folderUtils import _mkdir
|
||||
from appPublic.base64_to_file import base64_to_file, getFilenameFromBase64
|
||||
from appPublic.jsonConfig import getConfig
|
||||
@ -255,3 +257,14 @@ async def b64media2url(request, mediafile):
|
||||
return f'{baseurl}/idfile?path={quote(mediafile)}'
|
||||
return f'/downlaod{quote(mediafile)}'
|
||||
|
||||
async def data2qrpath(data, logo=None):
|
||||
fs = FileStorage()
|
||||
qr_name = f'{getID()}.png'
|
||||
path = fs._name2path(qr_name)
|
||||
if logo:
|
||||
gen_qr_withlog(data, path, logo)
|
||||
else:
|
||||
gen_qr(data, path)
|
||||
return fs.webpath(path)
|
||||
|
||||
|
||||
|
||||
@ -84,7 +84,7 @@ from .error import (
|
||||
|
||||
from .filetest import current_fileno
|
||||
from .filedownload import path_download, file_download, file_response
|
||||
from .filestorage import FileStorage, downloadfile2url, get_baseurl, b64media2url
|
||||
from .filestorage import FileStorage, downloadfile2url, get_baseurl, b64media2url, data2qrpath
|
||||
from .serverenv import ServerEnv
|
||||
|
||||
def server_error(errcode):
|
||||
@ -357,6 +357,7 @@ def initEnv():
|
||||
g.openai_429 = openai_429
|
||||
g.timestampAdd = timestampAdd
|
||||
g.timestampSub = timestampSub
|
||||
g.data2qrpath = data2qrpath
|
||||
|
||||
def web_rootpath():
|
||||
config = getConfig()
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user