mirror of
https://github.com/kiddin9/op-packages.git
synced 2026-11-17 22:13:17 +08:00
🚀 Sync 2026-11-14 15:02:09
This commit is contained in:
1 parent
90f27ab347
commit
9f5777add1
44 files changed
+3970
-5
No files matched your search
@@ -0,0 +1,11 @@
|
||||
// 7Dollar: helpers shared by the theme templates (sidebar and login page).
|
||||
|
||||
/* What to call this box. x86 boards often keep a BIOS placeholder ("Default string",
|
||||
* "To be filled by O.E.M.") as their model: name them by CPU instead, e.g. "Intel Celeron N5105". */
|
||||
export function model(board) {
|
||||
const m = board?.model;
|
||||
if (m && !match(m, /default string|to be filled|o\.e\.m|system product name|not (specified|applicable)/i))
|
||||
return m;
|
||||
return trim(replace(replace(board?.system ?? '', /\((R|TM)\)|\bCPU\b|@.*$/g, ''), /\s+/g, ' '))
|
||||
|| board?.release?.distribution || 'OpenWrt';
|
||||
};
|
||||
@@ -0,0 +1,17 @@
|
||||
{#
|
||||
7Dollar — an elegant LuCI theme
|
||||
Licensed to the public under the Apache License 2.0.
|
||||
-#}
|
||||
{% if (!blank_page): %}
|
||||
<footer class="td-footer">
|
||||
<span>{{ version.distname }} {{ version.distversion }} · <a href="https://github.com/itsmaiGe/luci-theme-7dollar" target="_blank" rel="noreferrer">7Dollar</a></span>
|
||||
<span><a href="https://github.com/openwrt/luci" target="_blank" rel="noreferrer">{{ version.luciname }} ({{ version.luciversion }})</a>{% if (lua_active): %} · {{ _('Lua compatibility mode active') }}{% endif %}</span>
|
||||
</footer>
|
||||
</div>
|
||||
</main>
|
||||
</div>
|
||||
<ul id="modemenu" style="display:none"></ul>
|
||||
<script>L.require('menu-7dollar')</script>
|
||||
{% endif %}
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,96 @@
|
||||
{#
|
||||
7Dollar — an elegant LuCI theme
|
||||
Licensed to the public under the Apache License 2.0.
|
||||
-#}
|
||||
|
||||
{%
|
||||
import { getuid, getspnam } from 'luci.core';
|
||||
import { model as boardModel } from 'luci.7dollar';
|
||||
|
||||
const boardinfo = ubus.call('system', 'board') ?? {};
|
||||
const conf = uci.get_all('7dollar', 'main') ?? {};
|
||||
const palette = (conf.palette in [ 'clay', 'celadon', 'mist', 'dusk', 'graphite' ]) ? conf.palette : 'clay';
|
||||
const mode = (conf.mode in [ 'light', 'dark', 'auto' ]) ? conf.mode : 'auto';
|
||||
const zh = !!match(dispatcher.lang ?? '', /^zh/);
|
||||
const T = (z, e) => zh ? z : e;
|
||||
const ver = '1.0.16';
|
||||
const hostname = striptags(boardinfo.hostname ?? 'OpenWrt');
|
||||
const model = striptags(boardModel(boardinfo));
|
||||
const sprite = `${media}/icons.svg`;
|
||||
|
||||
http.prepare_content('text/html; charset=UTF-8');
|
||||
-%}
|
||||
|
||||
<!DOCTYPE html>
|
||||
<html lang="{{ dispatcher.lang }}" data-palette="{{ palette }}" data-mode="{{ mode }}"{% if (mode != 'auto'): %} data-theme="{{ mode }}" data-darkmode="{{ mode == 'dark' ? 'true' : 'false' }}"{% endif %}>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover">
|
||||
<title>{{ striptags(`${hostname}${node ? ` · ${node.title}` : ''}`) }}</title>
|
||||
<script>
|
||||
(function(r){if(r.getAttribute('data-mode')!=='auto')return;var d=window.matchMedia('(prefers-color-scheme: dark)').matches;r.setAttribute('data-theme',d?'dark':'light');r.setAttribute('data-darkmode',d)})(document.documentElement);
|
||||
</script>
|
||||
<link rel="stylesheet" href="{{ media }}/cascade.css?v={{ ver }}">
|
||||
<link rel="icon" href="{{ media }}/logo.svg?v={{ ver }}" type="image/svg+xml">
|
||||
<link rel="apple-touch-icon" href="{{ media }}/logo.svg?v={{ ver }}">
|
||||
{% if (node?.css): %}
|
||||
<link rel="stylesheet" href="{{ resource }}/{{ node.css }}">
|
||||
{% endif %}
|
||||
{% if (css): %}
|
||||
<style title="text/css">{{ css }}</style>
|
||||
{% endif %}
|
||||
<script src="{{ dispatcher.build_url('admin/translations', dispatcher.lang) }}"></script>
|
||||
<script src="{{ resource }}/cbi.js?v={{ version.luciversion }}"></script>
|
||||
</head>
|
||||
|
||||
<body class="lang_{{ dispatcher.lang }} {{ entityencode(striptags(node?.title ?? ''), true) }}" data-page="{{ entityencode(join('-', ctx.request_path), true) }}">
|
||||
{% if (!blank_page): %}
|
||||
<div class="td-app">
|
||||
<aside class="td-side">
|
||||
<a class="td-brand" href="{{ dispatcher.build_url('admin') }}">
|
||||
<b>{{ hostname }}</b><small>{{ model }}</small>
|
||||
</a>
|
||||
<button class="td-search" type="button" id="td-search" title="{{ T('搜索', 'Search') }}">
|
||||
<svg class="i" aria-hidden="true"><use href="{{ sprite }}#search"></use></svg>
|
||||
<span>{{ T('搜索功能或设置', 'Search settings') }}</span><kbd>⌘K</kbd>
|
||||
</button>
|
||||
<nav class="td-nav" id="td-nav" aria-label="{{ T('主菜单', 'Main menu') }}"></nav>
|
||||
<div class="td-side-foot">
|
||||
<button class="td-icon-btn" type="button" id="td-mode" title="{{ T('切换深浅色', 'Toggle dark mode') }}"><svg class="i" aria-hidden="true"><use href="{{ sprite }}#moon"></use></svg></button>
|
||||
<a class="td-icon-btn" href="{{ dispatcher.build_url('admin/logout') }}" title="{{ T('退出登录', 'Log out') }}"><svg class="i" aria-hidden="true"><use href="{{ sprite }}#logout"></use></svg></a>
|
||||
</div>
|
||||
</aside>
|
||||
|
||||
<main class="td-main">
|
||||
<div id="maincontent">
|
||||
<div class="td-top"><div class="td-pills" id="td-pills"></div><div id="indicators"></div></div>
|
||||
|
||||
{% if (getuid() == 0 && getspnam('root')?.pwdp === ''): %}
|
||||
<div class="alert-message warning">
|
||||
<h4>{{ _('No password set!') }}</h4>
|
||||
<p>{{ _('There is no password set on this router. Please configure a root password to protect the web interface.') }}</p>
|
||||
{% if (dispatcher.lookup("admin/system/admin")): %}
|
||||
<div class="right"><a class="btn" href="{{ dispatcher.build_url("admin/system/admin") }}">{{ _('Go to password configuration...') }}</a></div>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
{% if (boardinfo.rootfs_type == "initramfs"): %}
|
||||
<div class="alert-message warning">
|
||||
<h4>{{ _('System running in recovery (initramfs) mode.') }}</h4>
|
||||
<p>{{ _('No changes to settings will be stored and are lost after rebooting. This mode should only be used to install a firmware upgrade') }}</p>
|
||||
{% if (dispatcher.lookup("admin/system/flash")): %}
|
||||
<div class="right"><a class="btn" href="{{ dispatcher.build_url("admin/system/flash") }}">{{ _('Go to firmware upgrade...') }}</a></div>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
<noscript>
|
||||
<div class="alert-message warning">
|
||||
<h4>{{ _('JavaScript required!') }}</h4>
|
||||
<p>{{ _('You must enable JavaScript in your browser or LuCI will not work properly.') }}</p>
|
||||
</div>
|
||||
</noscript>
|
||||
|
||||
<div id="tabmenu" style="display:none"></div>
|
||||
{% endif %}
|
||||
@@ -0,0 +1,79 @@
|
||||
{#
|
||||
7Dollar — login page
|
||||
Licensed to the public under the Apache License 2.0.
|
||||
-#}
|
||||
|
||||
{% include('header', { blank_page: true }) %}
|
||||
|
||||
{%
|
||||
import { model } from 'luci.7dollar';
|
||||
|
||||
const board = ubus.call('system', 'board') ?? {};
|
||||
const zh = !!match(dispatcher.lang ?? '', /^zh/);
|
||||
const T = (z, e) => zh ? z : e;
|
||||
const sprite = `${media}/icons.svg`;
|
||||
const user = duser ?? 'root';
|
||||
const custom = fuser && fuser != user;
|
||||
-%}
|
||||
|
||||
<div class="td-login">
|
||||
<div class="glow"></div>
|
||||
<svg class="arcs" viewBox="0 0 600 600" fill="none" stroke="currentColor" stroke-width="1.2" aria-hidden="true"><circle cx="600" cy="600" r="160"/><circle cx="600" cy="600" r="250"/><circle cx="600" cy="600" r="340"/><circle cx="600" cy="600" r="430"/><circle cx="600" cy="600" r="520"/></svg>
|
||||
|
||||
<form class="td-lbox" method="post" id="td-login">
|
||||
<h1 class="td-serif">{{ T('欢迎回来', 'Welcome back') }}</h1>
|
||||
<p class="td-sub">{{ striptags(board.hostname ?? 'OpenWrt') }} · {{ striptags(model(board)) }}</p>
|
||||
|
||||
{% if (fuser): %}
|
||||
<div class="td-lerr" role="alert">{{ T('密码不正确,请再试一次。', 'Wrong password, please try again.') }}</div>
|
||||
{% endif %}
|
||||
|
||||
<label class="td-field" id="td-ufield"{% if (!custom): %} hidden{% endif %}>
|
||||
<svg class="i" aria-hidden="true"><use href="{{ sprite }}#devices"></use></svg>
|
||||
<input name="luci_username" id="luci_username" type="text" autocomplete="username" value="{{ entityencode(custom ? fuser : user, true) }}" placeholder="{{ T('用户名', 'Username') }}" autocapitalize="off" spellcheck="false">
|
||||
</label>
|
||||
|
||||
<label class="td-field">
|
||||
<svg class="i" aria-hidden="true"><use href="{{ sprite }}#lock"></use></svg>
|
||||
<input name="luci_password" id="luci_password" type="password" autocomplete="current-password" placeholder="{{ T('管理密码', 'Password') }}" autofocus>
|
||||
<button class="eye" type="button" id="td-eye" title="{{ T('显示密码', 'Show password') }}"><svg class="i" aria-hidden="true"><use href="{{ sprite }}#eye"></use></svg></button>
|
||||
</label>
|
||||
|
||||
<button class="btn primary" type="submit" id="td-go">{{ T('进入', 'Sign in') }} <svg class="i" aria-hidden="true"><use href="{{ sprite }}#arrow"></use></svg></button>
|
||||
|
||||
<p class="td-luser" id="td-luser"{% if (custom): %} hidden{% endif %}>{{ T('将以', 'Signing in as') }} <b>{{ entityencode(user) }}</b> {{ T('身份登录', '') }} · <button type="button" id="td-switch">{{ T('换个用户', 'Other user') }}</button></p>
|
||||
</form>
|
||||
|
||||
<div class="td-lfoot">{{ version.distname }} {{ version.distversion }} · {{ T('仅限局域网访问', 'Local network only') }}</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
(function() {
|
||||
var pw = document.getElementById('luci_password'),
|
||||
eye = document.getElementById('td-eye'),
|
||||
form = document.getElementById('td-login'),
|
||||
go = document.getElementById('td-go');
|
||||
|
||||
eye.addEventListener('click', function() {
|
||||
pw.type = (pw.type == 'password') ? 'text' : 'password';
|
||||
pw.focus();
|
||||
});
|
||||
|
||||
document.getElementById('td-switch').addEventListener('click', function() {
|
||||
document.getElementById('td-ufield').hidden = false;
|
||||
document.getElementById('td-luser').hidden = true;
|
||||
var u = document.getElementById('luci_username');
|
||||
u.value = '';
|
||||
u.focus();
|
||||
});
|
||||
|
||||
form.addEventListener('submit', function() {
|
||||
go.disabled = true;
|
||||
go.classList.add('spinning');
|
||||
});
|
||||
|
||||
pw.focus();
|
||||
})();
|
||||
</script>
|
||||
|
||||
{% include('footer', { blank_page: true }) %}
|
||||
Reference in new issue
Block a user