feat: adding root path functionality
- add --root-path to lnbits application start to use in uvicorn - utils.urlFor is aware of root-path - api.request is aware of root-path TODO: dynamic component loading kinda works, but older extension loading is curently broken because of path issues on `normalize_path` unhardcode api fixup nocache unhardcode feat: adding root path functionality - add --root-path to lnbits application start to use in uvicorn - utils.urlFor is aware of root-path - api.request is aware of root-path TODO: dynamic component loading kinda works, but older extension loading is curently broken because of path issues on `normalize_path`
This commit is contained in:
+19
-51
@@ -1,5 +1,7 @@
|
||||
window._lnbitsApi = {
|
||||
request(method, url, apiKey, data, options = {}) {
|
||||
url = ROOT_PATH + url.replace(/^\/+/, '') // Ensure single slash after rootPath
|
||||
console.log(`API Request: ${method.toUpperCase()} ${url}`)
|
||||
return axios({
|
||||
method: method,
|
||||
url: url,
|
||||
@@ -67,75 +69,41 @@ window._lnbitsApi = {
|
||||
})
|
||||
},
|
||||
register(username, email, password, password_repeat, invitation_code) {
|
||||
return axios({
|
||||
method: 'POST',
|
||||
url: '/api/v1/auth/register',
|
||||
data: {
|
||||
username,
|
||||
email,
|
||||
password,
|
||||
password_repeat,
|
||||
invitation_code
|
||||
}
|
||||
return this.request('post', '/api/v1/auth/register', null, {
|
||||
username,
|
||||
email,
|
||||
password,
|
||||
password_repeat,
|
||||
invitation_code
|
||||
})
|
||||
},
|
||||
reset(reset_key, password, password_repeat) {
|
||||
return axios({
|
||||
method: 'PUT',
|
||||
url: '/api/v1/auth/reset',
|
||||
data: {
|
||||
reset_key,
|
||||
password,
|
||||
password_repeat
|
||||
}
|
||||
return this.request('put', '/api/v1/auth/reset', null, {
|
||||
reset_key,
|
||||
password,
|
||||
password_repeat
|
||||
})
|
||||
},
|
||||
getAuthUser() {
|
||||
return axios({
|
||||
method: 'GET',
|
||||
url: '/api/v1/auth'
|
||||
})
|
||||
return this.request('get', '/api/v1/auth')
|
||||
},
|
||||
login(username, password) {
|
||||
return axios({
|
||||
method: 'POST',
|
||||
url: '/api/v1/auth',
|
||||
data: {username, password}
|
||||
})
|
||||
return this.request('post', '/api/v1/auth', null, {username, password})
|
||||
},
|
||||
loginByProvider(provider, headers, data) {
|
||||
return axios({
|
||||
method: 'POST',
|
||||
url: `/api/v1/auth/${provider}`,
|
||||
headers: headers,
|
||||
data
|
||||
})
|
||||
return this.request('post', `/api/v1/auth/${provider}`, null, data)
|
||||
},
|
||||
loginUsr(usr) {
|
||||
return axios({
|
||||
method: 'POST',
|
||||
url: '/api/v1/auth/usr',
|
||||
data: {usr}
|
||||
})
|
||||
return this.request('post', '/api/v1/auth/usr', null, {usr})
|
||||
},
|
||||
logout() {
|
||||
return axios({
|
||||
method: 'POST',
|
||||
url: '/api/v1/auth/logout'
|
||||
})
|
||||
return this.request('post', '/api/v1/auth/logout')
|
||||
},
|
||||
impersonateUser(usr) {
|
||||
return axios({
|
||||
method: 'POST',
|
||||
url: '/api/v1/auth/impersonate',
|
||||
data: {usr}
|
||||
})
|
||||
return this.request('POST', '/api/v1/auth/impersonate', null, {usr})
|
||||
},
|
||||
stopImpersonation() {
|
||||
return axios({
|
||||
method: 'DELETE',
|
||||
url: '/api/v1/auth/impersonate'
|
||||
})
|
||||
return this.request('DELETE', '/api/v1/auth/impersonate')
|
||||
},
|
||||
getAuthenticatedUser() {
|
||||
return this.request('get', '/api/v1/auth')
|
||||
|
||||
Reference in New Issue
Block a user