Squashed commit of the following:

commit e03f626fd08a3e048dbd968d623ee58b7f865929
Author: smilerz <smilerz@gmail.com>
Date:   Mon Apr 19 13:04:39 2021 -0500

    yarn build

commit b511f929ffcc7a670bd7955269982e05c591783a
Author: smilerz <smilerz@gmail.com>
Date:   Sun Apr 18 21:17:31 2021 -0500

    update service worker with base path

commit f13f02d481618583017c71fb654adaa86585ef0b
Author: smilerz <smilerz@gmail.com>
Date:   Sun Apr 18 20:54:17 2021 -0500

    WIP

commit f2f927c16f52baa6b9a31cd9992e8c7c8739d666
Author: smilerz <smilerz@gmail.com>
Date:   Sun Apr 18 20:40:59 2021 -0500

    default value if localStorage fails

commit 424e8a9b93d8aa9962a3b6f963fff5c6e23dfa56
Author: smilerz <smilerz@gmail.com>
Date:   Sun Apr 18 20:30:38 2021 -0500

    fixed missing '/'

commit d49a206ddf5952036b295804f9e31e52a1b45af6
Author: smilerz <smilerz@gmail.com>
Date:   Sun Apr 18 20:13:04 2021 -0500

    updated .env.template

commit ac94ea7afac36f65e1658f3d29f4e2b8f0475ba6
Author: smilerz <smilerz@gmail.com>
Date:   Sun Apr 18 15:31:37 2021 -0500

    WIP

commit c9a687df1b21ac6584d0f958e65c5cfc040406ca
Author: smilerz <smilerz@gmail.com>
Date:   Sun Apr 18 10:19:02 2021 -0500

    WIP

commit 7fe8c7fbe52c96f1ccd4128db256656e43af3fa0
Author: smilerz <smilerz@gmail.com>
Date:   Sun Apr 18 08:10:08 2021 -0500

    added nginx config

commit b5540d85872d9d69bda3787db7ecccfce893236f
Author: smilerz <smilerz@gmail.com>
Date:   Sun Apr 18 08:03:09 2021 -0500

    allow subfolder config on NGINX
This commit is contained in:
smilerz
2021-04-19 13:31:48 -05:00
parent 92c65ec1e8
commit 0d2c1fabe9
15 changed files with 112 additions and 14 deletions

View File

@@ -53,6 +53,8 @@ GUNICORN_MEDIA=0
# when unset: 0 (false)
REVERSE_PROXY_AUTH=0
# If base URL is something other than just / (you are serving a subfolder in your proxy for instance http://recipe_app/recipes/)
# SCRIPT_NAME=/recipes
# allows you to setup OAuth providers
# see docs for more information https://vabene1111.github.io/recipes/features/authentication/

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -226,9 +226,11 @@
{% endblock script %}
<script type="application/javascript">
localStorage.setItem('SCRIPT_NAME', "{% base_path request 'script' %}")
localStorage.setItem('BASE_PATH', "{% base_path request 'base' %}")
window.addEventListener("load", () => {
if ("serviceWorker" in navigator) {
navigator.serviceWorker.register("{% url 'service_worker' %}", {scope: '/'}).then(function (reg) {
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);

File diff suppressed because one or more lines are too long

View File

@@ -106,3 +106,11 @@ def message_of_the_day():
@register.simple_tag
def is_debug():
return settings.DEBUG
@register.simple_tag
def base_path(request, path_type):
if path_type == 'base':
return request._current_scheme_host + request.META.get('HTTP_X_SCRIPT_NAME', '')
elif path_type == 'script':
return request.META.get('HTTP_X_SCRIPT_NAME', '')

View File

@@ -0,0 +1,23 @@
location /my_app { # change to subfolder name
include /config/nginx/proxy.conf;
proxy_pass https://mywebapp.com/; # change to your host name:port
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Script-Name /my_app; # change to subfolder name
proxy_cookie_path / /my_app; # change to subfolder name
}
location /media/ {
include /config/nginx/proxy.conf;
alias /mediafiles/;
client_max_body_size 16M;
}
location /static/ {
include /config/nginx/proxy.conf;
alias /staticfiles/;
client_max_body_size 16M;
}

View File

@@ -13,4 +13,23 @@ from django.core.wsgi import get_wsgi_application
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "recipes.settings")
application = get_wsgi_application()
_application = get_wsgi_application()
# allows proxy servers to serve application at a subfolder
# NGINX config example is included in nginx/conf.d
def application(environ, start_response):
# http://flask.pocoo.org/snippets/35/
script_name = environ.get('HTTP_X_SCRIPT_NAME', '')
if script_name:
environ['SCRIPT_NAME'] = script_name
path_info = environ['PATH_INFO']
if path_info.startswith(script_name):
environ['PATH_INFO'] = path_info[len(script_name):]
scheme = environ.get('HTTP_X_SCHEME', '')
if scheme:
environ['wsgi.url_scheme'] = scheme
return _application(environ, start_response)

42
vetur.config.js Normal file
View File

@@ -0,0 +1,42 @@
// vetur.config.js
/** @type {import('vls').VeturConfig} */
module.exports = {
// **optional** default: `{}`
// override vscode settings
// Notice: It only affects the settings used by Vetur.
settings: {
"vetur.useWorkspaceDependencies": true,
"vetur.experimental.templateInterpolationService": true
},
// **optional** default: `[{ root: './' }]`
// support monorepos
projects: [
'./packages/repo2', // shorthand for only root.
{
// **required**
// Where is your project?
// It is relative to `vetur.config.js`.
root: './packages/repo1',
// **optional** default: `'package.json'`
// Where is `package.json` in the project?
// We use it to determine the version of vue.
// It is relative to root property.
package: './vue/package.json',
// **optional**
// Where is TypeScript config file in the project?
// It is relative to root property.
tsconfig: './vue/tsconfig.json',
// **optional** default: `'./.vscode/vetur/snippets'`
// Where is vetur custom snippets folders?
snippetFolder: './.vscode/vetur/snippets',
// **optional** default: `[]`
// Register globally Vue component glob.
// If you set it, you can get completion by that components.
// It is relative to root property.
// Notice: It won't actually do it. You need to use `require.context` or `Vue.component`
globalComponents: [
'./src/components/**/*.vue'
]
}
]
}

View File

@@ -6,7 +6,8 @@ import {ExpirationPlugin} from 'workbox-expiration';
const OFFLINE_CACHE_NAME = 'offline-html';
const OFFLINE_PAGE_URL = '/offline/';
let script_name = typeof window !== 'undefined' ? localStorage.getItem('SCRIPT_NAME') : '/'
var OFFLINE_PAGE_URL = script_name + 'offline/';
self.addEventListener('install', async (event) => {
event.waitUntil(

View File

@@ -18,7 +18,8 @@ import { Configuration } from "./configuration";
// @ts-ignore
import globalAxios, { AxiosPromise, AxiosInstance } from 'axios';
export const BASE_PATH = location.protocol + '//' + location.host; //TODO manually edited. Find good solution to automate later, remove from openapi-generator-ignore afterwards
//export const BASE_PATH = location.protocol + '//' + location.host; //TODO manually edited. Find good solution to automate later, remove from openapi-generator-ignore afterwards
export let BASE_PATH = typeof window !== 'undefined' ? localStorage.getItem('BASE_PATH') || '' : location.protocol + '//' + location.host;
/**
*

View File

@@ -1 +1 @@
{"status":"done","chunks":{"chunk-vendors":[{"name":"css/chunk-vendors.css","path":"F:\\Developement\\Django\\recipes\\cookbook\\static\\vue\\css\\chunk-vendors.css"},{"name":"js/chunk-vendors.js","path":"F:\\Developement\\Django\\recipes\\cookbook\\static\\vue\\js\\chunk-vendors.js"}],"import_response_view":[{"name":"js/import_response_view.js","path":"F:\\Developement\\Django\\recipes\\cookbook\\static\\vue\\js\\import_response_view.js"}],"offline_view":[{"name":"js/offline_view.js","path":"F:\\Developement\\Django\\recipes\\cookbook\\static\\vue\\js\\offline_view.js"}],"recipe_search_view":[{"name":"js/recipe_search_view.js","path":"F:\\Developement\\Django\\recipes\\cookbook\\static\\vue\\js\\recipe_search_view.js"}],"recipe_view":[{"name":"js/recipe_view.js","path":"F:\\Developement\\Django\\recipes\\cookbook\\static\\vue\\js\\recipe_view.js"}]}}
{"status":"done","chunks":{"chunk-vendors":[{"name":"css/chunk-vendors.css","path":"/home/smilerz/recipes/cookbook/static/vue/css/chunk-vendors.css"},{"name":"js/chunk-vendors.js","path":"/home/smilerz/recipes/cookbook/static/vue/js/chunk-vendors.js"}],"import_response_view":[{"name":"js/import_response_view.js","path":"/home/smilerz/recipes/cookbook/static/vue/js/import_response_view.js"}],"offline_view":[{"name":"js/offline_view.js","path":"/home/smilerz/recipes/cookbook/static/vue/js/offline_view.js"}],"recipe_search_view":[{"name":"js/recipe_search_view.js","path":"/home/smilerz/recipes/cookbook/static/vue/js/recipe_search_view.js"}],"recipe_view":[{"name":"js/recipe_view.js","path":"/home/smilerz/recipes/cookbook/static/vue/js/recipe_view.js"}]}}