mirror of
https://github.com/lmg-anon/mikupad.git
synced 2026-07-09 17:19:17 +00:00
Use the configured session endpoint rather than localhost
This commit is contained in:
parent
e9bdf15a19
commit
919fff399c
2 changed files with 7 additions and 6 deletions
|
|
@ -1776,14 +1776,15 @@ class SessionStorage {
|
|||
}
|
||||
|
||||
class WebSessionStorage extends SessionStorage {
|
||||
constructor(defaultPresets) {
|
||||
constructor(defaultPresets, sessionEndpoint) {
|
||||
super(defaultPresets);
|
||||
this.sessionEndpoint = sessionEndpoint;
|
||||
}
|
||||
|
||||
async openDatabase() {
|
||||
return async (route, options) => {
|
||||
try {
|
||||
return await fetch(new URL(route, "http://127.0.0.1:3000/"), {
|
||||
return await fetch(new URL(route, this.sessionEndpoint), {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
|
|
@ -1794,7 +1795,7 @@ class WebSessionStorage extends SessionStorage {
|
|||
});
|
||||
} catch (e) {
|
||||
reportError(e);
|
||||
return { ok: false, status: -1 };
|
||||
return { ok: false, status: e.toString() };
|
||||
}
|
||||
};
|
||||
}
|
||||
|
|
@ -2801,7 +2802,7 @@ export function App({ sessionStorageRef }) {
|
|||
const cancelThis = () => ac.abort();
|
||||
setCancel(() => cancelThis);
|
||||
|
||||
const sessionStorage = new WebSessionStorage(defaultPresets);
|
||||
const sessionStorage = new WebSessionStorage(defaultPresets, sessionEndpoint);
|
||||
sessionStorage.dependents = sessionStorageRef.sessionStorage.dependents;
|
||||
sessionStorage.onchange = sessionStorageRef.sessionStorage.onchange;
|
||||
sessionStorage.onsessionchange = sessionStorageRef.sessionStorage.onsessionchange;
|
||||
|
|
|
|||
|
|
@ -74,8 +74,8 @@ app.post('/delete', (req, res) => {
|
|||
});
|
||||
|
||||
// Start the server
|
||||
app.listen(port, () => {
|
||||
console.log(`Server listening at http://localhost:${port}`);
|
||||
app.listen(port, '0.0.0.0', () => {
|
||||
console.log(`Server listening at http://0.0.0.0:${port}`);
|
||||
});
|
||||
|
||||
// Close db connection on server close
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue