Fixed receipt file previews not loading
@ -241,7 +241,7 @@ def uploadFile(receipt_id):
|
||||
file_type, _ = mimetypes.guess_type(file.filename)
|
||||
preview_image = ""
|
||||
if file_type == "application/pdf":
|
||||
output_path = "static/files/receipts/previews/"
|
||||
output_path = f"{current_app.config['FILES_FOLDER']}/receipts/previews/"
|
||||
preview_image = receipts_processes.create_pdf_preview(file_path, output_path)
|
||||
|
||||
file_size = os.path.getsize(file_path)
|
||||
@ -259,6 +259,13 @@ def getFile(file_name):
|
||||
print(path_)
|
||||
return send_from_directory(path_, file_name)
|
||||
|
||||
@receipt_api.route('/api/getPreview/<file_name>')
|
||||
@access_api.login_required
|
||||
def getPreview(file_name):
|
||||
path_ = current_app.config['FILES_FOLDER'] + "/receipts/previews"
|
||||
print(path_)
|
||||
return send_from_directory(path_, file_name)
|
||||
|
||||
@receipt_api.route('/api/checkAPI', methods=["POST"])
|
||||
@access_api.login_required
|
||||
def checkAPI():
|
||||
|
||||
@ -217,9 +217,11 @@ async function replenishFilesCards(files) {
|
||||
|
||||
console.log(files[key])
|
||||
|
||||
let baseStaticUrl = '/static/files/receipts/previews/';
|
||||
let baseStaticUrl = `/receipts/api/getPreview/`;
|
||||
let imgSrc = `${baseStaticUrl}${files[key].preview_image}`;
|
||||
|
||||
console.log(imgSrc)
|
||||
|
||||
let media_div = document.createElement('div')
|
||||
media_div.setAttribute('class', 'uk-card-media-top')
|
||||
media_div.innerHTML = `<img data-src="${imgSrc}" width="600" height="400" alt="" uk-img />`;
|
||||
|
||||
|
Before Width: | Height: | Size: 89 KiB After Width: | Height: | Size: 89 KiB |
|
Before Width: | Height: | Size: 106 KiB |
|
Before Width: | Height: | Size: 3.8 MiB |
|
Before Width: | Height: | Size: 1.3 MiB |
|
Before Width: | Height: | Size: 2.3 MiB |
|
Before Width: | Height: | Size: 3.1 MiB |
|
Before Width: | Height: | Size: 8.5 KiB |
|
Before Width: | Height: | Size: 11 KiB |
|
Before Width: | Height: | Size: 9.2 KiB |
|
Before Width: | Height: | Size: 8.6 KiB |
|
Before Width: | Height: | Size: 9.8 KiB |
|
Before Width: | Height: | Size: 8.9 KiB |
|
Before Width: | Height: | Size: 8.5 KiB |
|
Before Width: | Height: | Size: 8.7 KiB |
|
Before Width: | Height: | Size: 7.5 KiB |
|
Before Width: | Height: | Size: 1.3 MiB |
|
Before Width: | Height: | Size: 874 KiB |
|
Before Width: | Height: | Size: 1.3 MiB |
|
Before Width: | Height: | Size: 137 KiB |
|
Before Width: | Height: | Size: 45 KiB |
@ -1,16 +0,0 @@
|
||||
version: '3.4'
|
||||
services:
|
||||
speedtest-tracker:
|
||||
container_name: speedtest-tracker
|
||||
ports:
|
||||
- 8080:80
|
||||
- 8443:443
|
||||
environment:
|
||||
- PUID=1000
|
||||
- PGID=1000
|
||||
- DB_CONNECTION=sqlite
|
||||
volumes:
|
||||
- ./data:/config
|
||||
- ./keys:/config/keys
|
||||
image: lscr.io/linuxserver/speedtest-tracker:latest
|
||||
restart: unless-stopped
|
||||
|
Before Width: | Height: | Size: 1.5 MiB |
|
Before Width: | Height: | Size: 3.9 MiB |
@ -20,7 +20,6 @@ oauth.init_app(app)
|
||||
swagger = Swagger(app)
|
||||
app.config.from_pyfile('application.cfg.py')
|
||||
|
||||
print(app.config['UPLOAD_FOLDER'])
|
||||
oauth.register(
|
||||
name=app.config['OAUTH_NAME'],
|
||||
client_id=app.config['OAUTH_CLIENT_ID'],
|
||||
|
||||