mirror of
https://github.com/TandoorRecipes/recipes.git
synced 2026-01-01 04:10:06 -05:00
possibly fixed sub path hosting issues
This commit is contained in:
@@ -38,6 +38,8 @@ class ExtendedRecipeMixin(serializers.ModelSerializer):
|
||||
return fields
|
||||
except AttributeError:
|
||||
pass
|
||||
except KeyError:
|
||||
pass
|
||||
del fields['image']
|
||||
del fields['numrecipe']
|
||||
return fields
|
||||
|
||||
@@ -344,6 +344,7 @@
|
||||
<script type="application/javascript">
|
||||
localStorage.setItem('SCRIPT_NAME', "{% base_path request 'script' %}")
|
||||
localStorage.setItem('BASE_PATH', "{% base_path request 'base' %}")
|
||||
localStorage.setItem('STATIC_URL', "{% base_path request 'static_base' %}")
|
||||
window.addEventListener("load", () => {
|
||||
if ("serviceWorker" in navigator) {
|
||||
navigator.serviceWorker.register("{% url 'service_worker' %}", {scope: "{% base_path request 'base' %}" + '/'}).then(function (reg) {
|
||||
|
||||
@@ -142,7 +142,7 @@ def bookmarklet(request):
|
||||
localStorage.setItem('redirectURL', '" + server + reverse('data_import_url') + "'); \
|
||||
localStorage.setItem('token', '" + api_token.__str__() + "'); \
|
||||
document.body.appendChild(document.createElement(\'script\')).src=\'" \
|
||||
+ server + prefix + static('js/bookmarklet.js') + "? \
|
||||
+ server + prefix + static('js/bookmarklet.js') + "? \
|
||||
r=\'+Math.floor(Math.random()*999999999);}})();"
|
||||
return re.sub(r"[\n\t\s]*", "", bookmark)
|
||||
|
||||
@@ -153,3 +153,5 @@ def base_path(request, path_type):
|
||||
return request._current_scheme_host + request.META.get('HTTP_X_SCRIPT_NAME', '')
|
||||
elif path_type == 'script':
|
||||
return request.META.get('HTTP_X_SCRIPT_NAME', '')
|
||||
elif path_type == 'static_base':
|
||||
return static('vue/manifest.json').replace('vue/manifest.json', '')
|
||||
|
||||
Reference in New Issue
Block a user