From efcca69d43841c96e522e35e8d8b630f7a2cafe1 Mon Sep 17 00:00:00 2001 From: Laurent Dinclaux Date: Tue, 10 Feb 2026 23:26:27 +1100 Subject: [PATCH] Fix double HTML escaping in switcher and harden JS edge cases --- README.md | 4 +- SQL/mysql/2016060200.sql | 5 -- SQL/mysql/2018071600.sql | 6 --- SQL/mysql/2018121800.sql | 29 ------------ SQL/mysql/2019112000.sql | 5 -- SQL/mysql/2019121300.sql | 14 ------ SQL/mysql/2020060100.sql | 7 --- SQL/postgres/2016052000.sql | 11 ----- SQL/postgres/2016060200.sql | 5 -- SQL/postgres/2018081600.sql | 5 -- SQL/postgres/2018121800.sql | 31 ------------- SQL/postgres/2019112000.sql | 5 -- SQL/postgres/2019121300.sql | 14 ------ SQL/postgres/2020060100.sql | 7 --- SQL/sqlite/2018121800.sql | 76 ------------------------------ SQL/sqlite/2020121600.sql | 92 ------------------------------------- composer.json | 5 +- ident_switch-switch.js | 11 +++-- ident_switch.php | 2 +- 19 files changed, 15 insertions(+), 319 deletions(-) delete mode 100644 SQL/mysql/2016060200.sql delete mode 100644 SQL/mysql/2018071600.sql delete mode 100644 SQL/mysql/2018121800.sql delete mode 100644 SQL/mysql/2019112000.sql delete mode 100644 SQL/mysql/2019121300.sql delete mode 100644 SQL/mysql/2020060100.sql delete mode 100644 SQL/postgres/2016052000.sql delete mode 100644 SQL/postgres/2016060200.sql delete mode 100644 SQL/postgres/2018081600.sql delete mode 100644 SQL/postgres/2018121800.sql delete mode 100644 SQL/postgres/2019112000.sql delete mode 100644 SQL/postgres/2019121300.sql delete mode 100644 SQL/postgres/2020060100.sql delete mode 100644 SQL/sqlite/2018121800.sql delete mode 100644 SQL/sqlite/2020121600.sql diff --git a/README.md b/README.md index b3966a7..ab79804 100644 --- a/README.md +++ b/README.md @@ -162,6 +162,8 @@ Database migrations are applied automatically by the Roundcube plugin installer. If you are upgrading from `boressoft/ident_switch`, `toteph42/identity_switch`, or another fork: +> **Important:** This version (5.x) requires a **v4.x database schema** as its starting point. If you are running v1.x–v3.x, you must first upgrade to v4.x (`boressoft/ident_switch`) before migrating to this fork. This applies to all supported databases (MySQL, PostgreSQL, SQLite). + ### With Composer 1. Replace the old package in `composer.json` with `gecka/roundcube-ident_switch` and run `composer update` @@ -202,7 +204,7 @@ Original code by Boris Gulay licensed under GPL-3.0+. New contributions licensed - **Boris Gulay** — Original developer (2016–2022) - **Christian Landvogt** — Special folders support - **Gergely Papp** — Bug fixes -- **Laurent Dinclaux - Gecka** — Current maintainer ([Gecka](https://gecka.nc)) +- **Laurent Dinclaux** — Current maintainer ([Gecka](https://gecka.nc)) --- diff --git a/SQL/mysql/2016060200.sql b/SQL/mysql/2016060200.sql deleted file mode 100644 index 562f4ed..0000000 --- a/SQL/mysql/2016060200.sql +++ /dev/null @@ -1,5 +0,0 @@ -ALTER TABLE - `ident_switch` -MODIFY - `username` - varchar(64); diff --git a/SQL/mysql/2018071600.sql b/SQL/mysql/2018071600.sql deleted file mode 100644 index 3a4e396..0000000 --- a/SQL/mysql/2018071600.sql +++ /dev/null @@ -1,6 +0,0 @@ -ALTER TABLE - `ident_switch` -MODIFY - `username` - varchar(64) - NULL; diff --git a/SQL/mysql/2018121800.sql b/SQL/mysql/2018121800.sql deleted file mode 100644 index f920e1c..0000000 --- a/SQL/mysql/2018121800.sql +++ /dev/null @@ -1,29 +0,0 @@ -ALTER TABLE - `ident_switch` -CHANGE - `host` - `imap_host` varchar(64); - -ALTER TABLE - `ident_switch` -CHANGE - `port` - `imap_port` int; - -ALTER TABLE - `ident_switch` -ADD COLUMN - `smtp_host` - varchar(64); - -ALTER TABLE - `ident_switch` -ADD COLUMN - `smtp_port` - int - CHECK(`smtp_port` > 0 AND `smtp_port` <= 65535); - -ALTER TABLE - `ident_switch` -DROP COLUMN - `delimiter`; \ No newline at end of file diff --git a/SQL/mysql/2019112000.sql b/SQL/mysql/2019112000.sql deleted file mode 100644 index 3bfa1b4..0000000 --- a/SQL/mysql/2019112000.sql +++ /dev/null @@ -1,5 +0,0 @@ -ALTER TABLE - `ident_switch` -ADD COLUMN - `imap_delimiter` - char(1); \ No newline at end of file diff --git a/SQL/mysql/2019121300.sql b/SQL/mysql/2019121300.sql deleted file mode 100644 index 9ae8be2..0000000 --- a/SQL/mysql/2019121300.sql +++ /dev/null @@ -1,14 +0,0 @@ -ALTER TABLE - `ident_switch` -ADD COLUMN - `drafts_mbox` - varchar(64), -ADD COLUMN - `sent_mbox` - varchar(64), -ADD COLUMN - `junk_mbox` - varchar(64), -ADD COLUMN - `trash_mbox` - varchar(64); diff --git a/SQL/mysql/2020060100.sql b/SQL/mysql/2020060100.sql deleted file mode 100644 index 5a5f0c8..0000000 --- a/SQL/mysql/2020060100.sql +++ /dev/null @@ -1,7 +0,0 @@ -ALTER TABLE - `ident_switch` -ADD COLUMN - `smtp_auth` - smallint - NOT NULL - DEFAULT 1; diff --git a/SQL/postgres/2016052000.sql b/SQL/postgres/2016052000.sql deleted file mode 100644 index f58a85e..0000000 --- a/SQL/postgres/2016052000.sql +++ /dev/null @@ -1,11 +0,0 @@ -ALTER TABLE - ident_switch -ALTER COLUMN - host -DROP NOT NULL; - -ALTER TABLE - ident_switch -ALTER COLUMN - label -DROP NOT NULL; diff --git a/SQL/postgres/2016060200.sql b/SQL/postgres/2016060200.sql deleted file mode 100644 index 20fecd7..0000000 --- a/SQL/postgres/2016060200.sql +++ /dev/null @@ -1,5 +0,0 @@ -ALTER TABLE - ident_switch -ALTER COLUMN - username -DROP NOT NULL; diff --git a/SQL/postgres/2018081600.sql b/SQL/postgres/2018081600.sql deleted file mode 100644 index 20fecd7..0000000 --- a/SQL/postgres/2018081600.sql +++ /dev/null @@ -1,5 +0,0 @@ -ALTER TABLE - ident_switch -ALTER COLUMN - username -DROP NOT NULL; diff --git a/SQL/postgres/2018121800.sql b/SQL/postgres/2018121800.sql deleted file mode 100644 index 5086db4..0000000 --- a/SQL/postgres/2018121800.sql +++ /dev/null @@ -1,31 +0,0 @@ -ALTER TABLE - ident_switch -RENAME COLUMN - host -TO - imap_host; - -ALTER TABLE - ident_switch -RENAME COLUMN - port -TO - imap_port; - -ALTER TABLE - ident_switch -ADD COLUMN - smtp_host - varchar(64); - -ALTER TABLE - ident_switch -ADD COLUMN - smtp_port - integer - CHECK(smtp_port > 0 AND smtp_port <= 65535); - -ALTER TABLE - ident_switch -DROP COLUMN - delimiter; \ No newline at end of file diff --git a/SQL/postgres/2019112000.sql b/SQL/postgres/2019112000.sql deleted file mode 100644 index 2d3e4e1..0000000 --- a/SQL/postgres/2019112000.sql +++ /dev/null @@ -1,5 +0,0 @@ -ALTER TABLE - ident_switch -ADD COLUMN - imap_delimiter - char(1); \ No newline at end of file diff --git a/SQL/postgres/2019121300.sql b/SQL/postgres/2019121300.sql deleted file mode 100644 index 94a469d..0000000 --- a/SQL/postgres/2019121300.sql +++ /dev/null @@ -1,14 +0,0 @@ -ALTER TABLE - ident_switch -ADD COLUMN - drafts_mbox - varchar(64), -ADD COLUMN - sent_mbox - varchar(64), -ADD COLUMN - junk_mbox - varchar(64), -ADD COLUMN - trash_mbox - varchar(64); diff --git a/SQL/postgres/2020060100.sql b/SQL/postgres/2020060100.sql deleted file mode 100644 index 5a39afe..0000000 --- a/SQL/postgres/2020060100.sql +++ /dev/null @@ -1,7 +0,0 @@ -ALTER TABLE - ident_switch -ADD COLUMN - smtp_auth - smallint - NOT NULL - DEFAULT(1); diff --git a/SQL/sqlite/2018121800.sql b/SQL/sqlite/2018121800.sql deleted file mode 100644 index 2b897a7..0000000 --- a/SQL/sqlite/2018121800.sql +++ /dev/null @@ -1,76 +0,0 @@ -PRAGMA foreign_keys=off; -BEGIN TRANSACTION; - -ALTER TABLE ident_switch RENAME TO ident_switch_old; - -CREATE TABLE ident_switch -( - id - integer - PRIMARY KEY, - user_id - integer - NOT NULL - REFERENCES users(user_id) ON DELETE CASCADE ON UPDATE CASCADE, - iid - integer - NOT NULL - REFERENCES identities(identity_id) ON DELETE CASCADE ON UPDATE CASCADE - UNIQUE, - username - varchar(64), - password - varchar(64), - imap_host - varchar(64), - imap_port - integer - CHECK(imap_port > 0 AND imap_port <= 65535), - label - varchar(32), - flags - integer - NOT NULL - DEFAULT(0), - smtp_host - varchar(64), - smtp_port - integer - CHECK(smtp_port > 0 AND smtp_port <= 65535), - UNIQUE (user_id, label) -); -CREATE INDEX IX_ident_switch_user_id ON ident_switch(user_id); -CREATE INDEX IX_ident_switch_iid on ident_switch(iid); - -INSERT OR ROLLBACK INTO - ident_switch ( - id, - user_id, - iid, - username, - password, - imap_host, - imap_port, - label, - flags, - smtp_host - ) -SELECT - id, - user_id, - iid, - username, - password, - host, - port, - label, - flags, - host -FROM - ident_switch_old; - -DROP TABLE - ident_switch_old; - -COMMIT; -PRAGMA foreign_keys=on; \ No newline at end of file diff --git a/SQL/sqlite/2020121600.sql b/SQL/sqlite/2020121600.sql deleted file mode 100644 index f8a2380..0000000 --- a/SQL/sqlite/2020121600.sql +++ /dev/null @@ -1,92 +0,0 @@ -PRAGMA foreign_keys=off; -BEGIN TRANSACTION; - -ALTER TABLE ident_switch RENAME TO ident_switch_old; - -CREATE TABLE ident_switch -( - id - integer - PRIMARY KEY, - user_id - integer - NOT NULL - REFERENCES users(user_id) ON DELETE CASCADE ON UPDATE CASCADE, - iid - integer - NOT NULL - REFERENCES identities(identity_id) ON DELETE CASCADE ON UPDATE CASCADE - UNIQUE, - username - varchar(64), - password - varchar(64), - imap_host - varchar(64), - imap_port - integer - CHECK(imap_port > 0 AND imap_port <= 65535), - imap_delimiter - char(1), - label - varchar(32), - flags - integer - NOT NULL - DEFAULT(0), - smtp_host - varchar(64), - smtp_port - integer - CHECK(smtp_port > 0 AND smtp_port <= 65535), - smtp_auth - smallint - NOT NULL - DEFAULT 1, - drafts_mbox - varchar(64), - sent_mbox - varchar(64), - junk_mbox - varchar(64), - trash_mbox - varchar(64), - UNIQUE (user_id, label) -); -CREATE INDEX IX_ident_switch_user_id ON ident_switch(user_id); -CREATE INDEX IX_ident_switch_iid on ident_switch(iid); - -INSERT OR ROLLBACK INTO - ident_switch ( - id, - user_id, - iid, - username, - password, - imap_host, - imap_port, - label, - flags, - smtp_host, - smtp_port - ) -SELECT - id, - user_id, - iid, - username, - password, - imap_host, - imap_port, - label, - flags, - smtp_host, - smtp_port -FROM - ident_switch_old; - -DROP TABLE - ident_switch_old; - -COMMIT; -PRAGMA foreign_keys=on; \ No newline at end of file diff --git a/composer.json b/composer.json index de448b9..48b5180 100644 --- a/composer.json +++ b/composer.json @@ -2,7 +2,7 @@ "name": "gecka/roundcube-ident_switch", "type": "roundcube-plugin", "description": "This plugin allows users to switch between different accounts (including remote) in single Roundcube session.", - "homepage": "https://github.com/Gecka-apps/ident_switch", + "homepage": "https://github.com/Gecka-Apps/roundcube-ident_switch", "keywords": ["identity", "imap", "mail", "switch"], "license": "AGPL-3.0+", "authors": [ @@ -47,10 +47,11 @@ "toteph42/identity_switch": "*" }, "support": { - "issues": "https://github.com/Gecka-apps/ident_switch/issues" + "issues": "https://github.com/Gecka-Apps/roundcube-ident_switch/issues" }, "extra": { "roundcube": { + "plugin-name": "ident_switch", "min-version": "1.6", "sql-dir": "SQL" } diff --git a/ident_switch-switch.js b/ident_switch-switch.js index 95545dc..e19a70d 100644 --- a/ident_switch-switch.js +++ b/ident_switch-switch.js @@ -122,7 +122,11 @@ function plugin_switchIdent_addCbElastic($wrapper, $sw) { /** * Perform account switch via AJAX (called from