1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-12-25 01:20:30 +00:00

Add plugin blocklist

Starting with blocking the old fullscreen plugin
This commit is contained in:
Jermolene 2014-08-02 12:42:05 +01:00
parent 748e4ccddc
commit 9b9f7d32a0
6 changed files with 26 additions and 8 deletions

View File

@ -6,7 +6,8 @@ Listing/Import/Caption: Import
Listing/Select/Caption: Select Listing/Select/Caption: Select
Listing/Status/Caption: Status Listing/Status/Caption: Status
Listing/Title/Caption: Title Listing/Title/Caption: Title
Upgrader/Plugins/Suppressed: Suppressed plugin (due to incoming <<incoming>> being older than existing <<existing>>) Upgrader/Plugins/Suppressed/Incompatible: Blocked incompatible or obsolete plugin
Upgrader/Plugins/Suppressed/Version: Blocked plugin (due to incoming <<incoming>> being older than existing <<existing>>)
Upgrader/Plugins/Upgraded: Upgraded plugin from <<incoming>> to <<upgraded>> Upgrader/Plugins/Upgraded: Upgraded plugin from <<incoming>> to <<upgraded>>
Upgrader/System/Suppressed: Suppressed system tiddler Upgrader/System/Suppressed: Blocked system tiddler
Upgrader/ThemeTweaks/Created: Migrated theme tweak from <$text text=<<from>>/> Upgrader/ThemeTweaks/Created: Migrated theme tweak from <$text text=<<from>>/>

View File

@ -14,6 +14,12 @@ Upgrader module that checks that plugins are newer than any already installed ve
var UPGRADE_LIBRARY_TITLE = "$:/UpgradeLibrary"; var UPGRADE_LIBRARY_TITLE = "$:/UpgradeLibrary";
var BLOCKED_PLUGINS = {
"$:/plugins/tiddlywiki/fullscreen": {
versions: ["*"]
}
};
exports.upgrade = function(wiki,titles,tiddlers) { exports.upgrade = function(wiki,titles,tiddlers) {
var self = this, var self = this,
messages = {}, messages = {},
@ -23,7 +29,7 @@ exports.upgrade = function(wiki,titles,tiddlers) {
upgradeLibrary = wiki.getTiddlerData(UPGRADE_LIBRARY_TITLE,{}); upgradeLibrary = wiki.getTiddlerData(UPGRADE_LIBRARY_TITLE,{});
upgradeLibrary.tiddlers = upgradeLibrary.tiddlers || {}; upgradeLibrary.tiddlers = upgradeLibrary.tiddlers || {};
} }
return upgradeLibrary.tiddlers[title] return upgradeLibrary.tiddlers[title];
}; };
// Go through all the incoming tiddlers // Go through all the incoming tiddlers
@ -46,7 +52,18 @@ exports.upgrade = function(wiki,titles,tiddlers) {
// Reject the incoming plugin by blanking all its fields // Reject the incoming plugin by blanking all its fields
if($tw.utils.checkVersions(existingTiddler.fields.version,incomingTiddler.version)) { if($tw.utils.checkVersions(existingTiddler.fields.version,incomingTiddler.version)) {
tiddlers[title] = Object.create(null); tiddlers[title] = Object.create(null);
messages[title] = $tw.language.getString("Import/Upgrader/Plugins/Suppressed",{variables: {incoming: incomingTiddler.version, existing: existingTiddler.fields.version}}); messages[title] = $tw.language.getString("Import/Upgrader/Plugins/Suppressed/Version",{variables: {incoming: incomingTiddler.version, existing: existingTiddler.fields.version}});
return;
}
}
}
if(incomingTiddler && incomingTiddler["plugin-type"]) {
// Check whether the plugin is on the blocked list
var blockInfo = BLOCKED_PLUGINS[title];
if(blockInfo) {
if(blockInfo.versions.indexOf("*") !== -1 || (incomingTiddler.version && blockInfo.versions.indexOf(incomingTiddler.version) !== -1)) {
tiddlers[title] = Object.create(null);
messages[title] = $tw.language.getString("Import/Upgrader/Plugins/Suppressed/Incompatible");
return; return;
} }
} }

View File

@ -6,7 +6,7 @@ Listing/Import/Caption: Importieren
Listing/Select/Caption: Auswahl Listing/Select/Caption: Auswahl
Listing/Status/Caption: Status Listing/Status/Caption: Status
Listing/Title/Caption: Titel Listing/Title/Caption: Titel
Upgrader/Plugins/Suppressed: Einige "plugins" weden unterdrückt! Importierte plugins: <<incoming>> sind älter als existierende: <<existing>>. Upgrader/Plugins/Suppressed/Version: Einige "plugins" weden unterdrückt! Importierte plugins: <<incoming>> sind älter als existierende: <<existing>>.
Upgrader/Plugins/Upgraded: Aktualisieren der plugins von: <<incoming>> nach: <<upgraded>> Upgrader/Plugins/Upgraded: Aktualisieren der plugins von: <<incoming>> nach: <<upgraded>>
Upgrader/System/Suppressed: Unterdrückte "System Tiddler" Upgrader/System/Suppressed: Unterdrückte "System Tiddler"
Upgrader/ThemeTweaks/Created: Migrieren der "theme tweaks" von: <$text text=<<from>>/> Upgrader/ThemeTweaks/Created: Migrieren der "theme tweaks" von: <$text text=<<from>>/>

View File

@ -6,7 +6,7 @@ Listing/Import/Caption: Importer
Listing/Select/Caption: Sélectionner Listing/Select/Caption: Sélectionner
Listing/Status/Caption: Statut Listing/Status/Caption: Statut
Listing/Title/Caption: Titre Listing/Title/Caption: Titre
Upgrader/Plugins/Suppressed: Plugin supprimé (le pressenti <<incoming>> étant plus ancien que l'existant <<existing>>) Upgrader/Plugins/Suppressed/Version: Plugin supprimé (le pressenti <<incoming>> étant plus ancien que l'existant <<existing>>)
Upgrader/Plugins/Upgraded: Plugin mis à jour depuis <<incoming>> vers <<upgraded>> Upgrader/Plugins/Upgraded: Plugin mis à jour depuis <<incoming>> vers <<upgraded>>
Upgrader/System/Suppressed: Tiddler système supprimé Upgrader/System/Suppressed: Tiddler système supprimé
Upgrader/ThemeTweaks/Created: Thème modifié à partir de <$text text=<<from>>/> Upgrader/ThemeTweaks/Created: Thème modifié à partir de <$text text=<<from>>/>

View File

@ -6,7 +6,7 @@ Listing/Import/Caption: 导入
Listing/Select/Caption: 选择 Listing/Select/Caption: 选择
Listing/Status/Caption: 状态 Listing/Status/Caption: 状态
Listing/Title/Caption: 条目 Listing/Title/Caption: 条目
Upgrader/Plugins/Suppressed: 排除插件 (由于传入的 <<incoming>> 较现有版本 <<existing>> 旧) Upgrader/Plugins/Suppressed/Version: 排除插件 (由于传入的 <<incoming>> 较现有版本 <<existing>> 旧)
Upgrader/Plugins/Upgraded: 升级插件,从 <<incoming>> 到 <<upgraded>> Upgrader/Plugins/Upgraded: 升级插件,从 <<incoming>> 到 <<upgraded>>
Upgrader/System/Suppressed: 排除系统条目 Upgrader/System/Suppressed: 排除系统条目
Upgrader/ThemeTweaks/Created: 從 <$text text=<<from>>/> 遷移佈景主題 Upgrader/ThemeTweaks/Created: 從 <$text text=<<from>>/> 遷移佈景主題

View File

@ -6,7 +6,7 @@ Listing/Import/Caption: 導入
Listing/Select/Caption: 選擇 Listing/Select/Caption: 選擇
Listing/Status/Caption: 狀態 Listing/Status/Caption: 狀態
Listing/Title/Caption: 條目 Listing/Title/Caption: 條目
Upgrader/Plugins/Suppressed: 排除插件 (由於傳入的 <<incoming>> 較現有版本 <<existing>> 舊) Upgrader/Plugins/Suppressed/Version: 排除插件 (由於傳入的 <<incoming>> 較現有版本 <<existing>> 舊)
Upgrader/Plugins/Upgraded: 升級插件,從 <<incoming>> 到 <<upgraded>> Upgrader/Plugins/Upgraded: 升級插件,從 <<incoming>> 到 <<upgraded>>
Upgrader/System/Suppressed: 排除系統條目 Upgrader/System/Suppressed: 排除系統條目
Upgrader/ThemeTweaks/Created: 從 <$text text=<<from>>/> 遷移佈景主題 Upgrader/ThemeTweaks/Created: 從 <$text text=<<from>>/> 遷移佈景主題