ctucx.git: trainsearch

web based trip-planner, fork of https://cyberchaos.dev/yuka/trainsearch

commit 4dc95f397b9ff7e1f8d8003d244cc99d5916f014
parent feb74e06cc43f48839084486998be08d5ba0f15b
Author: Yureka <yuka@yuka.dev>
Date: Mon, 13 Jan 2025 19:40:46 +0100

remove vbb profile
3 files changed, 10 insertions(+), 8 deletions(-)
diff --git a/src/dataStorage.js b/src/dataStorage.js
@@ -54,8 +54,8 @@ class IDBStorage {
 	}
 
 	static async open() {
-		const idb = await openDB(dbName, 2, {
-			upgrade: (db, oldVersion, newVersion, transaction) => {
+		const idb = await openDB(dbName, 3, {
+			upgrade: async (db, oldVersion, newVersion, transaction) => {
 				console.log(`upgrading database from ${oldVersion} to ${newVersion}`);
 				switch (oldVersion) {
 				case 0:

@@ -85,7 +85,14 @@ class IDBStorage {
 					db.createObjectStore('journeysOverview', {keyPath: 'slug'});
 					db.createObjectStore('journeysHistory', {autoIncrement: true});
 				case 2:
-					//... add migrations for 2->3 here
+					const tx = await db.transaction(['settings'], 'readwrite');
+					const settings = tx.store.get('settings');
+					if (settings.profile === 'vbb') {
+						settings.profile = 'db';
+					}
+					tx.store.put(settings, 'settings');
+				case 3:
+					//... add migrations for 3->4 here
 				}
 			},
 			blocking: async () => {
diff --git a/src/hafas_client.js b/src/hafas_client.js
@@ -12,10 +12,6 @@ export const getHafasClient = async profileName => {
 			case "db":
 				profile = dbProfile;
 				break;
-			case "vbb":
-				const { profile: vbbProfile } = await import('hafas-client/p/vbb');
-				profile = vbbProfile;
-				break;
 			case "bvg":
 				const { profile: bvgProfile } = await import('hafas-client/p/bvg');
 				profile = bvgProfile;
diff --git a/src/settingsView.js b/src/settingsView.js
@@ -26,7 +26,6 @@ const settingsTemplate = () => html`
 		<br>
 		<b>${t('endpoint')}:</b><br>
 		<label><input type="radio" name="profile" ?checked=${settings.profile === 'db'} value="db"> DB</label><br>
-		<label><input type="radio" name="profile" ?checked=${settings.profile === 'vbb'} value="vbb"> VBB (${t("experimental")})</label><br>
 		<label><input type="radio" name="profile" ?checked=${settings.profile === 'nahsh'} value="nahsh"> NAH.SH (${t("experimental")})</label><br>
 		<label><input type="radio" name="profile" ?checked=${settings.profile === 'bvg'} value="bvg"> BVG (${t("experimental")})</label><br>
 		<!--<label><input type="radio" name="profile" ?checked=${settings.profile === 'sncb'} value="sncb"> SNCB (${t("experimental")})</label><br>-->