- page render caching
- onDemand block caching
- page html minify
- better rate limiting
- minor cobalt.js clean up
- page render platform indication in settings popup

all these changes are aimed to improve performance and responsiveness

!! not final version of 5.2 !!
This commit is contained in:
wukko
2023-03-10 00:41:17 +06:00
parent daa2856d92
commit a3daa65148
10 changed files with 100 additions and 58 deletions

View File

@@ -0,0 +1,11 @@
import { languageList } from "../../localization/manager.js";
export default function(lang, userAgent) {
let language = languageList.includes(lang) ? lang : "en";
let ua = userAgent.toLowerCase();
let platform = (ua.match("android") || ua.match("iphone os")) ? "mob" : "pc";
if (platform === "mob" && ua.match("iphone os")) platform = "ios";
return `/build/${platform}/${language}.html`;
}

View File

@@ -1,6 +1,9 @@
import changelogManager from "../changelog/changelogManager.js"
let cache = {}
export function changelogHistory() { // blockId 0
if (cache['0']) return cache['0'];
let history = changelogManager("history");
let render = ``;
@@ -9,5 +12,6 @@ export function changelogHistory() { // blockId 0
let separator = (i !== 0 && i !== historyLen) ? '<div class="separator"></div>' : ''
render += `${separator}${history[i]["banner"] ? `<div class="changelog-banner"><img class="changelog-img" src="${history[i]["banner"]}" onerror="this.style.display='none'"></img></div>` : ''}<div id="popup-desc" class="changelog-subtitle">${history[i]["title"]}</div><div id="popup-desc" class="desc-padding">${history[i]["content"]}</div>`
}
cache['0'] = render;
return render;
}

View File

@@ -33,6 +33,10 @@ export default function(obj) {
let ua = obj.useragent.toLowerCase();
let isIOS = ua.match("iphone os");
let isMobile = ua.match("android") || ua.match("iphone os");
let platform = isMobile ? "m" : "p";
if (isMobile && isIOS) platform = "i";
audioFormats[0]["text"] = t('SettingsAudioFormatBest');
try {
@@ -186,7 +190,7 @@ export default function(obj) {
closeAria: t('AccessibilityClosePopup'),
header: {
aboveTitle: {
text: `v.${version}-${obj.hash} (${obj.branch})`,
text: `v.${version}-${obj.hash}${platform} (${obj.branch})`,
url: `${repo}/commit/${obj.hash}`
},
title: `${emoji("⚙️", 30)} ${t('TitlePopupSettings')}`