diff --git a/mikupad.html b/mikupad.html
index 6b6158d..25b6c00 100644
--- a/mikupad.html
+++ b/mikupad.html
@@ -2915,9 +2915,17 @@
}
async init() {
- // Test connection
- const db = await this.openDatabase();
- await this.loadFromDatabase(db, "Sessions", "selectedSessionId");
+ const res = await fetch(new URL('/version', this.sessionEndpoint), {
+ method: 'GET',
+ headers: {
+ 'Content-Type': 'application/json'
+ }
+ });
+ if (!res.ok)
+ throw new Error("Not a mikupad server or version mismatch.");
+ const { version } = await res.json();
+ if (version !== 2)
+ throw new Error("Mikupad server version mismatch.");
}
async openDatabase() {
diff --git a/server/server.js b/server/server.js
index 3272525..96453bc 100644
--- a/server/server.js
+++ b/server/server.js
@@ -62,6 +62,11 @@ app.get('/', (req, res) => {
res.sendFile(path.join(__dirname, '..', 'mikupad.html'));
});
+// GET route to get the server version
+app.get('/version', (req, res) => {
+ res.json({ version: 2 });
+});
+
// Dynamic POST proxy route
app.post('/proxy/*', async (req, res) => {
// Capture the part of the URL after '/proxy'
@@ -148,6 +153,8 @@ app.get('/proxy/*', async (req, res) => {
});
const normalizeStoreName = (storeName) => {
+ if (!storeName)
+ return "Sessions";
return storeName.split(' ')[0].toLowerCase();
};