-
Notifications
You must be signed in to change notification settings - Fork 450
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(desktop): support enable ignore qos 0 messages
- Loading branch information
Showing
11 changed files
with
222 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
140 changes: 140 additions & 0 deletions
140
src/database/migration/1724839386732-ignoreQoS0Message.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,140 @@ | ||
import { MigrationInterface, QueryRunner } from 'typeorm' | ||
|
||
export class ignoreQoS0Message1724839386732 implements MigrationInterface { | ||
name = 'ignoreQoS0Message1724839386732' | ||
|
||
public async up(queryRunner: QueryRunner): Promise<void> { | ||
await queryRunner.query(` | ||
CREATE TABLE "temporary_SettingEntity" ( | ||
"id" varchar PRIMARY KEY NOT NULL, | ||
"width" integer NOT NULL DEFAULT (1025), | ||
"height" integer NOT NULL DEFAULT (749), | ||
"autoCheck" boolean NOT NULL DEFAULT (1), | ||
"currentLang" varchar CHECK(currentLang IN ('zh', 'en', 'ja', 'tr', 'hu')) NOT NULL DEFAULT ('en'), | ||
"currentTheme" varchar CHECK(currentTheme IN ('light', 'dark', 'night')) NOT NULL DEFAULT ('light'), | ||
"maxReconnectTimes" integer NOT NULL DEFAULT (10), | ||
"autoResub" boolean NOT NULL DEFAULT (1), | ||
"syncOsTheme" boolean NOT NULL DEFAULT (0), | ||
"multiTopics" boolean NOT NULL DEFAULT (1), | ||
"jsonHighlight" boolean NOT NULL DEFAULT (1), | ||
"openAIAPIKey" varchar NOT NULL DEFAULT (''), | ||
"model" varchar NOT NULL DEFAULT ('gpt-3.5-turbo'), | ||
"enableCopilot" boolean NOT NULL DEFAULT (1), | ||
"logLevel" varchar CHECK(logLevel IN ('debug', 'info', 'warn', 'error')) NOT NULL DEFAULT ('info'), | ||
"openAIAPIHost" varchar NOT NULL DEFAULT ('https://api.openai.com/v1'), | ||
"ignoreQoS0Message" boolean NOT NULL DEFAULT (0) | ||
) | ||
`) | ||
await queryRunner.query(` | ||
INSERT INTO "temporary_SettingEntity"( | ||
"id", | ||
"width", | ||
"height", | ||
"autoCheck", | ||
"currentLang", | ||
"currentTheme", | ||
"maxReconnectTimes", | ||
"autoResub", | ||
"syncOsTheme", | ||
"multiTopics", | ||
"jsonHighlight", | ||
"openAIAPIKey", | ||
"model", | ||
"enableCopilot", | ||
"logLevel", | ||
"openAIAPIHost" | ||
) | ||
SELECT "id", | ||
"width", | ||
"height", | ||
"autoCheck", | ||
"currentLang", | ||
"currentTheme", | ||
"maxReconnectTimes", | ||
"autoResub", | ||
"syncOsTheme", | ||
"multiTopics", | ||
"jsonHighlight", | ||
"openAIAPIKey", | ||
"model", | ||
"enableCopilot", | ||
"logLevel", | ||
"openAIAPIHost" | ||
FROM "SettingEntity" | ||
`) | ||
await queryRunner.query(` | ||
DROP TABLE "SettingEntity" | ||
`) | ||
await queryRunner.query(` | ||
ALTER TABLE "temporary_SettingEntity" | ||
RENAME TO "SettingEntity" | ||
`) | ||
} | ||
|
||
public async down(queryRunner: QueryRunner): Promise<void> { | ||
await queryRunner.query(` | ||
ALTER TABLE "SettingEntity" | ||
RENAME TO "temporary_SettingEntity" | ||
`) | ||
await queryRunner.query(` | ||
CREATE TABLE "SettingEntity" ( | ||
"id" varchar PRIMARY KEY NOT NULL, | ||
"width" integer NOT NULL DEFAULT (1025), | ||
"height" integer NOT NULL DEFAULT (749), | ||
"autoCheck" boolean NOT NULL DEFAULT (1), | ||
"currentLang" varchar CHECK(currentLang IN ('zh', 'en', 'ja', 'tr', 'hu')) NOT NULL DEFAULT ('en'), | ||
"currentTheme" varchar CHECK(currentTheme IN ('light', 'dark', 'night')) NOT NULL DEFAULT ('light'), | ||
"maxReconnectTimes" integer NOT NULL DEFAULT (10), | ||
"autoResub" boolean NOT NULL DEFAULT (1), | ||
"syncOsTheme" boolean NOT NULL DEFAULT (0), | ||
"multiTopics" boolean NOT NULL DEFAULT (1), | ||
"jsonHighlight" boolean NOT NULL DEFAULT (1), | ||
"openAIAPIKey" varchar NOT NULL DEFAULT (''), | ||
"model" varchar NOT NULL DEFAULT ('gpt-3.5-turbo'), | ||
"enableCopilot" boolean NOT NULL DEFAULT (1), | ||
"logLevel" varchar CHECK(logLevel IN ('debug', 'info', 'warn', 'error')) NOT NULL DEFAULT ('info'), | ||
"openAIAPIHost" varchar NOT NULL DEFAULT ('https://api.openai.com/v1') | ||
) | ||
`) | ||
await queryRunner.query(` | ||
INSERT INTO "SettingEntity"( | ||
"id", | ||
"width", | ||
"height", | ||
"autoCheck", | ||
"currentLang", | ||
"currentTheme", | ||
"maxReconnectTimes", | ||
"autoResub", | ||
"syncOsTheme", | ||
"multiTopics", | ||
"jsonHighlight", | ||
"openAIAPIKey", | ||
"model", | ||
"enableCopilot", | ||
"logLevel", | ||
"openAIAPIHost" | ||
) | ||
SELECT "id", | ||
"width", | ||
"height", | ||
"autoCheck", | ||
"currentLang", | ||
"currentTheme", | ||
"maxReconnectTimes", | ||
"autoResub", | ||
"syncOsTheme", | ||
"multiTopics", | ||
"jsonHighlight", | ||
"openAIAPIKey", | ||
"model", | ||
"enableCopilot", | ||
"logLevel", | ||
"openAIAPIHost" | ||
FROM "temporary_SettingEntity" | ||
`) | ||
await queryRunner.query(` | ||
DROP TABLE "temporary_SettingEntity" | ||
`) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters