mirror of
https://github.com/lnbits/lnbits-legend.git
synced 2024-11-19 01:43:42 +01:00
chore: hardcode base path
This commit is contained in:
parent
97de4eda18
commit
6898839193
13
Caddyfile
Normal file
13
Caddyfile
Normal file
@ -0,0 +1,13 @@
|
||||
{
|
||||
debug
|
||||
}
|
||||
|
||||
localhost:9090 {
|
||||
handle_path /lnbits* {
|
||||
reverse_proxy localhost:5000
|
||||
}
|
||||
|
||||
handle /* {
|
||||
reverse_proxy localhost:8080
|
||||
}
|
||||
}
|
@ -128,7 +128,7 @@
|
||||
password_repeat: this.loginData.passwordRepeat
|
||||
})
|
||||
|
||||
window.location.href = '/admin'
|
||||
LNbits.utils.redirect('/admin')
|
||||
} catch (e) {
|
||||
LNbits.utils.notifyApiError(e)
|
||||
}
|
||||
|
@ -69,7 +69,7 @@ self.addEventListener('push', function (event) {
|
||||
event.waitUntil(
|
||||
self.registration.showNotification(title, {
|
||||
body: body,
|
||||
icon: '/favicon.ico',
|
||||
icon: '/lnbits/favicon.ico',
|
||||
data: {
|
||||
url: url
|
||||
}
|
||||
|
@ -13,7 +13,7 @@ from pydantic.types import UUID4
|
||||
from lnbits.core.helpers import to_valid_user_id
|
||||
from lnbits.core.models import User
|
||||
from lnbits.decorators import check_admin, check_user_exists
|
||||
from lnbits.helpers import template_renderer
|
||||
from lnbits.helpers import static_url_for, template_renderer
|
||||
from lnbits.settings import settings
|
||||
from lnbits.wallets import get_funding_source
|
||||
|
||||
@ -244,21 +244,25 @@ async def manifest(request: Request, usr: str):
|
||||
"sizes": "512x512",
|
||||
"type": "image/png",
|
||||
},
|
||||
{"src": "/static/favicon.ico", "sizes": "32x32", "type": "image/x-icon"},
|
||||
{
|
||||
"src": "/static/images/maskable_icon_x192.png",
|
||||
"src": static_url_for("static", "favicon.ico"),
|
||||
"sizes": "32x32",
|
||||
"type": "image/x-icon",
|
||||
},
|
||||
{
|
||||
"src": static_url_for("static", "images/maskable_icon_x192.png"),
|
||||
"type": "image/png",
|
||||
"sizes": "192x192",
|
||||
"purpose": "maskable",
|
||||
},
|
||||
{
|
||||
"src": "/static/images/maskable_icon_x512.png",
|
||||
"src": static_url_for("static", "images/maskable_icon_x512.png"),
|
||||
"type": "image/png",
|
||||
"sizes": "512x512",
|
||||
"purpose": "maskable",
|
||||
},
|
||||
{
|
||||
"src": "/static/images/maskable_icon.png",
|
||||
"src": static_url_for("static", "images/maskable_icon.png"),
|
||||
"type": "image/png",
|
||||
"sizes": "1024x1024",
|
||||
"purpose": "maskable",
|
||||
@ -266,14 +270,14 @@ async def manifest(request: Request, usr: str):
|
||||
],
|
||||
"screenshots": [
|
||||
{
|
||||
"src": "/static/images/screenshot_desktop.png",
|
||||
"src": static_url_for("static", "images/screenshot_desktop.png"),
|
||||
"sizes": "2394x1314",
|
||||
"type": "image/png",
|
||||
"form_factor": "wide",
|
||||
"label": "LNbits - Desktop screenshot",
|
||||
},
|
||||
{
|
||||
"src": "/static/images/screenshot_phone.png",
|
||||
"src": static_url_for("static", "images/screenshot_phone.png"),
|
||||
"sizes": "1080x1739",
|
||||
"type": "image/png",
|
||||
"form_factor": "narrow",
|
||||
@ -294,7 +298,7 @@ async def manifest(request: Request, usr: str):
|
||||
"url": f"/wallet?usr={usr}&wal={wallet.id}",
|
||||
"icons": [
|
||||
{
|
||||
"src": "/static/images/maskable_icon_x96.png",
|
||||
"src": static_url_for("static", "images/maskable_icon_x96.png"),
|
||||
"sizes": "96x96",
|
||||
"type": "image/png",
|
||||
}
|
||||
|
@ -47,7 +47,7 @@ def url_for(endpoint: str, external: Optional[bool] = False, **params: Any) -> s
|
||||
|
||||
|
||||
def static_url_for(static: str, path: str) -> str:
|
||||
return f"/{static}/{path}?v={settings.server_startup_time}"
|
||||
return f"/lnbits/{static}/{path}?v={settings.server_startup_time}"
|
||||
|
||||
|
||||
def template_renderer(additional_folders: Optional[List] = None) -> Jinja2Templates:
|
||||
|
2
lnbits/static/bundle.min.js
vendored
2
lnbits/static/bundle.min.js
vendored
File diff suppressed because one or more lines are too long
@ -15,7 +15,7 @@ window.LNbits = {
|
||||
request: function (method, url, apiKey, data) {
|
||||
return axios({
|
||||
method: method,
|
||||
url: url,
|
||||
url: `/lnbits/${url}`,
|
||||
headers: {
|
||||
'X-Api-Key': apiKey
|
||||
},
|
||||
@ -74,7 +74,7 @@ window.LNbits = {
|
||||
register: function (username, email, password, password_repeat) {
|
||||
return axios({
|
||||
method: 'POST',
|
||||
url: '/api/v1/auth/register',
|
||||
url: '/lnbits/api/v1/auth/register',
|
||||
data: {
|
||||
username,
|
||||
email,
|
||||
@ -86,21 +86,21 @@ window.LNbits = {
|
||||
login: function (username, password) {
|
||||
return axios({
|
||||
method: 'POST',
|
||||
url: '/api/v1/auth',
|
||||
url: '/lnbits/api/v1/auth',
|
||||
data: {username, password}
|
||||
})
|
||||
},
|
||||
loginUsr: function (usr) {
|
||||
return axios({
|
||||
method: 'POST',
|
||||
url: '/api/v1/auth/usr',
|
||||
url: '/lnbits/api/v1/auth/usr',
|
||||
data: {usr}
|
||||
})
|
||||
},
|
||||
logout: function () {
|
||||
return axios({
|
||||
method: 'POST',
|
||||
url: '/api/v1/auth/logout'
|
||||
url: '/lnbits/api/v1/auth/logout'
|
||||
})
|
||||
},
|
||||
getAuthenticatedUser: function () {
|
||||
@ -113,7 +113,7 @@ window.LNbits = {
|
||||
return this.request('post', '/api/v1/wallet', wallet.adminkey, {
|
||||
name: name
|
||||
}).then(res => {
|
||||
window.location = '/wallet?wal=' + res.data.id
|
||||
LNbits.utils.redirect('/wallet?wal=' + res.data.id)
|
||||
})
|
||||
},
|
||||
updateWallet: function (name, wallet) {
|
||||
@ -126,7 +126,7 @@ window.LNbits = {
|
||||
_ => {
|
||||
let url = new URL(window.location.href)
|
||||
url.searchParams.delete('wal')
|
||||
window.location = url
|
||||
LNbits.utils.redirect(url)
|
||||
}
|
||||
)
|
||||
},
|
||||
@ -424,6 +424,9 @@ window.LNbits = {
|
||||
converter.setFlavor('github')
|
||||
converter.setOption('simpleLineBreaks', true)
|
||||
return converter.makeHtml(text)
|
||||
},
|
||||
redirect(path) {
|
||||
window.location = `/lnbits/${path}`
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -497,7 +500,7 @@ window.windowMixin = {
|
||||
.onOk(async () => {
|
||||
try {
|
||||
await LNbits.api.logout()
|
||||
window.location = '/'
|
||||
LNbits.utils.redirect('/')
|
||||
} catch (e) {
|
||||
LNbits.utils.notifyApiError(e)
|
||||
}
|
||||
|
@ -50,7 +50,7 @@ new Vue({
|
||||
this.password,
|
||||
this.passwordRepeat
|
||||
)
|
||||
window.location.href = '/wallet'
|
||||
LNbits.utils.redirect('/wallet')
|
||||
} catch (e) {
|
||||
LNbits.utils.notifyApiError(e)
|
||||
}
|
||||
@ -58,7 +58,7 @@ new Vue({
|
||||
login: async function () {
|
||||
try {
|
||||
await LNbits.api.login(this.username, this.password)
|
||||
window.location.href = '/wallet'
|
||||
LNbits.utils.redirect('/wallet')
|
||||
} catch (e) {
|
||||
LNbits.utils.notifyApiError(e)
|
||||
}
|
||||
@ -67,14 +67,16 @@ new Vue({
|
||||
try {
|
||||
await LNbits.api.loginUsr(this.usr)
|
||||
this.usr = ''
|
||||
window.location.href = '/wallet'
|
||||
LNbits.utils.redirect('/wallet')
|
||||
} catch (e) {
|
||||
LNbits.utils.notifyApiError(e)
|
||||
}
|
||||
},
|
||||
createWallet: function () {
|
||||
LNbits.api.createAccount(this.walletName).then(res => {
|
||||
window.location = '/wallet?usr=' + res.data.user + '&wal=' + res.data.id
|
||||
LNbits.utils.redirect(
|
||||
'/wallet?usr=' + res.data.user + '&wal=' + res.data.id
|
||||
)
|
||||
})
|
||||
},
|
||||
processing: function () {
|
||||
@ -96,7 +98,7 @@ new Vue({
|
||||
|
||||
this.isUserAuthorized = !!this.$q.cookies.get('is_lnbits_user_authorized')
|
||||
if (this.isUserAuthorized) {
|
||||
window.location.href = '/wallet'
|
||||
LNbits.utils.redirect('/wallet')
|
||||
}
|
||||
}
|
||||
})
|
||||
|
@ -583,7 +583,7 @@ new Vue({
|
||||
|
||||
if (navigator.serviceWorker != null) {
|
||||
navigator.serviceWorker
|
||||
.register('/service-worker.js')
|
||||
.register('/lnbits/service-worker.js')
|
||||
.then(function (registration) {
|
||||
console.log('Registered events at scope: ', registration.scope)
|
||||
})
|
||||
|
@ -54,7 +54,7 @@
|
||||
window.history.back()
|
||||
},
|
||||
goHome: function () {
|
||||
window.location.href = '/'
|
||||
LNbits.utils.redirect('/')
|
||||
}
|
||||
}
|
||||
})
|
||||
|
Loading…
Reference in New Issue
Block a user