diff options
author | LASER-Yi <[email protected]> | 2022-06-18 17:25:17 +0800 |
---|---|---|
committer | LASER-Yi <[email protected]> | 2022-06-18 17:25:17 +0800 |
commit | 4b71b8ae65ac7709b902f6e9efd64dd2be4e5082 (patch) | |
tree | d5fa7fffc78804a92afd9bb5850e713a4f5c4ced | |
parent | e1d6f2d152b13e0ac825bff3eda688405fe54734 (diff) | |
download | bazarr-4b71b8ae65ac7709b902f6e9efd64dd2be4e5082.tar.gz bazarr-4b71b8ae65ac7709b902f6e9efd64dd2be4e5082.zip |
Fix missing images issue when serving via Flask
-rw-r--r-- | bazarr/app/ui.py | 26 | ||||
-rw-r--r-- | frontend/index.html | 2 | ||||
-rw-r--r-- | frontend/public/favicon.ico (renamed from frontend/public/static/favicon.ico) | bin | 15086 -> 15086 bytes | |||
-rw-r--r-- | frontend/public/images/android-chrome-96x96.png (renamed from frontend/public/static/android-chrome-96x96.png) | bin | 2615 -> 2615 bytes | |||
-rw-r--r-- | frontend/public/images/apple-touch-icon.png (renamed from frontend/public/static/apple-touch-icon.png) | bin | 4693 -> 4693 bytes | |||
-rw-r--r-- | frontend/public/images/favicon-16x16.png (renamed from frontend/public/static/favicon-16x16.png) | bin | 1148 -> 1148 bytes | |||
-rw-r--r-- | frontend/public/images/favicon-32x32.png (renamed from frontend/public/static/favicon-32x32.png) | bin | 2192 -> 2192 bytes | |||
-rw-r--r-- | frontend/public/images/logo128.png (renamed from frontend/public/static/logo128.png) | bin | 4804 -> 4804 bytes | |||
-rw-r--r-- | frontend/public/images/logo64.png (renamed from frontend/public/static/logo64.png) | bin | 2350 -> 2350 bytes | |||
-rw-r--r-- | frontend/public/images/mstile-150x150.png (renamed from frontend/public/static/mstile-150x150.png) | bin | 3861 -> 3861 bytes | |||
-rw-r--r-- | frontend/public/images/react.svg (renamed from frontend/public/static/react.svg) | 0 | ||||
-rw-r--r-- | frontend/public/images/safari-pinned-tab.svg (renamed from frontend/public/static/safari-pinned-tab.svg) | 0 | ||||
-rw-r--r-- | frontend/src/App/Header.tsx | 2 | ||||
-rw-r--r-- | frontend/src/pages/Authentication.tsx | 2 |
14 files changed, 11 insertions, 21 deletions
diff --git a/bazarr/app/ui.py b/bazarr/app/ui.py index cfa2e3bad..9d482eb39 100644 --- a/bazarr/app/ui.py +++ b/bazarr/app/ui.py @@ -22,8 +22,14 @@ ui_bp = Blueprint('ui', __name__, template_folder=os.path.join(os.path.dirname(os.path.dirname(os.path.dirname(__file__))), 'frontend', 'build'), static_folder=os.path.join(os.path.dirname(os.path.dirname(os.path.dirname(__file__))), 'frontend', - 'build', 'static'), - static_url_path=base_url.rstrip('/') + '/static') + 'build', 'assets'), + static_url_path='/assets') + +static_bp = Blueprint('images', __name__, + static_folder=os.path.join(os.path.dirname(os.path.dirname(os.path.dirname(__file__))), 'frontend', + 'build', 'images'), static_url_path='/images') + +ui_bp.register_blueprint(static_bp) def check_login(actual_method): @@ -75,22 +81,6 @@ def catch_all(path): return render_template("index.html", BAZARR_SERVER_INJECT=inject, baseUrl=template_url) -@ui_bp.route('/assets/<path:filename>') -def web_assets(filename): - # forcing mimetypes to prevent bad configuration in Windows registry to prevent Bazarr UI from showing - mimetypes.add_type('application/javascript', '.js') - mimetypes.add_type('text/css', '.css') - mimetypes.add_type('font/woff2', '.woff2') - mimetypes.add_type('image/svg+xml', '.svg') - mimetypes.add_type('image/png', '.png') - mimetypes.add_type('image/x-icon', '.ico') - - # send_from_directory needs an absolute path then we'll use realpath() here - path = os.path.realpath(os.path.join(os.path.dirname(os.path.dirname(os.path.dirname(__file__))), 'frontend', - 'build', 'assets')) - return send_from_directory(path, filename) - - @check_login @ui_bp.route('/bazarr.log') def download_log(): diff --git a/frontend/index.html b/frontend/index.html index a416f01cd..c526d0f4a 100644 --- a/frontend/index.html +++ b/frontend/index.html @@ -4,7 +4,7 @@ <title>Bazarr</title> <base href="{{baseUrl}}" /> <meta charset="utf-8" /> - <link rel="icon" type="image/x-icon" href="./static/favicon.ico" /> + <link rel="icon" type="image/x-icon" href="./favicon.ico" /> <meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1, maximum-scale=1" diff --git a/frontend/public/static/favicon.ico b/frontend/public/favicon.ico Binary files differindex 02c0a6412..02c0a6412 100644 --- a/frontend/public/static/favicon.ico +++ b/frontend/public/favicon.ico diff --git a/frontend/public/static/android-chrome-96x96.png b/frontend/public/images/android-chrome-96x96.png Binary files differindex a9227b96a..a9227b96a 100644 --- a/frontend/public/static/android-chrome-96x96.png +++ b/frontend/public/images/android-chrome-96x96.png diff --git a/frontend/public/static/apple-touch-icon.png b/frontend/public/images/apple-touch-icon.png Binary files differindex c9cc483a1..c9cc483a1 100644 --- a/frontend/public/static/apple-touch-icon.png +++ b/frontend/public/images/apple-touch-icon.png diff --git a/frontend/public/static/favicon-16x16.png b/frontend/public/images/favicon-16x16.png Binary files differindex 03618a704..03618a704 100644 --- a/frontend/public/static/favicon-16x16.png +++ b/frontend/public/images/favicon-16x16.png diff --git a/frontend/public/static/favicon-32x32.png b/frontend/public/images/favicon-32x32.png Binary files differindex 85dbb8462..85dbb8462 100644 --- a/frontend/public/static/favicon-32x32.png +++ b/frontend/public/images/favicon-32x32.png diff --git a/frontend/public/static/logo128.png b/frontend/public/images/logo128.png Binary files differindex 467bde320..467bde320 100644 --- a/frontend/public/static/logo128.png +++ b/frontend/public/images/logo128.png diff --git a/frontend/public/static/logo64.png b/frontend/public/images/logo64.png Binary files differindex 891190143..891190143 100644 --- a/frontend/public/static/logo64.png +++ b/frontend/public/images/logo64.png diff --git a/frontend/public/static/mstile-150x150.png b/frontend/public/images/mstile-150x150.png Binary files differindex 362cfe6c5..362cfe6c5 100644 --- a/frontend/public/static/mstile-150x150.png +++ b/frontend/public/images/mstile-150x150.png diff --git a/frontend/public/static/react.svg b/frontend/public/images/react.svg index 6b60c1042..6b60c1042 100644 --- a/frontend/public/static/react.svg +++ b/frontend/public/images/react.svg diff --git a/frontend/public/static/safari-pinned-tab.svg b/frontend/public/images/safari-pinned-tab.svg index 24fecc60f..24fecc60f 100644 --- a/frontend/public/static/safari-pinned-tab.svg +++ b/frontend/public/images/safari-pinned-tab.svg diff --git a/frontend/src/App/Header.tsx b/frontend/src/App/Header.tsx index e0111a26a..a821a3bba 100644 --- a/frontend/src/App/Header.tsx +++ b/frontend/src/App/Header.tsx @@ -61,7 +61,7 @@ const AppHeader: FunctionComponent = () => { <Avatar alt="brand" size={32} - src={`${Environment.baseUrl}/static/logo64.png`} + src={`${Environment.baseUrl}/images/logo64.png`} ></Avatar> </Anchor> </MediaQuery> diff --git a/frontend/src/pages/Authentication.tsx b/frontend/src/pages/Authentication.tsx index efdd1f3ec..b527c14dd 100644 --- a/frontend/src/pages/Authentication.tsx +++ b/frontend/src/pages/Authentication.tsx @@ -30,7 +30,7 @@ const Authentication: FunctionComponent = () => { <Avatar mx="auto" size={64} - src={`${Environment.baseUrl}/static/logo128.png`} + src={`${Environment.baseUrl}/images/logo128.png`} ></Avatar> <Divider></Divider> <form onSubmit={form.onSubmit(login)}> |