mirror of
https://github.com/lnbits/lnbits.git
synced 2025-06-05 20:51:31 +02: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
|
password_repeat: this.loginData.passwordRepeat
|
||||||
})
|
})
|
||||||
|
|
||||||
window.location.href = '/admin'
|
LNbits.utils.redirect('/admin')
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
LNbits.utils.notifyApiError(e)
|
LNbits.utils.notifyApiError(e)
|
||||||
}
|
}
|
||||||
|
@ -69,7 +69,7 @@ self.addEventListener('push', function (event) {
|
|||||||
event.waitUntil(
|
event.waitUntil(
|
||||||
self.registration.showNotification(title, {
|
self.registration.showNotification(title, {
|
||||||
body: body,
|
body: body,
|
||||||
icon: '/favicon.ico',
|
icon: '/lnbits/favicon.ico',
|
||||||
data: {
|
data: {
|
||||||
url: url
|
url: url
|
||||||
}
|
}
|
||||||
|
@ -13,7 +13,7 @@ from pydantic.types import UUID4
|
|||||||
from lnbits.core.helpers import to_valid_user_id
|
from lnbits.core.helpers import to_valid_user_id
|
||||||
from lnbits.core.models import User
|
from lnbits.core.models import User
|
||||||
from lnbits.decorators import check_admin, check_user_exists
|
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.settings import settings
|
||||||
from lnbits.wallets import get_funding_source
|
from lnbits.wallets import get_funding_source
|
||||||
|
|
||||||
@ -244,21 +244,25 @@ async def manifest(request: Request, usr: str):
|
|||||||
"sizes": "512x512",
|
"sizes": "512x512",
|
||||||
"type": "image/png",
|
"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",
|
"type": "image/png",
|
||||||
"sizes": "192x192",
|
"sizes": "192x192",
|
||||||
"purpose": "maskable",
|
"purpose": "maskable",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"src": "/static/images/maskable_icon_x512.png",
|
"src": static_url_for("static", "images/maskable_icon_x512.png"),
|
||||||
"type": "image/png",
|
"type": "image/png",
|
||||||
"sizes": "512x512",
|
"sizes": "512x512",
|
||||||
"purpose": "maskable",
|
"purpose": "maskable",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"src": "/static/images/maskable_icon.png",
|
"src": static_url_for("static", "images/maskable_icon.png"),
|
||||||
"type": "image/png",
|
"type": "image/png",
|
||||||
"sizes": "1024x1024",
|
"sizes": "1024x1024",
|
||||||
"purpose": "maskable",
|
"purpose": "maskable",
|
||||||
@ -266,14 +270,14 @@ async def manifest(request: Request, usr: str):
|
|||||||
],
|
],
|
||||||
"screenshots": [
|
"screenshots": [
|
||||||
{
|
{
|
||||||
"src": "/static/images/screenshot_desktop.png",
|
"src": static_url_for("static", "images/screenshot_desktop.png"),
|
||||||
"sizes": "2394x1314",
|
"sizes": "2394x1314",
|
||||||
"type": "image/png",
|
"type": "image/png",
|
||||||
"form_factor": "wide",
|
"form_factor": "wide",
|
||||||
"label": "LNbits - Desktop screenshot",
|
"label": "LNbits - Desktop screenshot",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"src": "/static/images/screenshot_phone.png",
|
"src": static_url_for("static", "images/screenshot_phone.png"),
|
||||||
"sizes": "1080x1739",
|
"sizes": "1080x1739",
|
||||||
"type": "image/png",
|
"type": "image/png",
|
||||||
"form_factor": "narrow",
|
"form_factor": "narrow",
|
||||||
@ -294,7 +298,7 @@ async def manifest(request: Request, usr: str):
|
|||||||
"url": f"/wallet?usr={usr}&wal={wallet.id}",
|
"url": f"/wallet?usr={usr}&wal={wallet.id}",
|
||||||
"icons": [
|
"icons": [
|
||||||
{
|
{
|
||||||
"src": "/static/images/maskable_icon_x96.png",
|
"src": static_url_for("static", "images/maskable_icon_x96.png"),
|
||||||
"sizes": "96x96",
|
"sizes": "96x96",
|
||||||
"type": "image/png",
|
"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:
|
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:
|
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) {
|
request: function (method, url, apiKey, data) {
|
||||||
return axios({
|
return axios({
|
||||||
method: method,
|
method: method,
|
||||||
url: url,
|
url: `/lnbits/${url}`,
|
||||||
headers: {
|
headers: {
|
||||||
'X-Api-Key': apiKey
|
'X-Api-Key': apiKey
|
||||||
},
|
},
|
||||||
@ -74,7 +74,7 @@ window.LNbits = {
|
|||||||
register: function (username, email, password, password_repeat) {
|
register: function (username, email, password, password_repeat) {
|
||||||
return axios({
|
return axios({
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
url: '/api/v1/auth/register',
|
url: '/lnbits/api/v1/auth/register',
|
||||||
data: {
|
data: {
|
||||||
username,
|
username,
|
||||||
email,
|
email,
|
||||||
@ -86,21 +86,21 @@ window.LNbits = {
|
|||||||
login: function (username, password) {
|
login: function (username, password) {
|
||||||
return axios({
|
return axios({
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
url: '/api/v1/auth',
|
url: '/lnbits/api/v1/auth',
|
||||||
data: {username, password}
|
data: {username, password}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
loginUsr: function (usr) {
|
loginUsr: function (usr) {
|
||||||
return axios({
|
return axios({
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
url: '/api/v1/auth/usr',
|
url: '/lnbits/api/v1/auth/usr',
|
||||||
data: {usr}
|
data: {usr}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
logout: function () {
|
logout: function () {
|
||||||
return axios({
|
return axios({
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
url: '/api/v1/auth/logout'
|
url: '/lnbits/api/v1/auth/logout'
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
getAuthenticatedUser: function () {
|
getAuthenticatedUser: function () {
|
||||||
@ -113,7 +113,7 @@ window.LNbits = {
|
|||||||
return this.request('post', '/api/v1/wallet', wallet.adminkey, {
|
return this.request('post', '/api/v1/wallet', wallet.adminkey, {
|
||||||
name: name
|
name: name
|
||||||
}).then(res => {
|
}).then(res => {
|
||||||
window.location = '/wallet?wal=' + res.data.id
|
LNbits.utils.redirect('/wallet?wal=' + res.data.id)
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
updateWallet: function (name, wallet) {
|
updateWallet: function (name, wallet) {
|
||||||
@ -126,7 +126,7 @@ window.LNbits = {
|
|||||||
_ => {
|
_ => {
|
||||||
let url = new URL(window.location.href)
|
let url = new URL(window.location.href)
|
||||||
url.searchParams.delete('wal')
|
url.searchParams.delete('wal')
|
||||||
window.location = url
|
LNbits.utils.redirect(url)
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
@ -424,6 +424,9 @@ window.LNbits = {
|
|||||||
converter.setFlavor('github')
|
converter.setFlavor('github')
|
||||||
converter.setOption('simpleLineBreaks', true)
|
converter.setOption('simpleLineBreaks', true)
|
||||||
return converter.makeHtml(text)
|
return converter.makeHtml(text)
|
||||||
|
},
|
||||||
|
redirect(path) {
|
||||||
|
window.location = `/lnbits/${path}`
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -497,7 +500,7 @@ window.windowMixin = {
|
|||||||
.onOk(async () => {
|
.onOk(async () => {
|
||||||
try {
|
try {
|
||||||
await LNbits.api.logout()
|
await LNbits.api.logout()
|
||||||
window.location = '/'
|
LNbits.utils.redirect('/')
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
LNbits.utils.notifyApiError(e)
|
LNbits.utils.notifyApiError(e)
|
||||||
}
|
}
|
||||||
|
@ -50,7 +50,7 @@ new Vue({
|
|||||||
this.password,
|
this.password,
|
||||||
this.passwordRepeat
|
this.passwordRepeat
|
||||||
)
|
)
|
||||||
window.location.href = '/wallet'
|
LNbits.utils.redirect('/wallet')
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
LNbits.utils.notifyApiError(e)
|
LNbits.utils.notifyApiError(e)
|
||||||
}
|
}
|
||||||
@ -58,7 +58,7 @@ new Vue({
|
|||||||
login: async function () {
|
login: async function () {
|
||||||
try {
|
try {
|
||||||
await LNbits.api.login(this.username, this.password)
|
await LNbits.api.login(this.username, this.password)
|
||||||
window.location.href = '/wallet'
|
LNbits.utils.redirect('/wallet')
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
LNbits.utils.notifyApiError(e)
|
LNbits.utils.notifyApiError(e)
|
||||||
}
|
}
|
||||||
@ -67,14 +67,16 @@ new Vue({
|
|||||||
try {
|
try {
|
||||||
await LNbits.api.loginUsr(this.usr)
|
await LNbits.api.loginUsr(this.usr)
|
||||||
this.usr = ''
|
this.usr = ''
|
||||||
window.location.href = '/wallet'
|
LNbits.utils.redirect('/wallet')
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
LNbits.utils.notifyApiError(e)
|
LNbits.utils.notifyApiError(e)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
createWallet: function () {
|
createWallet: function () {
|
||||||
LNbits.api.createAccount(this.walletName).then(res => {
|
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 () {
|
processing: function () {
|
||||||
@ -96,7 +98,7 @@ new Vue({
|
|||||||
|
|
||||||
this.isUserAuthorized = !!this.$q.cookies.get('is_lnbits_user_authorized')
|
this.isUserAuthorized = !!this.$q.cookies.get('is_lnbits_user_authorized')
|
||||||
if (this.isUserAuthorized) {
|
if (this.isUserAuthorized) {
|
||||||
window.location.href = '/wallet'
|
LNbits.utils.redirect('/wallet')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
@ -583,7 +583,7 @@ new Vue({
|
|||||||
|
|
||||||
if (navigator.serviceWorker != null) {
|
if (navigator.serviceWorker != null) {
|
||||||
navigator.serviceWorker
|
navigator.serviceWorker
|
||||||
.register('/service-worker.js')
|
.register('/lnbits/service-worker.js')
|
||||||
.then(function (registration) {
|
.then(function (registration) {
|
||||||
console.log('Registered events at scope: ', registration.scope)
|
console.log('Registered events at scope: ', registration.scope)
|
||||||
})
|
})
|
||||||
|
@ -54,7 +54,7 @@
|
|||||||
window.history.back()
|
window.history.back()
|
||||||
},
|
},
|
||||||
goHome: function () {
|
goHome: function () {
|
||||||
window.location.href = '/'
|
LNbits.utils.redirect('/')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
Loading…
x
Reference in New Issue
Block a user