From 9271611c189a3ed4129d3b98422f86ab3f774f10 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Isma=C3=ABl=20Bouya?= Date: Tue, 5 May 2020 12:54:06 +0200 Subject: [PATCH] Upgrade roundcube --- .../monitoring/objects_monitoring-1.nix | 2 +- modules/private/websites/default.nix | 13 ++ pkgs/dovecot/plugins/fts_xapian/default.nix | 4 +- .../plugins/fts_xapian/fts-xapian.json | 6 +- pkgs/webapps/roundcubemail/add_all.patch | 209 ++++++++++++++++++ pkgs/webapps/roundcubemail/default.nix | 15 +- .../plugins/contextmenu/default.nix | 4 +- .../plugins/html5_notifier/default.nix | 4 +- .../plugins/ident_switch/default.nix | 4 +- .../plugins/thunderbird_labels/default.nix | 4 +- 10 files changed, 248 insertions(+), 17 deletions(-) create mode 100644 pkgs/webapps/roundcubemail/add_all.patch diff --git a/modules/private/monitoring/objects_monitoring-1.nix b/modules/private/monitoring/objects_monitoring-1.nix index 741860a..46916f4 100644 --- a/modules/private/monitoring/objects_monitoring-1.nix +++ b/modules/private/monitoring/objects_monitoring-1.nix @@ -418,7 +418,7 @@ service_description = "roundcube website is running on mail.immae.eu"; host_name = "eldiron.immae.eu"; use = "external-web-service"; - check_command = ["check_https_code" "mail.immae.eu" "/roundcube/" "401" "Roundcube"]; + check_command = ["check_https" "mail.immae.eu" "/roundcube/" "<title>Roundcube"]; servicegroups = "webstatus-webapps,webstatus-email"; _webstatus_name = "Roundcube"; diff --git a/modules/private/websites/default.nix b/modules/private/websites/default.nix index aba30e3..a3dcbb9 100644 --- a/modules/private/websites/default.nix +++ b/modules/private/websites/default.nix @@ -3,6 +3,19 @@ let www_root = "/run/current-system/webapps/_www"; theme_root = "/run/current-system/webapps/_theme"; apacheConfig = { + cache = { + # This setting permits to ignore time-based cache for files in the + # nix store: + # If a client requires an If-Modified-Since from timestamp 1, then + # this header is removed, and if the response contains a + # too old Last-Modified tag, then it is removed too + extraConfig = '' + <If "%{HTTP:If-Modified-Since} =~ /01 Jan 1970 00:00:01/" > + RequestHeader unset If-Modified-Since + </If> + Header unset Last-Modified "expr=%{LAST_MODIFIED} < 19991231235959" + ''; + }; gzip = { modules = [ "deflate" "filter" ]; extraConfig = '' diff --git a/pkgs/dovecot/plugins/fts_xapian/default.nix b/pkgs/dovecot/plugins/fts_xapian/default.nix index 350a3ff..611d67b 100644 --- a/pkgs/dovecot/plugins/fts_xapian/default.nix +++ b/pkgs/dovecot/plugins/fts_xapian/default.nix @@ -1,7 +1,7 @@ -{ stdenv, autoconf, automake, pkg-config, dovecot, libtool, xapian, icu, mylibs }: +{ stdenv, autoconf, automake, pkg-config, dovecot, libtool, xapian, icu, mylibs, sqlite }: stdenv.mkDerivation (mylibs.fetchedGithub ./fts-xapian.json // rec { - buildInputs = [ dovecot autoconf automake libtool pkg-config xapian icu ]; + buildInputs = [ dovecot autoconf automake libtool pkg-config xapian icu sqlite ]; preConfigure = '' export PANDOC=false autoreconf -vi diff --git a/pkgs/dovecot/plugins/fts_xapian/fts-xapian.json b/pkgs/dovecot/plugins/fts_xapian/fts-xapian.json index a786776..c9b57ef 100644 --- a/pkgs/dovecot/plugins/fts_xapian/fts-xapian.json +++ b/pkgs/dovecot/plugins/fts_xapian/fts-xapian.json @@ -1,5 +1,5 @@ { - "tag": "9a94b4a-master", + "tag": "ac872e9-master", "meta": { "name": "fts-xapian", "url": "https://github.com/grosjo/fts-xapian", @@ -8,8 +8,8 @@ "github": { "owner": "grosjo", "repo": "fts-xapian", - "rev": "9a94b4aeaac3988786ad72a716127c306b05c9d6", - "sha256": "12xv5fnqahs0cy26ja2jwk6dg95626amblisf2wcx3nqzkcf4w1y", + "rev": "ac872e927c982e8da6d4eb80fa27fee53962010b", + "sha256": "13pw123006yyx2m2zy3bdffglhd5923gnqjlcc868xy344fjkbmz", "fetchSubmodules": true } } diff --git a/pkgs/webapps/roundcubemail/add_all.patch b/pkgs/webapps/roundcubemail/add_all.patch new file mode 100644 index 0000000..ba651e2 --- /dev/null +++ b/pkgs/webapps/roundcubemail/add_all.patch @@ -0,0 +1,209 @@ +diff --git a/program/include/rcmail_output_html.php b/program/include/rcmail_output_html.php +index 0552b89c2..1b84e1b4e 100644 +--- a/program/include/rcmail_output_html.php ++++ b/program/include/rcmail_output_html.php +@@ -1013,13 +1013,13 @@ EOF; + // use minified file if exists (not in development mode) + if (!$this->devel_mode && !preg_match('/\.min\.' . $ext . '$/', $file)) { + $minified_file = substr($file, 0, strlen($ext) * -1) . 'min.' . $ext; +- if ($fs = @filemtime($this->assets_dir . $minified_file)) { +- return $minified_file . '?s=' . $fs; ++ if ($fs = @md5_file($this->assets_dir . $minified_file)) { ++ return $minified_file . '?s=' . substr($fs, 0, 6); + } + } + +- if ($fs = @filemtime($this->assets_dir . $file)) { +- $file .= '?s=' . $fs; ++ if ($fs = @md5_file($this->assets_dir . $file)) { ++ $file .= '?s=' . substr($fs, 0, 6); + } + + return $file; +diff --git a/program/js/app.js b/program/js/app.js +index 2094b7b7b..06fe96a80 100644 +--- a/program/js/app.js ++++ b/program/js/app.js +@@ -2277,6 +2277,9 @@ function rcube_webmail() + } + + tree += '<span id="msgicn'+row.id+'" class="'+css_class+status_class+'" title="'+status_label+'"></span>'; ++ if (flags.mbox != this.env.mailbox) { ++ tree += '<span style="color:#737677">' + flags.mbox + ' <span>'; ++ } + row.className = row_class; + + // build subject link +diff --git a/program/localization/en_CA/labels.inc b/program/localization/en_CA/labels.inc +index 03c1c8e11..8d67a49ac 100644 +--- a/program/localization/en_CA/labels.inc ++++ b/program/localization/en_CA/labels.inc +@@ -128,6 +128,7 @@ $labels['markunread'] = 'As unread'; + $labels['markflagged'] = 'As flagged'; + $labels['markunflagged'] = 'As unflagged'; + $labels['moreactions'] = 'More actions...'; ++$labels['folders-allsubscribed'] = 'All subscribed folders'; + $labels['folders-all'] = 'All folders'; + $labels['more'] = 'More'; + $labels['back'] = 'Back'; +@@ -184,6 +185,7 @@ $labels['namex'] = 'Name'; + $labels['searchscope'] = 'Scope'; + $labels['currentfolder'] = 'Current folder'; + $labels['subfolders'] = 'This and subfolders'; ++$labels['allsubscribedfolders'] = 'All subscribed folders'; + $labels['allfolders'] = 'All folders'; + $labels['openinextwin'] = 'Open in new window'; + $labels['emlsave'] = 'Download (.eml)'; +diff --git a/program/localization/en_GB/labels.inc b/program/localization/en_GB/labels.inc +index a442965de..b5b4839e3 100644 +--- a/program/localization/en_GB/labels.inc ++++ b/program/localization/en_GB/labels.inc +@@ -135,6 +135,7 @@ $labels['moreactions'] = 'More actions...'; + $labels['markallread'] = 'Mark all as read'; + $labels['folders-cur'] = 'Selected folder only'; + $labels['folders-sub'] = 'Selected folder and its subfolders'; ++$labels['folders-allsubscribed'] = 'All subscribed folders'; + $labels['folders-all'] = 'All folders'; + $labels['more'] = 'More'; + $labels['back'] = 'Back'; +@@ -221,6 +222,7 @@ $labels['namex'] = 'Name'; + $labels['searchscope'] = 'Scope'; + $labels['currentfolder'] = 'Current folder'; + $labels['subfolders'] = 'This and subfolders'; ++$labels['allsubscribedfolders'] = 'All subscribed folders'; + $labels['allfolders'] = 'All folders'; + $labels['searchinterval-1W'] = 'older than a week'; + $labels['searchinterval-1M'] = 'older than a month'; +diff --git a/program/localization/en_US/labels.inc b/program/localization/en_US/labels.inc +index 2e8ec8009..c7736557f 100644 +--- a/program/localization/en_US/labels.inc ++++ b/program/localization/en_US/labels.inc +@@ -158,6 +158,7 @@ $labels['moreactions'] = 'More actions...'; + $labels['markallread'] = 'Mark all as read'; + $labels['folders-cur'] = 'Selected folder only'; + $labels['folders-sub'] = 'Selected folder and its subfolders'; ++$labels['folders-allsubscribed'] = 'All subscribed folders'; + $labels['folders-all'] = 'All folders'; + $labels['more'] = 'More'; + $labels['back'] = 'Back'; +@@ -249,6 +250,7 @@ $labels['namex'] = 'Name'; + $labels['searchscope'] = 'Scope'; + $labels['currentfolder'] = 'Current folder'; + $labels['subfolders'] = 'This and subfolders'; ++$labels['allsubscribedfolders'] = 'All subscribed folders'; + $labels['allfolders'] = 'All folders'; + $labels['searchinterval-1W'] = 'older than a week'; + $labels['searchinterval-1M'] = 'older than a month'; +diff --git a/program/localization/fr_FR/labels.inc b/program/localization/fr_FR/labels.inc +index 6db44f95c..ad83e15d8 100644 +--- a/program/localization/fr_FR/labels.inc ++++ b/program/localization/fr_FR/labels.inc +@@ -135,6 +135,7 @@ $labels['moreactions'] = 'Plus d’actions…'; + $labels['markallread'] = 'Tout marquer comme lu'; + $labels['folders-cur'] = 'Dossier sélectionné seulement'; + $labels['folders-sub'] = 'Dossier sélectionné et ses sous-dossiers'; ++$labels['folders-allsubscribed'] = 'Tous les dossiers souscrits'; + $labels['folders-all'] = 'Tous les dossiers'; + $labels['more'] = 'Plus'; + $labels['back'] = 'Retour'; +@@ -221,6 +222,7 @@ $labels['namex'] = 'Nom'; + $labels['searchscope'] = 'Portée'; + $labels['currentfolder'] = 'Répertoire actuel'; + $labels['subfolders'] = 'Ceci et les sous-dossiers'; ++$labels['allsubscribedfolders'] = 'Tous les dossiers souscrits'; + $labels['allfolders'] = 'Tous les dossiers'; + $labels['searchinterval-1W'] = 'plus d’une semaine'; + $labels['searchinterval-1M'] = 'plus d’un mois'; +diff --git a/program/steps/mail/func.inc b/program/steps/mail/func.inc +index 8e0c642f6..ac79780e0 100644 +--- a/program/steps/mail/func.inc ++++ b/program/steps/mail/func.inc +@@ -110,8 +110,8 @@ if (empty($RCMAIL->action) || $RCMAIL->action == 'list') { + 'copy', 'move', 'quota', 'replyall', 'replylist', 'stillsearching', + 'flagged', 'unflagged', 'unread', 'deleted', 'replied', 'forwarded', + 'priority', 'withattachment', 'fileuploaderror', 'mark', 'markallread', +- 'folders-cur', 'folders-sub', 'folders-all', 'cancel', 'bounce', 'bouncemsg', +- 'sendingmessage'); ++ 'folders-cur', 'folders-sub', 'folders-allsubscribed', 'folder-all', ++ 'cancel', 'bounce', 'bouncemsg', 'sendingmessage'); + } + } + +diff --git a/program/steps/mail/search.inc b/program/steps/mail/search.inc +index f60528835..836a715b0 100644 +--- a/program/steps/mail/search.inc ++++ b/program/steps/mail/search.inc +@@ -86,7 +86,7 @@ else if (strlen(trim($str))) { + } + + // save search modifiers for the current folder to user prefs +- $mkey = $scope == 'all' ? '*' : $mbox; ++ $mkey = ($scope == 'all' || $scope == 'allsubscribed') ? '*' : $mbox; + $search_mods = rcmail_search_mods(); + $search_mods[$mkey] = array_fill_keys(array_keys($subject), 1); + +@@ -124,6 +124,10 @@ if (!empty($continue) && isset($_SESSION['search']) && $_SESSION['search_request + if ($search_str) { + // search all, current or subfolders folders + if ($scope == 'all') { ++ $mboxes = $RCMAIL->storage->list_folders('', '*', 'mail', null, true); ++ natcasesort($mboxes); // we want natural alphabetic sorting of folders in the result set ++ } ++ else if ($scope == 'allsubscribed') { + $mboxes = $RCMAIL->storage->list_folders_subscribed('', '*', 'mail', null, true); + natcasesort($mboxes); // we want natural alphabetic sorting of folders in the result set + } +@@ -133,7 +137,7 @@ if ($search_str) { + array_unshift($mboxes, $mbox); + } + +- if ($scope != 'all') { ++ if ($scope != 'all' && $scope != 'allsubscribed') { + // Remember current folder, it can change in meantime (plugins) + // but we need it to e.g. recognize Sent folder to handle From/To column later + $RCMAIL->output->set_env('mailbox', $mbox); +@@ -194,7 +198,7 @@ else { + $count = 0; + $OUTPUT->show_message('searchnomatch', 'notice'); + $OUTPUT->set_env('multifolder_listing', (bool)$result->multi); +- if ($result->multi && $scope == 'all') { ++ if ($result->multi && ($scope == 'all' || $scope == 'allsubscribed')) { + $OUTPUT->command('select_folder', ''); + } + } +diff --git a/skins/classic/templates/mail.html b/skins/classic/templates/mail.html +index 666adf606..23d12a275 100644 +--- a/skins/classic/templates/mail.html ++++ b/skins/classic/templates/mail.html +@@ -106,6 +106,7 @@ + <li><label class="comment"><roundcube:label name="searchscope" /></label></li> + <li><label><input type="radio" name="s_scope" value="base" id="s_scope_base" onclick="rcmail.set_searchscope(this.value)" /> <span><roundcube:label name="currentfolder" /></span></label></li> + <li><label><input type="radio" name="s_scope" value="sub" id="s_scope_sub" onclick="rcmail.set_searchscope(this.value)" /> <span><roundcube:label name="subfolders" /></span></label></li> ++ <li><label><input type="radio" name="s_scope" value="allsubscribed" id="s_scope_allsubscribed" onclick="rcmail.set_searchscope(this.value)" /> <span><roundcube:label name="allsubscribedfolders" /></span></label></li> + <li><label><input type="radio" name="s_scope" value="all" id="s_scope_all" onclick="rcmail.set_searchscope(this.value)" /> <span><roundcube:label name="allfolders" /></span></label></li> + </ul> + </div> +diff --git a/skins/elastic/templates/mail.html b/skins/elastic/templates/mail.html +index 51dbfcd30..4c2281281 100644 +--- a/skins/elastic/templates/mail.html ++++ b/skins/elastic/templates/mail.html +@@ -77,6 +77,7 @@ + <select name="s_scope" id="s_scope"> + <option value="base"><roundcube:label name="currentfolder" /></option> + <option value="sub"><roundcube:label name="subfolders" /></option> ++ <option value="allsubscribed"><roundcube:label name="allsubscribedfolders" /></option> + <option value="all"><roundcube:label name="allfolders" /></option> + </select> + </div> +diff --git a/skins/larry/templates/mail.html b/skins/larry/templates/mail.html +index 5ef0bc211..e0e8280ad 100644 +--- a/skins/larry/templates/mail.html ++++ b/skins/larry/templates/mail.html +@@ -56,6 +56,7 @@ + <li role="separator" class="separator"><label><roundcube:label name="searchscope" /></label></li> + <li role="menuitem"><label><input type="radio" name="s_scope" value="base" id="s_scope_base" onclick="UI.set_searchscope(this)" /> <span><roundcube:label name="currentfolder" /></span></label></li> + <li role="menuitem"><label><input type="radio" name="s_scope" value="sub" id="s_scope_sub" onclick="UI.set_searchscope(this)" /> <span><roundcube:label name="subfolders" /></span></label></li> ++ <li role="menuitem"><label><input type="radio" name="s_scope" value="allsubscribed" id="s_scope_allsubscribed" onclick="UI.set_searchscope(this)" /> <span><roundcube:label name="allsubscribedfolders" /></span></label></li> + <li role="menuitem"><label><input type="radio" name="s_scope" value="all" id="s_scope_all" onclick="UI.set_searchscope(this)" /> <span><roundcube:label name="allfolders" /></span></label></li> + </ul> + <div class="buttons"><a class="button" href="#" onclick="if (rcmail.command('search')) UI.show_popup('searchmenu',false)"><roundcube:label name="search" /></a></div> diff --git a/pkgs/webapps/roundcubemail/default.nix b/pkgs/webapps/roundcubemail/default.nix index ba85f37..4f288b8 100644 --- a/pkgs/webapps/roundcubemail/default.nix +++ b/pkgs/webapps/roundcubemail/default.nix @@ -1,6 +1,6 @@ { varDir ? "/var/lib/roundcubemail" , roundcube_config ? "/etc/roundcube/config.php" -, stdenv, fetchurl }: +, stdenv, fetchurl, jre, unzip }: let defaultInstall = '' mkdir -p $out @@ -33,14 +33,23 @@ let withPlugins = morePlugins: moreSkins: old.withPlugins (morePlugins ++ plugins) (morePlugins ++ skins); }; }); + shrinker = fetchurl { + url = "http://dl.google.com/closure-compiler/compiler-latest.zip"; + sha256 = "0naf3kflhlkm17ls1x7mgddd3b01f8yzbbbdjqwy5m12jmkzl2d5"; + }; package = stdenv.mkDerivation rec { - version = "1.4-rc1"; + version = "1.4.4"; name = "roundcubemail-${version}"; src= fetchurl { url = "https://github.com/roundcube/roundcubemail/releases/download/${version}/${name}-complete.tar.gz"; - sha256 = "0p18wffwi2prh6vxhx1bc69qd1vwybggm8gvg3shahfdknxci9i4"; + sha256 = "1my726p0wmsn21nbdsjx02h6hnbh8nidzipzdy0gk0qgda1j729b"; }; + patches = [ ./add_all.patch ]; # This patch includes js modification which requires to re-run the jsshrink below + buildInputs = [ unzip jre ]; buildPhase = '' + mkdir -p /tmp + unzip -p "${shrinker}" "*.jar" > "/tmp/compiler.jar" + ./bin/jsshrink.sh sed -i \ -e "s|RCUBE_INSTALL_PATH . 'temp.*|'${varDir}/cache';|" \ config/defaults.inc.php diff --git a/pkgs/webapps/roundcubemail/plugins/contextmenu/default.nix b/pkgs/webapps/roundcubemail/plugins/contextmenu/default.nix index c970007..34a43a7 100644 --- a/pkgs/webapps/roundcubemail/plugins/contextmenu/default.nix +++ b/pkgs/webapps/roundcubemail/plugins/contextmenu/default.nix @@ -1,7 +1,7 @@ { buildPlugin }: buildPlugin rec { appName = "contextmenu"; - version = "2.3"; + version = "3.2"; url = "https://github.com/johndoh/roundcube-${appName}/archive/${version}.tar.gz"; - sha256 = "1rb8n821ylfniiiccfskc534vd6rczhk3g82455ks3m09q6l8hif"; + sha256 = "1j7qns42bvgwav8d5n8g16iajyrhydd76hgil8625f3xyjbv4mx0"; } diff --git a/pkgs/webapps/roundcubemail/plugins/html5_notifier/default.nix b/pkgs/webapps/roundcubemail/plugins/html5_notifier/default.nix index 35bff06..a5788b3 100644 --- a/pkgs/webapps/roundcubemail/plugins/html5_notifier/default.nix +++ b/pkgs/webapps/roundcubemail/plugins/html5_notifier/default.nix @@ -1,7 +1,7 @@ { buildPlugin }: buildPlugin rec { appName = "html5_notifier"; - version = "v0.6.2"; + version = "v0.6.4"; url = "https://github.com/stremlau/${appName}/archive/${version}.tar.gz"; - sha256 = "0s1wq9ira4bcd8jvhn93nhxiqzpp92i0za2kw37kf7ksyhr0xslq"; + sha256 = "1w6xkffgxwbahi7acixdh5sgjvsjlfwdq942gkvc64byk8r3bhsj"; } diff --git a/pkgs/webapps/roundcubemail/plugins/ident_switch/default.nix b/pkgs/webapps/roundcubemail/plugins/ident_switch/default.nix index 1dfc402..3e10fee 100644 --- a/pkgs/webapps/roundcubemail/plugins/ident_switch/default.nix +++ b/pkgs/webapps/roundcubemail/plugins/ident_switch/default.nix @@ -1,7 +1,7 @@ { buildPlugin }: buildPlugin rec { appName = "ident_switch"; - version = "4.0.1"; + version = "4.2"; url = "https://bitbucket.org/BoresExpress/${appName}/get/${version}.tar.gz"; - sha256 = "1zyy40lfq2kn7hkghbl8lgp18fb634zr4fxmmxvb1wqyvqdpdpyk"; + sha256 = "0rf2krjsnly4i0mzgsbx09xckr3p9a9dzxf8qq4lkyng1a7dvjkq"; } diff --git a/pkgs/webapps/roundcubemail/plugins/thunderbird_labels/default.nix b/pkgs/webapps/roundcubemail/plugins/thunderbird_labels/default.nix index ca7245f..b67f16a 100644 --- a/pkgs/webapps/roundcubemail/plugins/thunderbird_labels/default.nix +++ b/pkgs/webapps/roundcubemail/plugins/thunderbird_labels/default.nix @@ -1,7 +1,7 @@ { buildPlugin }: buildPlugin rec { appName = "thunderbird_labels"; - version = "v1.3.2"; + version = "v1.4.2"; url = "https://github.com/mike-kfed/roundcube-${appName}/archive/${version}.tar.gz"; - sha256 = "1q4x30w66m02v3lw2n8020g0158rmyfzs6gydfk89pa1hs28k9bg"; + sha256 = "00dqqlq6m8a6dwynp6gwfimc10anbs8kh0qdy8xvq2l06hk6jxyc"; } -- 2.41.0