1
0
mirror of https://github.com/LibreTranslate/LibreTranslate.git synced 2024-12-18 08:27:03 +02:00

fix app.js with url_prefix

This commit is contained in:
reynoldsnlp 2022-12-31 15:15:51 -07:00
parent c5cc233aaf
commit 14b4f28a1a
3 changed files with 6 additions and 3 deletions
libretranslate
app.py
static/js
templates

View File

@ -283,7 +283,8 @@ def create_app(args):
get_api_key_link=args.get_api_key_link,
web_version=os.environ.get("LT_WEB") is not None,
version=get_version(),
swagger_url=SWAGGER_URL
swagger_url=SWAGGER_URL,
url_prefix=args.url_prefix
)
@bp.get("/javascript-licenses")

View File

@ -1,7 +1,6 @@
// @license magnet:?xt=urn:btih:0b31508aeb0634b347b8270c7bee4d411b5d4109&dn=agpl-3.0.txt AGPL-3.0
// API host/endpoint
//var BaseUrl = window.location.protocol + "//" + window.location.host + window.location.pathname.length > 1 ? window.location.pathname : "" ;
var BaseUrl = window.location.href.slice(0, -1)
var BaseUrl = window.location.protocol + "//" + window.location.host + url_prefix ;
var htmlRegex = /<(.*)>.*?|<(.*)\/>/;
document.addEventListener('DOMContentLoaded', function(){
var sidenavElems = document.querySelectorAll('.sidenav');

View File

@ -7,6 +7,9 @@
<link rel="shortcut icon" href="{{ url_for('static', filename='favicon.ico') }}">
<meta name="description" content="Free and Open Source Machine Translation API. 100% self-hosted, offline capable and easy to setup. Run your own API server in just a few minutes.">
<meta name="keywords" content="translation,api">
<script type="text/javascript">
var url_prefix = "{{ url_prefix }}"
</script>
<link rel="preload" href="{{ url_for('static', filename='icon.svg') }}" as="image" />
<link rel="preload" href="{{ url_for('static', filename='js/vue@2.js') }}" as="script">