Browse Source

add option to enable/disable encryption of DMs's data cache, separate section for DMs in options

readme-update
Simon Grim 7 years ago
parent
commit
9a97fd0328
  1. 39
      js/interface_localization.js
  2. 4
      js/options.js
  3. 6
      js/twister_newmsgs.js
  4. 35
      options.html
  5. 2
      theme_nin/css/style.css
  6. 12
      theme_nin/js/theme_option.js
  7. 5
      theme_nin/sass/_tabs.sass

39
js/interface_localization.js

@ -367,7 +367,8 @@ if(preferredLanguage == "en"){ @@ -367,7 +367,8 @@ if(preferredLanguage == "en"){
"Language": "Language",
"Sound": "Sound",
"Users": "Users",
"Direct Message's copy to self": "Direct Message's copy to self",
'dm_copy_outgoing_to_self': 'Copy outgoing messages to self',
'dm_encrypt_local_cache': 'Encrypt local data cache',
"Terminate Daemon": "Terminate Daemon",
"New post": "New post",
"Search": "Search",
@ -736,7 +737,8 @@ if(preferredLanguage == "es"){ @@ -736,7 +737,8 @@ if(preferredLanguage == "es"){
"Language": "Idioma",
"Sound": "Sonido",
"Users": "Usuarios",
"Direct Message's copy to self": "Direct Message's copy to self",
'dm_copy_outgoing_to_self': 'Copy outgoing messages to self',
'dm_encrypt_local_cache': 'Encrypt local data cache',
"Traffic information": "Traffic information",
"DHT Torrents:": "DHT Torrents:",
"Peers:": "Peers:",
@ -1099,7 +1101,8 @@ if(preferredLanguage == "uk"){ @@ -1099,7 +1101,8 @@ if(preferredLanguage == "uk"){
"Language": "Мова",
"Sound": "Звук",
"Users": "Користувачі",
"Direct Message's copy to self": "Повідомлення скопійовано самому собі",
'dm_copy_outgoing_to_self': 'Повідомлення скопійовано самому собі',
'dm_encrypt_local_cache': 'Encrypt local data cache',
"Traffic information": "Статистика трафіку",
"Direct messages with": "Співбесіда з",
"DHT Torrents:": "DHT Torrents:",
@ -1465,7 +1468,8 @@ if(preferredLanguage == "zh-CN"){ @@ -1465,7 +1468,8 @@ if(preferredLanguage == "zh-CN"){
"Language": "语言",
"Sound": "声音",
"Users": "用户",
"Direct Message's copy to self": "将私信发一份副本给我",
'dm_copy_outgoing_to_self': '将私信发一份副本给我',
'dm_encrypt_local_cache': 'Encrypt local data cache',
"Terminate Daemon": "终止后台进程",
"New post": "新推文",
"Search": "搜索",
@ -1835,7 +1839,8 @@ if(preferredLanguage == "nl"){ @@ -1835,7 +1839,8 @@ if(preferredLanguage == "nl"){
"Language": "Language",
"Sound": "Sound",
"Users": "Users",
"Direct Message's copy to self": "Direct Message's copy to self",
'dm_copy_outgoing_to_self': 'Copy outgoing messages to self',
'dm_encrypt_local_cache': 'Encrypt local data cache',
"Traffic information": "Traffic information",
"DHT Torrents:": "DHT Torrents:",
"Peers:": "Peers:",
@ -2199,7 +2204,8 @@ if(preferredLanguage == "it"){ @@ -2199,7 +2204,8 @@ if(preferredLanguage == "it"){
"Language": "Language",
"Sound": "Sound",
"Users": "Users",
"Direct Message's copy to self": "Direct Message's copy to self",
'dm_copy_outgoing_to_self': 'Copy outgoing messages to self',
'dm_encrypt_local_cache': 'Encrypt local data cache',
"Traffic information": "Traffic information",
"DHT Torrents:": "DHT Torrents:",
"Peers:": "Peers:",
@ -2565,7 +2571,8 @@ if(preferredLanguage == "fr"){ @@ -2565,7 +2571,8 @@ if(preferredLanguage == "fr"){
"Language": "Language",
"Sound": "Sound",
"Users": "Users",
"Direct Message's copy to self": "Direct Message's copy to self",
'dm_copy_outgoing_to_self': 'Copy outgoing messages to self',
'dm_encrypt_local_cache': 'Encrypt local data cache',
"Traffic information": "Traffic information",
"DHT Torrents:": "DHT Torrents:",
"Peers:": "Peers:",
@ -2932,7 +2939,8 @@ if(preferredLanguage == "ru"){ @@ -2932,7 +2939,8 @@ if(preferredLanguage == "ru"){
"Language": "Язык",
"Sound": "Звук",
"Users": "Пользователи",
"Direct Message's copy to self": "Синхронизировать отправленные личные сообщения",
'dm_copy_outgoing_to_self': 'Синхронизировать отправленные личные сообщения',
'dm_encrypt_local_cache': 'Шифровать локальный кэш данных',
"Terminate Daemon": "Выключить twister демон",
"New post": "Новый пост",
"Search": "Поиск",
@ -3304,7 +3312,8 @@ if(preferredLanguage == "de"){ @@ -3304,7 +3312,8 @@ if(preferredLanguage == "de"){
"Language": "Language",
"Sound": "Sound",
"Users": "Users",
"Direct Message's copy to self": "Kopie der Direktnachricht an mich selbst",
'dm_copy_outgoing_to_self': 'Kopie der Direktnachricht an mich selbst',
'dm_encrypt_local_cache': 'Encrypt local data cache',
"Traffic information": "Traffic information",
"DHT Torrents:": "DHT Torrents:",
"Peers:": "Peers:",
@ -3667,7 +3676,8 @@ if(preferredLanguage == "ja"){ @@ -3667,7 +3676,8 @@ if(preferredLanguage == "ja"){
"Language": "Language",
"Sound": "Sound",
"Users": "Users",
"Direct Message's copy to self": "Direct Message's copy to self",
'dm_copy_outgoing_to_self': 'Copy outgoing messages to self',
'dm_encrypt_local_cache': 'Encrypt local data cache',
"Traffic information": "Traffic information",
"DHT Torrents:": "DHT Torrents:",
"Peers:": "Peers:",
@ -4035,7 +4045,8 @@ if(preferredLanguage == "pt-BR"){ @@ -4035,7 +4045,8 @@ if(preferredLanguage == "pt-BR"){
"Language": "Language",
"Sound": "Sound",
"Users": "Users",
"Direct Message's copy to self": "Direct Message's copy to self",
'dm_copy_outgoing_to_self': 'Copy outgoing messages to self',
'dm_encrypt_local_cache': 'Encrypt local data cache',
"Traffic information": "Traffic information",
"DHT Torrents:": "DHT Torrents:",
"Peers:": "Peers:",
@ -4400,7 +4411,8 @@ if(preferredLanguage == "tr"){ @@ -4400,7 +4411,8 @@ if(preferredLanguage == "tr"){
"Language": "Dil",
"Sound": "Ses",
"Users": "Kullanıcılar",
"Direct Message's copy to self": "Özel iletinin kopyasını sakla",
'dm_copy_outgoing_to_self': 'Özel iletinin kopyasını sakla',
'dm_encrypt_local_cache': 'Encrypt local data cache',
"Traffic information": "Trafik bilgileri",
"DHT Torrents:": "DHT Torrentleri:",
"Peers:": "Eşler:",
@ -4765,7 +4777,8 @@ if(preferredLanguage == "cs"){ @@ -4765,7 +4777,8 @@ if(preferredLanguage == "cs"){
"Language": "Jazyk",
"Sound": "Zvuky",
"Users": "Uživatelé",
"Direct Message's copy to self": "Posílat kopie přímých zpráv sám sobě",
'dm_copy_outgoing_to_self': 'Posílat kopie přímých zpráv sám sobě',
'dm_encrypt_local_cache': 'Encrypt local data cache',
"New post": "Nový příspěvek",
"Search": "Hledat",
"Direct Msg": "Přímá zpráva",

4
js/options.js

@ -227,6 +227,10 @@ function twisterOptions() { @@ -227,6 +227,10 @@ function twisterOptions() {
name: 'dmCopySelf',
valDefault: 'enable'
});
this.add({
name: 'dmEncryptCache',
valDefault: 'enable'
});
this.add({
name: 'hideReplies',
valDefault: 'following'

6
js/twister_newmsgs.js

@ -200,8 +200,10 @@ function saveDMsToStorage() { @@ -200,8 +200,10 @@ function saveDMsToStorage() {
};
}
pool = twister.var.key.pub.encrypt(JSON.stringify(pool));
delete pool.orig; // WORKAROUND the decrypt function does .slice(0, orig) but something goes wrong in process of buffer decoding (if original string contains non-ASCII characters) and orig may be smaller than the actual size, if it is undefined .slice gets it whole
if ($.Options.get('dmEncryptCache') === 'enable') {
pool = twister.var.key.pub.encrypt(JSON.stringify(pool));
delete pool.orig; // WORKAROUND the decrypt function does .slice(0, orig) but something goes wrong in process of buffer decoding (if original string contains non-ASCII characters) and orig may be smaller than the actual size, if it is undefined .slice gets it whole
}
$.initNamespaceStorage(defaultScreenName).localStorage.set('DMs', pool);
}

35
options.html

@ -52,6 +52,8 @@ @@ -52,6 +52,8 @@
<label for="t-2" class="tabs selectable_theme theme_nin">Theme</label>
<input id="t-3" name="option_tab" type="radio" class="selectable_theme theme_nin"/>
<label for="t-3" class="tabs selectable_theme theme_nin">Notifications</label>
<input id="t-8" name="option_tab" type="radio" class="selectable_theme theme_nin" />
<label for="t-8" class="tabs selectable_theme theme_nin">Direct Messages</label>
<input id="t-4" name="option_tab" type="radio" class="selectable_theme theme_nin"/>
<label for="t-4" class="tabs selectable_theme theme_nin">Keys</label>
<input id="t-5" name="option_tab" type="radio" class="selectable_theme theme_nin"/>
@ -194,6 +196,30 @@ @@ -194,6 +196,30 @@
</div>
</div>
<div class="DMs">
<div class="module">
<p class="label label-h">Direct Messages</p>
<div class="container">
<form action="" id="dmCopySelfOpt">
<p class="label">dm_copy_outgoing_to_self</p>
<select name="" id="dmCopySelf" class="container">
<option value="enable">Enable</option>
<option value="disable">Disable</option>
</select>
</form>
</div>
<div class="container">
<form action="" id="dmEncryptCacheOpt">
<p class="label">dm_encrypt_local_cache</p>
<select name="" id="dmEncryptCache" class="container">
<option value="enable">Enable</option>
<option value="disable">Disable</option>
</select>
</form>
</div>
</div>
</div>
<div class="keys">
<div class="module">
<p class="label label-h"> Keys </p>
@ -457,15 +483,6 @@ @@ -457,15 +483,6 @@
</select>
</form>
</div>
<div class="container">
<form action="" id="dmCopySelfOpt">
<p class="label">Direct Message's copy to self</p>
<select name="" id="dmCopySelf" class="container">
<option value="disable">Disable</option>
<option value="enable">Enable</option>
</select>
</form>
</div>
</div>
</div>
</div>

2
theme_nin/css/style.css

@ -1415,7 +1415,7 @@ button:disabled:hover, button.disabled:hover, .mini-profile-actions span.disable @@ -1415,7 +1415,7 @@ button:disabled:hover, button.disabled:hover, .mini-profile-actions span.disable
visibility: hidden;
}
/* line 42, ../sass/_tabs.sass */
.options input#tab_language:checked ~ .tab-content .language, .options input#t-2:checked ~ .tab-content .theme, .options input#t-3:checked ~ .tab-content .notifications, .options input#t-4:checked ~ .tab-content .keys, .options input#t-5:checked ~ .tab-content .appearance, .options input#t-6:checked ~ .tab-content .users, .options input#t-7:checked ~ .tab-content .webtorrent {
.options input#tab_language:checked ~ .tab-content .language, .options input#t-2:checked ~ .tab-content .theme, .options input#t-3:checked ~ .tab-content .notifications, .options input#t-4:checked ~ .tab-content .keys, .options input#t-5:checked ~ .tab-content .appearance, .options input#t-6:checked ~ .tab-content .users, .options input#t-7:checked ~ .tab-content .webtorrent, .options input#t-8:checked ~ .tab-content .DMs {
position: relative;
z-index: 10;
opacity: 1;

12
theme_nin/js/theme_option.js

@ -53,12 +53,8 @@ $(function(){ @@ -53,12 +53,8 @@ $(function(){
});
function localizeLabels() {
$("label[for=tab_language]").text(polyglot.t("Language"));
$("label[for=t-2]").text(polyglot.t("Theme"));
$("label[for=t-3]").text(polyglot.t("Notifications"));
$("label[for=t-4]").text(polyglot.t("Keys"));
$("label[for=t-5]").text(polyglot.t("Appearance"));
$("label[for=t-6]").text(polyglot.t("Users"));
$("label[for=t-7]").text(polyglot.t("WebTorrent"));
$('label.tabs').each(function (i, elem) {
var elem = $(elem);
elem.text(polyglot.t(elem.text()));
});
}

5
theme_nin/sass/_tabs.sass

@ -48,6 +48,7 @@ @@ -48,6 +48,7 @@
&#t-5:checked ~ .tab-content .appearance,
&#t-6:checked ~ .tab-content .users
&#t-7:checked ~ .tab-content .webtorrent
&#t-8:checked ~ .tab-content .DMs
position: relative
z-index: 10
opacity: 1
@ -59,7 +60,7 @@ @@ -59,7 +60,7 @@
text-align: center
width: auto
display: inline-block!important
margin: 0 5px 0 0
margin: 0 5px 0 0
padding: 5px 15px
color: $main-color-light
background: $background-light
@ -67,5 +68,3 @@ @@ -67,5 +68,3 @@
input:checked + label.tabs
background: $bloc-background-color
color: $main-color-dark

Loading…
Cancel
Save