Sort plugins by download count
Allow loading models from custom URLs
This commit is contained in:
parent
c613bb32c4
commit
06d0dab517
@ -633,6 +633,13 @@ function addStartScreenSection(id, data) {
|
||||
//Update Screen
|
||||
if (Blockbench.hasFlag('after_update') && data.new_version) {
|
||||
addStartScreenSection(data.new_version)
|
||||
jQuery.ajax({
|
||||
url: 'https://blckbn.ch/api/event/successful_update',
|
||||
type: 'POST',
|
||||
data: {
|
||||
version: Blockbench.version
|
||||
}
|
||||
})
|
||||
}
|
||||
if (data.psa) {
|
||||
(function() {
|
||||
|
@ -521,6 +521,12 @@ BARS.defineActions(function() {
|
||||
}).fail(error => {
|
||||
Blockbench.showQuickMessage('message.invalid_link')
|
||||
})
|
||||
} else {
|
||||
$.getJSON(link, (model) => {
|
||||
Codecs.project.load(model, {path: ''});
|
||||
}).fail(error => {
|
||||
Blockbench.showQuickMessage('message.invalid_link')
|
||||
})
|
||||
}
|
||||
}, 'https://blckbn.ch/1234')
|
||||
}
|
||||
|
@ -3,6 +3,7 @@ const Plugins = {
|
||||
Vue: [], //Vue Object
|
||||
installed: [], //Simple List of Names
|
||||
json: undefined, //Json from website
|
||||
download_stats: {},
|
||||
all: [], //Vue Object Data
|
||||
registered: {},
|
||||
devReload() {
|
||||
@ -18,7 +19,12 @@ const Plugins = {
|
||||
},
|
||||
sort() {
|
||||
Plugins.all.sort(function(a,b) {
|
||||
return sort_collator.compare(a.title, b.title)
|
||||
let download_difference = (Plugins.download_stats[b.id] || 0) - (Plugins.download_stats[a.id] || 0);
|
||||
if (download_difference) {
|
||||
return download_difference
|
||||
} else {
|
||||
return sort_collator.compare(a.title, b.title);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
@ -120,6 +126,15 @@ class Plugin {
|
||||
await scope.install(first);
|
||||
resolve()
|
||||
}, 20)
|
||||
if (first) {
|
||||
jQuery.ajax({
|
||||
url: 'https://blckbn.ch/api/event/install_plugin',
|
||||
type: 'POST',
|
||||
data: {
|
||||
plugin: scope.id
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
});
|
||||
});
|
||||
@ -383,6 +398,13 @@ Plugins.loading_promise = new Promise((resolve, reject) => {
|
||||
})
|
||||
})
|
||||
|
||||
$.getJSON('https://blckbn.ch/api/stats/plugins?weeks=2', data => {
|
||||
Plugins.download_stats = data;
|
||||
if (Plugins.json) {
|
||||
Plugins.sort();
|
||||
}
|
||||
})
|
||||
|
||||
async function loadInstalledPlugins() {
|
||||
if (!Plugins.loading_promise.resolved) {
|
||||
await Plugins.loading_promise;
|
||||
|
Loading…
x
Reference in New Issue
Block a user