mirror of
https://github.com/TandoorRecipes/recipes.git
synced 2025-12-24 02:39:20 -05:00
changed paths to have vue3 as standard
This commit is contained in:
@@ -17,6 +17,8 @@
|
||||
<meta name="robots" content="noindex,nofollow"/>
|
||||
<meta name="apple-mobile-web-app-capable" content="yes"/>
|
||||
|
||||
<link rel="manifest" crossorigin="use-credentials" href="{% url 'web_manifest' %}">
|
||||
|
||||
<link rel="icon" href="{{ theme_values.logo_color_svg }}">
|
||||
<link rel="icon" href="{{ theme_values.logo_color_32 }}" sizes="32x32">
|
||||
<link rel="icon" href="{{ theme_values.logo_color_128 }}" sizes="128x128">
|
||||
@@ -40,6 +42,17 @@
|
||||
|
||||
<script type="application/javascript">
|
||||
localStorage.setItem('BASE_PATH', "{% base_path request 'base' %}")
|
||||
|
||||
window.addEventListener("load", () => {
|
||||
if ("serviceWorker" in navigator) {
|
||||
navigator.serviceWorker.register("{% url 'service_worker' %}", {scope: "{% base_path request 'base' %}" + '/'}).then(function (reg) {
|
||||
}).catch(function (err) {
|
||||
console.warn('Error whilst registering service worker', err);
|
||||
});
|
||||
} else {
|
||||
console.warn('service worker not in navigator');
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
</body>
|
||||
|
||||
@@ -75,9 +75,7 @@ for p in PLUGINS:
|
||||
pass
|
||||
|
||||
urlpatterns = [
|
||||
path('', views.index, name='index'),
|
||||
re_path(r'^v3/.*', views.vue3, name='vue3'),
|
||||
#path('v3/', views.vue3, name='vue3'),
|
||||
|
||||
path('setup/', views.setup, name='view_setup'),
|
||||
path('no-group', views.no_groups, name='view_no_group'),
|
||||
path('space-overview', views.space_overview, name='view_space_overview'),
|
||||
@@ -86,26 +84,15 @@ urlpatterns = [
|
||||
path('no-perm', views.no_perm, name='view_no_perm'),
|
||||
path('invite/<slug:token>', views.invite_link, name='view_invite'),
|
||||
path('system/', views.system, name='view_system'),
|
||||
path('search/', views.search, name='view_search'),
|
||||
path('books/', views.books, name='view_books'),
|
||||
path('plan/', views.meal_plan, name='view_plan'),
|
||||
path('shopping/', lists.shopping_list, name='view_shopping'),
|
||||
path('settings/', views.user_settings, name='view_settings'),
|
||||
|
||||
path('settings-shopping/', views.shopping_settings, name='view_shopping_settings'), # TODO rename to search settings
|
||||
path('history/', views.history, name='view_history'),
|
||||
path('ingredient-editor/', views.ingredient_editor, name='view_ingredient_editor'),
|
||||
path('property-editor/<int:pk>', views.property_editor, name='view_property_editor'),
|
||||
|
||||
path('abuse/<slug:token>', views.report_share_abuse, name='view_report_share_abuse'),
|
||||
path('api/import/', api.import_files, name='view_import'),
|
||||
path('import-response/<int:pk>/', import_export.import_response, name='view_import_response'),
|
||||
path('export/', import_export.export_recipe, name='view_export'),
|
||||
path('export-response/<int:pk>/', import_export.export_response, name='view_export_response'),
|
||||
path('export-file/<int:pk>/', import_export.export_file, name='view_export_file'),
|
||||
path('view/recipe/<int:pk>', views.recipe_view, name='view_recipe'),
|
||||
path('view/recipe/<int:pk>/<slug:share>', views.recipe_view, name='view_recipe'),
|
||||
path('new/recipe-import/<int:import_id>/', new.create_new_external_recipe, name='new_recipe_import'),
|
||||
path('new/share-link/<int:pk>/', new.share_link, name='new_share_link'),
|
||||
path('edit/recipe/<int:pk>/', edit.switch_recipe, name='edit_recipe'),
|
||||
|
||||
# for internal use only
|
||||
path('edit/recipe/internal/<int:pk>/', edit.internal_recipe_update, name='edit_internal_recipe'),
|
||||
@@ -145,6 +132,10 @@ urlpatterns = [
|
||||
path('offline/', views.offline, name='view_offline'),
|
||||
path('service-worker.js', (TemplateView.as_view(template_name="sw.js", content_type='application/javascript')), name='service_worker'),
|
||||
path('manifest.json', views.web_manifest, name='web_manifest'),
|
||||
|
||||
|
||||
path('', views.index, name='index'),
|
||||
path('<path:resource>', views.index, name='index'),
|
||||
]
|
||||
|
||||
generic_models = (Recipe, RecipeImport, Storage, ConnectorConfig, RecipeBook, SyncLog, Sync, Comment, RecipeBookEntry, InviteLink, UserSpace, Space)
|
||||
|
||||
@@ -39,7 +39,13 @@ def index(request):
|
||||
if User.objects.count() < 1 and 'django.contrib.auth.backends.RemoteUserBackend' not in settings.AUTHENTICATION_BACKENDS:
|
||||
return HttpResponseRedirect(reverse_lazy('view_setup'))
|
||||
|
||||
return HttpResponseRedirect(reverse('vue3'))
|
||||
if has_group_permission(request.user, ('guest', )):
|
||||
return render(request, 'frontend/tandoor.html', {})
|
||||
else:
|
||||
if request.user.is_authenticated:
|
||||
return HttpResponseRedirect(reverse('view_no_group'))
|
||||
else:
|
||||
return HttpResponseRedirect(reverse('account_login') + '?next=' + request.path)
|
||||
|
||||
|
||||
def search(request):
|
||||
@@ -523,20 +529,15 @@ def web_manifest(request):
|
||||
"name": _("Plan"),
|
||||
"short_name": _("Plan"),
|
||||
"description": _("View your meal Plan"),
|
||||
"url": "./plan"
|
||||
}, {
|
||||
"name": _("Books"),
|
||||
"short_name": _("Books"),
|
||||
"description": _("View your cookbooks"),
|
||||
"url": "./books"
|
||||
"url": "./mealplan"
|
||||
}, {
|
||||
"name": _("Shopping"),
|
||||
"short_name": _("Shopping"),
|
||||
"description": _("View your shopping lists"),
|
||||
"url": "./shopping/"
|
||||
"url": "./shopping"
|
||||
}],
|
||||
"share_target": {
|
||||
"action": "/data/import/url",
|
||||
"action": "/recipe/import",
|
||||
"method": "GET",
|
||||
"params": {
|
||||
"title": "title",
|
||||
@@ -590,7 +591,7 @@ def test2(request):
|
||||
|
||||
|
||||
@group_required('guest')
|
||||
def vue3(request):
|
||||
def tandoor_frontend(request):
|
||||
return render(request, 'frontend/tandoor.html', {})
|
||||
|
||||
|
||||
|
||||
@@ -48,10 +48,8 @@ STATIC_ROOT = os.path.join(BASE_DIR, "staticfiles")
|
||||
# Get vars from .env files
|
||||
SECRET_KEY = os.getenv('SECRET_KEY', 'INSECURE_STANDARD_KEY_SET_IN_ENV')
|
||||
|
||||
DEBUG = extract_bool('DEBUG', True)
|
||||
DEBUG_TOOLBAR = extract_bool('DEBUG_TOOLBAR', True)
|
||||
|
||||
V3_BETA = extract_bool('V3_BETA', False)
|
||||
DEBUG = extract_bool('DEBUG', False)
|
||||
DEBUG_TOOLBAR = extract_bool('DEBUG_TOOLBAR', False)
|
||||
|
||||
LOG_LEVEL = os.getenv("LOG_LEVEL", "WARNING")
|
||||
|
||||
|
||||
@@ -24,7 +24,6 @@ from django.views.static import serve
|
||||
from django_js_reverse import views as reverse_views
|
||||
|
||||
urlpatterns = [
|
||||
path('', include('cookbook.urls')),
|
||||
path('admin/', admin.site.urls),
|
||||
path('accounts/', include('allauth.urls')),
|
||||
path('i18n/', include('django.conf.urls.i18n')),
|
||||
@@ -56,3 +55,8 @@ for p in settings.PLUGINS:
|
||||
if settings.DEBUG:
|
||||
print(f'ERROR failed loading urls for plugin <{p["name"]}>')
|
||||
traceback.format_exc()
|
||||
|
||||
# include cookbook urls last because it has a catchall view to the tandoor frontend
|
||||
urlpatterns.append(
|
||||
path('', include('cookbook.urls')),
|
||||
)
|
||||
|
||||
@@ -61,8 +61,7 @@ const routes = [
|
||||
]
|
||||
|
||||
const router = createRouter({
|
||||
// TODO configure proper history mode
|
||||
history: createWebHistory('v3/'),
|
||||
history: createWebHistory(),
|
||||
routes,
|
||||
})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user