Fix plugin caching issue

Fix start screen caching issue
Fix backgrounds not working in some display mode slots
This commit is contained in:
JannisX11 2022-01-08 14:22:22 +01:00
parent 62694f5a1c
commit 3f97f74082
3 changed files with 30 additions and 21 deletions

View File

@ -236,7 +236,11 @@ onVueSetup(function() {
addStartScreenSection('new_version', data.new_version)
})*/
var news_call = $.getJSON('https://web.blockbench.net/content/news.json')
var news_call = $.ajax({
cache: false,
url: 'https://web.blockbench.net/content/news.json',
dataType: 'json'
});
Promise.all([news_call, documentReady]).then((data) => {
if (!data || !data[0]) return;
data = data[0];

View File

@ -390,16 +390,23 @@ if (isApp) {
}
Plugins.loading_promise = new Promise((resolve, reject) => {
$.getJSON('https://cdn.jsdelivr.net/gh/JannisX11/blockbench-plugins/plugins.json?'+Math.round(Math.random()*99), function(data) {
Plugins.json = data
resolve();
Plugins.loading_promise.resolved = true;
}).fail(function() {
console.log('Could not connect to plugin server')
$('#plugin_available_empty').text('Could not connect to plugin server')
resolve();
Plugins.loading_promise.resolved = true;
})
$.ajax({
cache: false,
url: 'https://cdn.jsdelivr.net/gh/JannisX11/blockbench-plugins/plugins.json',
dataType: 'json',
success(data) {
Plugins.json = data;
resolve();
Plugins.loading_promise.resolved = true;
},
error() {
console.log('Could not connect to plugin server')
$('#plugin_available_empty').text('Could not connect to plugin server')
resolve();
Plugins.loading_promise.resolved = true;
}
});
})
$.getJSON('https://blckbn.ch/api/stats/plugins?weeks=2', data => {

View File

@ -1240,18 +1240,16 @@ class Preview {
if (display_mode) {
var id = displayReferenceObjects.active.id
if (id == 'monitor' ||id == 'bow') {
this.background = canvas_scenes.monitor
return this.background = canvas_scenes.monitor
} else if (['inventory_nine', 'inventory_full', 'hud'].includes(id)) {
this.background = canvas_scenes[id]
} else {
this.background = canvas_scenes.normal
return this.background = canvas_scenes[id]
}
} else if (this.angle !== null) {
this.background = Project && Project.backgrounds['ortho_'+this.angle]
} else {
this.background = Project && Project.backgrounds.normal
}
return this.background
if (this.angle === null) {
return this.background = Project && Project.backgrounds.normal;
} else {
return this.background = Project && Project.backgrounds['ortho_'+this.angle];
}
}
loadBackground() {
this.getBackground()
@ -1423,7 +1421,7 @@ class Preview {
changeDisplaySkin()
}},
'preview_checkerboard',
{id: 'background', icon: 'wallpaper', name: 'menu.preview.background', children(preview) {
{id: 'background', icon: 'wallpaper', name: 'menu.preview.background', condition: (preview) => preview.getBackground(), children(preview) {
var has_background = !!preview.background.image
function applyBackground(image) {
preview.background.image = image;