script: add option script.scripts.url_force_https (closes #253)

This commit is contained in:
Sébastien Helleu 2014-11-15 18:28:34 +01:00
parent bc3c81ee4f
commit 786999b4a3
25 changed files with 4477 additions and 1457 deletions

View File

@ -41,6 +41,7 @@ http://weechat.org/files/releasenotes/ReleaseNotes-devel.html[release notes]
* relay: add options "stop" and "restart" in command /relay
* relay: add option relay.network.ssl_priorities (closes #234)
* relay: add host in sender for IRC backlog PRIVMSG messages sent to clients
* script: add option script.scripts.url_force_https (closes #253)
* trigger: evaluate and replace regex groups at same time, new format for regex
option in triggers (incompatible with version 1.0) (closes #224)
* trigger: add `${tg_displayed}` in conditions of default trigger "beep"

View File

@ -193,3 +193,8 @@
** Typ: Zeichenkette
** Werte: beliebige Zeichenkette (Standardwert: `"http://weechat.org/files/plugins.xml.gz"`)
* [[option_script.scripts.url_force_https]] *script.scripts.url_force_https*
** Beschreibung: `force use of HTTPS for downloads (index and scripts); you should disable this option only if you have problems with the downloads`
** Typ: boolesch
** Werte: on, off (Standardwert: `on`)

View File

@ -193,3 +193,8 @@
** type: string
** values: any string (default value: `"http://weechat.org/files/plugins.xml.gz"`)
* [[option_script.scripts.url_force_https]] *script.scripts.url_force_https*
** description: `force use of HTTPS for downloads (index and scripts); you should disable this option only if you have problems with the downloads`
** type: boolean
** values: on, off (default value: `on`)

View File

@ -193,3 +193,8 @@
** type: chaîne
** valeurs: toute chaîne (valeur par défaut: `"http://weechat.org/files/plugins.xml.gz"`)
* [[option_script.scripts.url_force_https]] *script.scripts.url_force_https*
** description: `forcer l'utilisation de HTTPS pour les téléchargements (index et scripts) ; vous ne devriez désactiver cette option que si vous avez des problèmes avec les téléchargements`
** type: booléen
** valeurs: on, off (valeur par défaut: `on`)

View File

@ -193,3 +193,8 @@
** tipo: stringa
** valori: qualsiasi stringa (valore predefinito: `"http://weechat.org/files/plugins.xml.gz"`)
* [[option_script.scripts.url_force_https]] *script.scripts.url_force_https*
** descrizione: `force use of HTTPS for downloads (index and scripts); you should disable this option only if you have problems with the downloads`
** tipo: bool
** valori: on, off (valore predefinito: `on`)

View File

@ -193,3 +193,8 @@
** タイプ: 文字列
** 値: 未制約文字列 (デフォルト値: `"http://weechat.org/files/plugins.xml.gz"`)
* [[option_script.scripts.url_force_https]] *script.scripts.url_force_https*
** 説明: `force use of HTTPS for downloads (index and scripts); you should disable this option only if you have problems with the downloads`
** タイプ: ブール
** 値: on, off (デフォルト値: `on`)

View File

@ -193,3 +193,8 @@
** typ: ciąg
** wartości: dowolny ciąg (domyślna wartość: `"http://weechat.org/files/plugins.xml.gz"`)
* [[option_script.scripts.url_force_https]] *script.scripts.url_force_https*
** opis: `force use of HTTPS for downloads (index and scripts); you should disable this option only if you have problems with the downloads`
** typ: bool
** wartości: on, off (domyślna wartość: `on`)

View File

@ -20,7 +20,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2014-11-11 10:02+0100\n"
"POT-Creation-Date: 2014-11-15 18:20+0100\n"
"PO-Revision-Date: 2014-11-09 16:23+0100\n"
"Last-Translator: Jiri Golembiovsky <golemj@gmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@ -9953,6 +9953,11 @@ msgstr ""
msgid "URL for file with list of scripts"
msgstr "seznam skriptů"
msgid ""
"force use of HTTPS for downloads (index and scripts); you should disable "
"this option only if you have problems with the downloads"
msgstr ""
#, fuzzy
msgid "script name with extension (wildcard \"*\" is allowed) (optional)"
msgstr ""

5752
po/de.po

File diff suppressed because it is too large Load Diff

View File

@ -22,7 +22,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2014-11-11 10:02+0100\n"
"POT-Creation-Date: 2014-11-15 18:20+0100\n"
"PO-Revision-Date: 2014-11-09 16:23+0100\n"
"Last-Translator: Elián Hanisch <lambdae2@gmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@ -10237,6 +10237,11 @@ msgstr ""
msgid "URL for file with list of scripts"
msgstr "URL del archivo con la lista de scripts"
msgid ""
"force use of HTTPS for downloads (index and scripts); you should disable "
"this option only if you have problems with the downloads"
msgstr ""
#, fuzzy
msgid "script name with extension (wildcard \"*\" is allowed) (optional)"
msgstr ""

View File

@ -21,8 +21,8 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2014-11-11 10:02+0100\n"
"PO-Revision-Date: 2014-11-11 10:03+0100\n"
"POT-Creation-Date: 2014-11-15 18:20+0100\n"
"PO-Revision-Date: 2014-11-15 18:20+0100\n"
"Last-Translator: Sébastien Helleu <flashcode@flashtux.org>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
"Language: fr\n"
@ -10986,6 +10986,14 @@ msgstr ""
msgid "URL for file with list of scripts"
msgstr "URL pour le fichier avec la liste des scripts"
msgid ""
"force use of HTTPS for downloads (index and scripts); you should disable "
"this option only if you have problems with the downloads"
msgstr ""
"forcer l'utilisation de HTTPS pour les téléchargements (index et scripts) ; "
"vous ne devriez désactiver cette option que si vous avez des problèmes avec "
"les téléchargements"
msgid "script name with extension (wildcard \"*\" is allowed) (optional)"
msgstr ""
"nom du script avec extension (le caractère joker \"*\" est autorisé) "

View File

@ -20,7 +20,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2014-11-11 10:02+0100\n"
"POT-Creation-Date: 2014-11-15 18:20+0100\n"
"PO-Revision-Date: 2014-11-09 16:23+0100\n"
"Last-Translator: Andras Voroskoi <voroskoi@frugalware.org>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@ -9325,6 +9325,11 @@ msgstr ""
msgid "URL for file with list of scripts"
msgstr "Aliaszok listája:\n"
msgid ""
"force use of HTTPS for downloads (index and scripts); you should disable "
"this option only if you have problems with the downloads"
msgstr ""
msgid "script name with extension (wildcard \"*\" is allowed) (optional)"
msgstr ""

View File

@ -20,7 +20,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2014-11-11 10:02+0100\n"
"POT-Creation-Date: 2014-11-15 18:20+0100\n"
"PO-Revision-Date: 2014-11-09 16:23+0100\n"
"Last-Translator: Esteban I. Ruiz Moreno <exio4.com@gmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@ -10415,6 +10415,11 @@ msgstr ""
msgid "URL for file with list of scripts"
msgstr "URL per il file con l'elenco degli script"
msgid ""
"force use of HTTPS for downloads (index and scripts); you should disable "
"this option only if you have problems with the downloads"
msgstr ""
#, fuzzy
msgid "script name with extension (wildcard \"*\" is allowed) (optional)"
msgstr ""

View File

@ -20,7 +20,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2014-11-11 10:02+0100\n"
"POT-Creation-Date: 2014-11-15 18:20+0100\n"
"PO-Revision-Date: 2014-11-10 06:29+0900\n"
"Last-Translator: AYANOKOUZI, Ryuunosuke <i38w7i3@yahoo.co.jp>\n"
"Language-Team: Japanese <https://github.com/l/weechat/tree/translation_ja>\n"
@ -10577,6 +10577,11 @@ msgstr ""
msgid "URL for file with list of scripts"
msgstr "ファイルの URL とスクリプトのリスト"
msgid ""
"force use of HTTPS for downloads (index and scripts); you should disable "
"this option only if you have problems with the downloads"
msgstr ""
msgid "script name with extension (wildcard \"*\" is allowed) (optional)"
msgstr ""
"拡張子を含めたスクリプト名 (ワイルドカード \"*\" を使うことができます) (任意)"

View File

@ -21,7 +21,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2014-11-11 10:02+0100\n"
"POT-Creation-Date: 2014-11-15 18:20+0100\n"
"PO-Revision-Date: 2014-11-09 16:23+0100\n"
"Last-Translator: Krzysztof Korościk <soltys@szluug.org>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@ -10759,6 +10759,11 @@ msgstr ""
msgid "URL for file with list of scripts"
msgstr "adres URL pliku z lista skryptów"
msgid ""
"force use of HTTPS for downloads (index and scripts); you should disable "
"this option only if you have problems with the downloads"
msgstr ""
msgid "script name with extension (wildcard \"*\" is allowed) (optional)"
msgstr ""
"nazwa skryptu z rozszerzeniem (wildcard \"*\" jest dozwolony) (opcjonalne)\""

View File

@ -21,7 +21,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2014-11-11 10:02+0100\n"
"POT-Creation-Date: 2014-11-15 18:20+0100\n"
"PO-Revision-Date: 2014-11-09 16:23+0100\n"
"Last-Translator: Sergio Durigan Junior <sergiosdj@gmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@ -9601,6 +9601,11 @@ msgstr ""
msgid "URL for file with list of scripts"
msgstr "list de scripts"
msgid ""
"force use of HTTPS for downloads (index and scripts); you should disable "
"this option only if you have problems with the downloads"
msgstr ""
#, fuzzy
msgid "script name with extension (wildcard \"*\" is allowed) (optional)"
msgstr ""

View File

@ -21,7 +21,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2014-11-11 10:02+0100\n"
"POT-Creation-Date: 2014-11-15 18:20+0100\n"
"PO-Revision-Date: 2014-11-09 16:23+0100\n"
"Last-Translator: Aleksey V Zapparov AKA ixti <ixti@member.fsf.org>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@ -9351,6 +9351,11 @@ msgstr ""
msgid "URL for file with list of scripts"
msgstr "Список сокращений:\n"
msgid ""
"force use of HTTPS for downloads (index and scripts); you should disable "
"this option only if you have problems with the downloads"
msgstr ""
msgid "script name with extension (wildcard \"*\" is allowed) (optional)"
msgstr ""

View File

@ -20,7 +20,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2014-11-11 10:02+0100\n"
"POT-Creation-Date: 2014-11-15 18:20+0100\n"
"PO-Revision-Date: 2014-07-25 07:50+0200\n"
"Last-Translator: Hasan Kiran <sunder67@hotmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@ -8423,6 +8423,11 @@ msgstr ""
msgid "URL for file with list of scripts"
msgstr ""
msgid ""
"force use of HTTPS for downloads (index and scripts); you should disable "
"this option only if you have problems with the downloads"
msgstr ""
msgid "script name with extension (wildcard \"*\" is allowed) (optional)"
msgstr ""

View File

@ -21,7 +21,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2014-11-11 10:02+0100\n"
"POT-Creation-Date: 2014-11-15 18:20+0100\n"
"PO-Revision-Date: 2014-08-16 10:27+0200\n"
"Last-Translator: Sébastien Helleu <flashcode@flashtux.org>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@ -8354,6 +8354,11 @@ msgstr ""
msgid "URL for file with list of scripts"
msgstr ""
msgid ""
"force use of HTTPS for downloads (index and scripts); you should disable "
"this option only if you have problems with the downloads"
msgstr ""
msgid "script name with extension (wildcard \"*\" is allowed) (optional)"
msgstr ""

View File

@ -600,7 +600,6 @@ script_action_install (int quiet)
{
struct t_script_repo *ptr_script_to_install;
char *filename, *url;
int length;
struct t_hashtable *options;
while (1)
@ -638,8 +637,7 @@ script_action_install (int quiet)
NULL);
if (options)
{
length = 4 + strlen (ptr_script_to_install->url) + 1;
url = malloc (length);
url = script_build_download_url (ptr_script_to_install->url);
if (url)
{
if (!weechat_config_boolean (script_config_look_quiet_actions))
@ -649,9 +647,6 @@ script_action_install (int quiet)
SCRIPT_PLUGIN_NAME,
ptr_script_to_install->name_with_extension);
}
snprintf (url, length, "url:%s",
ptr_script_to_install->url);
weechat_hashtable_set (options, "file_out", filename);
weechat_hook_process_hashtable (url, options, 30000,
&script_action_install_process_cb,
@ -1031,7 +1026,6 @@ script_action_show (const char *name, int quiet)
{
struct t_script_repo *ptr_script;
char *filename, *url;
int length;
struct t_hashtable *options;
if (name)
@ -1069,11 +1063,9 @@ script_action_show (const char *name, int quiet)
NULL);
if (options)
{
length = 4 + strlen (ptr_script->url) + 1;
url = malloc (length);
url = script_build_download_url (ptr_script->url);
if (url)
{
snprintf (url, length, "url:%s", ptr_script->url);
weechat_hashtable_set (options, "file_out", filename);
weechat_hook_process_hashtable (url, options, 30000,
&script_action_show_source_process_cb,

View File

@ -85,6 +85,7 @@ struct t_config_option *script_config_scripts_cache_expire;
struct t_config_option *script_config_scripts_dir;
struct t_config_option *script_config_scripts_hold;
struct t_config_option *script_config_scripts_url;
struct t_config_option *script_config_scripts_url_force_https;
/*
@ -705,6 +706,14 @@ script_config_init ()
N_("URL for file with list of scripts"),
NULL, 0, 0, "http://weechat.org/files/plugins.xml.gz", NULL, 0, NULL, NULL,
NULL, NULL, NULL, NULL);
script_config_scripts_url_force_https = weechat_config_new_option (
script_config_file, ptr_section,
"url_force_https", "boolean",
N_("force use of HTTPS for downloads (index and scripts); "
"you should disable this option only if you have problems with "
"the downloads"),
NULL, 0, 0, "on", NULL, 0, NULL, NULL,
NULL, NULL, NULL, NULL);
return 1;
}

View File

@ -65,6 +65,7 @@ extern struct t_config_option *script_config_scripts_cache_expire;
extern struct t_config_option *script_config_scripts_dir;
extern struct t_config_option *script_config_scripts_hold;
extern struct t_config_option *script_config_scripts_url;
extern struct t_config_option *script_config_scripts_url_force_https;
extern const char *script_config_get_diff_command ();
extern char *script_config_get_dir ();

View File

@ -1445,7 +1445,6 @@ void
script_repo_file_update (int quiet)
{
char *filename, *url;
int length;
struct t_hashtable *options;
script_repo_remove_all ();
@ -1461,8 +1460,8 @@ script_repo_file_update (int quiet)
NULL);
if (options)
{
length = 4 + strlen (weechat_config_string (script_config_scripts_url)) + 1;
url = malloc (length);
url = script_build_download_url (
weechat_config_string (script_config_scripts_url));
if (url)
{
if (!quiet)
@ -1471,9 +1470,6 @@ script_repo_file_update (int quiet)
_("%s: downloading list of scripts..."),
SCRIPT_PLUGIN_NAME);
}
snprintf (url, length, "url:%s",
weechat_config_string (script_config_scripts_url));
weechat_hashtable_set (options, "file_out", filename);
weechat_hook_process_hashtable (url, options, 30000,
&script_repo_file_update_process_cb,

View File

@ -95,6 +95,43 @@ script_language_search_by_extension (const char *extension)
return -1;
}
/*
* Builds download URL (to use with hook_process or hook_process_hashtable).
*
* If the option script.scripts.url_force_https is enabled, the protocol is
* forced to HTTPS (if URL starts with "http://").
*
* Note: result must be freed after use.
*/
char *
script_build_download_url (const char *url)
{
char *result;
int length;
if (!url || !url[0])
return NULL;
/* length of url + "url:" + 1 (for httpS) */
length = 4 + 1 + strlen (url) + 1;
result = malloc (length);
if (!result)
return NULL;
if (weechat_config_boolean (script_config_scripts_url_force_https)
&& (weechat_strncasecmp (url, "http://", 7) == 0))
{
snprintf (result, length, "url:https://%s", url + 7);
}
else
{
snprintf (result, length, "url:%s", url);
}
return result;
}
/*
* Gets loaded plugins (in array of integers) and scripts (in hashtable).
*/

View File

@ -34,7 +34,7 @@ extern struct t_hashtable *script_loaded;
extern int script_language_search (const char *language);
extern int script_language_search_by_extension (const char *extension);
extern void script_actions_add (const char *action);
extern char *script_build_download_url (const char *url);
extern void script_get_loaded_plugins_and_scripts ();
#endif /* WEECHAT_SCRIPT_H */