diff --git a/backend/cmd/migration/1_1.go b/backend/cmd/migration/1_1.go index a3453f7..d4e68e2 100644 --- a/backend/cmd/migration/1_1.go +++ b/backend/cmd/migration/1_1.go @@ -62,6 +62,10 @@ func migrateClientSchema(db *gorm.DB) error { return nil } +func deleteOldWebSecret(db *gorm.DB) error { + return db.Exec("DELETE FROM settings WHERE key = ?", "webSecret").Error +} + func changesObj(db *gorm.DB) error { return db.Exec("UPDATE changes SET obj = CAST('\"' || CAST(obj AS TEXT) || '\"' AS BLOB) WHERE actor = ? and obj not like ?", "DepleteJob", "\"%\"").Error } @@ -71,6 +75,10 @@ func to1_1(db *gorm.DB) error { if err != nil { return err } + err = deleteOldWebSecret(db) + if err != nil { + return err + } err = changesObj(db) if err != nil { return err diff --git a/frontend/src/plugins/utils.ts b/frontend/src/plugins/utils.ts index 0fafeb8..8c109cd 100644 --- a/frontend/src/plugins/utils.ts +++ b/frontend/src/plugins/utils.ts @@ -5,55 +5,6 @@ type OBJ = { } export const FindDiff = { - Config(obj1: OBJ, obj2: OBJ): any[] { - const differences: any[] = [] - - if(!obj2){ - return [ { key: "all", obj: obj1 } ] - } - - for (const key in obj1) { - if (obj2.hasOwnProperty(key)) { - const value1 = obj1[key] - const value2 = obj2[key] - - if (Array.isArray(value1)){ - value1.forEach((v1,index) => { - if(index >= value2.length){ - differences.push({key: key, action: "new", index: index, obj: v1}) - } else if(!this.deepCompare(v1,value2[index])) { - differences.push({key: key, action: "edit", index: index, obj: v1}) - } - }) - } else { - if (!this.deepCompare(value1,value2)) { - differences.push({ key: key, action: "set", obj: value1}) - } - } - } else { - differences.push({ key: key, action: "set", obj: obj1[key]}) - } - } - - return differences - }, - ArrObj(value1: any[], value2: any[], key: string): any { - const differences: any[] = [] - value1.forEach((v1,index) => { - if(index >= value2.length) differences.push({key: key, action: "new", obj: v1}) - else if(!this.deepCompare(v1,value2[index])) differences.push({key: key, action: "edit", obj: v1}) - }) - return differences - }, - Settings(obj1: OBJ, obj2: OBJ): any { - const differences: any[] = [] - for (const key in obj1) { - if (obj1[key] != obj2[key]) { - differences.push({ key: key, action: "set", obj: obj1[key]}) - } - } - return differences - }, deepCompare(obj1: any, obj2: any): boolean { // Check if the types of both objects are the same if (typeof obj1 !== typeof obj2) { diff --git a/frontend/src/store/modules/data.ts b/frontend/src/store/modules/data.ts index 5eae14e..96ad058 100644 --- a/frontend/src/store/modules/data.ts +++ b/frontend/src/store/modules/data.ts @@ -1,4 +1,3 @@ -import { FindDiff } from '@/plugins/utils' import HttpUtils from '@/plugins/httputil' import { defineStore } from 'pinia' import { push } from 'notivue' @@ -56,15 +55,11 @@ const Data = defineStore('Data', { } return [] }, - async save (object: string, action: string, data: any, userLinks: any[] | null = null, outJsons: any[] | null = null): Promise { + async save (object: string, action: string, data: any): Promise { let postData = { object: object, action: action, data: JSON.stringify(data, null, 2), - userLinks: userLinks == null ? undefined : JSON.stringify(userLinks), - } - if (userLinks == null) { - delete postData.userLinks } const msg = await HttpUtils.post('api/save', postData) if (msg.success) { @@ -78,7 +73,7 @@ const Data = defineStore('Data', { } return msg.success } - }, + } }) export default Data \ No newline at end of file diff --git a/frontend/src/views/Basics.vue b/frontend/src/views/Basics.vue index 067eb18..9ab1b4d 100644 --- a/frontend/src/views/Basics.vue +++ b/frontend/src/views/Basics.vue @@ -234,7 +234,6 @@ import Data from '@/store/modules/data' import Dial from '@/components/Dial.vue' import { computed, ref, onMounted } from 'vue' import { Config, Ntp } from '@/types/config' -import { Client } from '@/types/clients' import { FindDiff } from '@/plugins/utils' const oldConfig = ref({})