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) {
|
$tw.utils.each(titles,function(title) {
|
||||||
var incomingTiddler = tiddlers[title];
|
var incomingTiddler = tiddlers[title];
|
||||||
// Check if we're dealing with a plugin
|
// Check if we're dealing with a plugin
|
||||||
if(incomingTiddler && incomingTiddler["plugin-type"] && incomingTiddler.version) {
|
if(incomingTiddler && incomingTiddler["plugin-type"]) {
|
||||||
// Upgrade the incoming plugin if it is in the upgrade library
|
// Check whether the plugin contains JS modules
|
||||||
var libraryTiddler = getLibraryTiddler(title);
|
var doesContainJavaScript = $tw.wiki.doesPluginInfoContainModules(JSON.parse(incomingTiddler.text)) ? ($tw.wiki.getTiddlerText("$:/language/ControlPanel/Plugins/PluginWillRequireReload") + " ") : "";
|
||||||
if(libraryTiddler && libraryTiddler["plugin-type"] && libraryTiddler.version) {
|
messages[title] = doesContainJavaScript;
|
||||||
tiddlers[title] = libraryTiddler;
|
if(incomingTiddler.version) {
|
||||||
messages[title] = $tw.language.getString("Import/Upgrader/Plugins/Upgraded",{variables: {incoming: incomingTiddler.version, upgraded: libraryTiddler.version}});
|
// Upgrade the incoming plugin if it is in the upgrade library
|
||||||
return;
|
var libraryTiddler = getLibraryTiddler(title);
|
||||||
}
|
if(libraryTiddler && libraryTiddler["plugin-type"] && libraryTiddler.version) {
|
||||||
// Suppress the incoming plugin if it is older than the currently installed one
|
tiddlers[title] = libraryTiddler;
|
||||||
var existingTiddler = wiki.getTiddler(title);
|
messages[title] = doesContainJavaScript + $tw.language.getString("Import/Upgrader/Plugins/Upgraded",{variables: {incoming: incomingTiddler.version, upgraded: libraryTiddler.version}});
|
||||||
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}});
|
|
||||||
return;
|
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
|
// Check whether the plugin is on the blocked list
|
||||||
var blockInfo = BLOCKED_PLUGINS[title];
|
var blockInfo = BLOCKED_PLUGINS[title];
|
||||||
if(blockInfo) {
|
if(blockInfo) {
|
||||||
|
Loading…
Reference in New Issue
Block a user