mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2024-11-23 18:17:20 +00:00
Indicate in import listing whether a plugin contains JS modules
This commit is contained in:
parent
83954582f4
commit
336f1ceae3
@ -39,26 +39,29 @@ exports.upgrade = function(wiki,titles,tiddlers) {
|
||||
$tw.utils.each(titles,function(title) {
|
||||
var incomingTiddler = tiddlers[title];
|
||||
// Check if we're dealing with a plugin
|
||||
if(incomingTiddler && incomingTiddler["plugin-type"] && incomingTiddler.version) {
|
||||
// Upgrade the incoming plugin if it is in the upgrade library
|
||||
var libraryTiddler = getLibraryTiddler(title);
|
||||
if(libraryTiddler && libraryTiddler["plugin-type"] && libraryTiddler.version) {
|
||||
tiddlers[title] = libraryTiddler;
|
||||
messages[title] = $tw.language.getString("Import/Upgrader/Plugins/Upgraded",{variables: {incoming: incomingTiddler.version, upgraded: libraryTiddler.version}});
|
||||
return;
|
||||
}
|
||||
// Suppress the incoming plugin if it is older than the currently installed one
|
||||
var existingTiddler = wiki.getTiddler(title);
|
||||
if(existingTiddler && existingTiddler.hasField("plugin-type") && existingTiddler.hasField("version")) {
|
||||
// Reject the incoming plugin by blanking all its fields
|
||||
if($tw.utils.checkVersions(existingTiddler.fields.version,incomingTiddler.version)) {
|
||||
tiddlers[title] = Object.create(null);
|
||||
messages[title] = $tw.language.getString("Import/Upgrader/Plugins/Suppressed/Version",{variables: {incoming: incomingTiddler.version, existing: existingTiddler.fields.version}});
|
||||
if(incomingTiddler && incomingTiddler["plugin-type"]) {
|
||||
// Check whether the plugin contains JS modules
|
||||
var doesContainJavaScript = $tw.wiki.doesPluginInfoContainModules(JSON.parse(incomingTiddler.text)) ? ($tw.wiki.getTiddlerText("$:/language/ControlPanel/Plugins/PluginWillRequireReload") + " ") : "";
|
||||
messages[title] = doesContainJavaScript;
|
||||
if(incomingTiddler.version) {
|
||||
// Upgrade the incoming plugin if it is in the upgrade library
|
||||
var libraryTiddler = getLibraryTiddler(title);
|
||||
if(libraryTiddler && libraryTiddler["plugin-type"] && libraryTiddler.version) {
|
||||
tiddlers[title] = libraryTiddler;
|
||||
messages[title] = doesContainJavaScript + $tw.language.getString("Import/Upgrader/Plugins/Upgraded",{variables: {incoming: incomingTiddler.version, upgraded: libraryTiddler.version}});
|
||||
return;
|
||||
}
|
||||
// Suppress the incoming plugin if it is older than the currently installed one
|
||||
var existingTiddler = wiki.getTiddler(title);
|
||||
if(existingTiddler && existingTiddler.hasField("plugin-type") && existingTiddler.hasField("version")) {
|
||||
// Reject the incoming plugin by blanking all its fields
|
||||
if($tw.utils.checkVersions(existingTiddler.fields.version,incomingTiddler.version)) {
|
||||
tiddlers[title] = Object.create(null);
|
||||
messages[title] = doesContainJavaScript + $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) {
|
||||
|
Loading…
Reference in New Issue
Block a user