mirror of
https://github.com/kiddin9/op-packages.git
synced 2026-11-16 21:43:33 +08:00
🎄 Sync 2026-11-14 17:29:54
This commit is contained in:
1 parent
00efd4e7cf
commit
4e24fe7535
123 files changed
+26051
No files matched your search
+54
@@ -0,0 +1,54 @@
|
||||
<!doctype html>
|
||||
<!-- Renders view/system/carbon-update.js with minimal LuCI stand-ins (E, rpc, poll …)
|
||||
for the browser tests; served from /src/ by tests/browser/preview.test.js. -->
|
||||
<html lang="zh-Hans">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<script src="../../htdocs/luci-static/carbon/i18n/zh-cn.js"></script>
|
||||
<link rel="stylesheet" href="../../htdocs/luci-static/carbon/carbon.css">
|
||||
<script src="../../htdocs/luci-static/carbon/carbon.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<div class="cb-app"><main class="cb-main" style="margin-left:0"><div id="maincontent" class="cb-content"><div id="view"></div></div></main></div>
|
||||
<script>
|
||||
/* E() with LuCI's dom.append rules (luci.js): array items that are not
|
||||
elements become text, so a null item shows up as "null" like on a router */
|
||||
function E(tag, attrs, children) {
|
||||
const el = document.createElement(tag);
|
||||
for (const [k, v] of Object.entries(attrs || {})) {
|
||||
if (v == null || v === false) continue;
|
||||
if (typeof v === 'function') el.addEventListener(k, v);
|
||||
else el.setAttribute(k, v === true ? '' : v);
|
||||
}
|
||||
if (Array.isArray(children))
|
||||
children.forEach((c) => el.appendChild(c instanceof Node ? c : document.createTextNode(`${c}`)));
|
||||
else if (children instanceof Node) el.appendChild(children);
|
||||
else if (children != null) el.innerHTML = `${children}`;
|
||||
return el;
|
||||
}
|
||||
const L = { hasViewPermission: () => true, env: { cgi_base: '/cgi-bin' } };
|
||||
const data = {
|
||||
current: '1.1.3-r1', latest: '1.1.4-r1', can_upgrade: true, manager: 'opkg', notes: '', mirror: '',
|
||||
logo: '../../htdocs/luci-static/carbon/logo.svg'
|
||||
};
|
||||
const stubs = {
|
||||
view: { extend: (o) => o }, rpc: { declare: () => async () => data, getSessionID: () => 'test' },
|
||||
poll: { add() {} }, ui: { menu: { flushCache() {} } }, request: {}
|
||||
};
|
||||
/* the real Markdown module, fed real bilingual release notes */
|
||||
const text = (url) => fetch(url).then((r) => r.text());
|
||||
Promise.all([
|
||||
text('../../htdocs/luci-static/resources/view/system/carbon-update.js'),
|
||||
text('../../htdocs/luci-static/resources/carbon/markdown.js'),
|
||||
text('../../docs/releases/v1.1.4.md')
|
||||
]).then(([src, md, notes]) => {
|
||||
const markdown = new Function('baseclass', md)({ extend: (o) => o });
|
||||
data.notes = notes + '\n| Firmware | File |\n|---|---|\n| OpenWrt 24.10 | `luci-theme-carbon_*_all.ipk` |\n\n```sh\nopkg install /tmp/luci-theme-carbon.ipk\n```\n';
|
||||
const v = new Function('view', 'rpc', 'poll', 'ui', 'request', 'markdown', 'E', 'L', '_', src)(
|
||||
stubs.view, stubs.rpc, stubs.poll, stubs.ui, stubs.request, markdown, E, L, (s) => s);
|
||||
document.getElementById('view').appendChild(v.render(data));
|
||||
document.body.dataset.ready = '1';
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
Reference in new issue
Block a user