🍓 Sync 2025-12-12 01:24:29

This commit is contained in:
actions-user
2025-12-12 01:24:29 +08:00
parent bba28a6b33
commit a1e07dbdac
11 changed files with 132 additions and 22 deletions

View File

@@ -3,7 +3,7 @@ include $(TOPDIR)/rules.mk
LUCI_TITLE:=iStoreNext
LUCI_DESCRIPTION:=LuCI module for iStoreNext
PKG_VERSION:=0.0.2
PKG_VERSION:=0.0.4
PKG_RELEASE:=1
LUCI_DEPENDS:=+luci-nginxer

View File

@@ -0,0 +1,32 @@
msgid ""
msgstr "Content-Type: text/plain; charset=UTF-8"
#: luci/luci-mod-istorenext/root/usr/lib/lua/luci/view/istorenext/login.htm:160
msgid "Invalid username and/or password! Please try again."
msgstr ""
#: luci/luci-mod-istorenext/root/usr/lib/lua/luci/view/istorenext/login.htm:123
#: luci/luci-mod-istorenext/root/usr/lib/lua/luci/view/istorenext/login.htm:152
msgid "Log in"
msgstr ""
#: luci/luci-mod-istorenext/root/usr/lib/lua/luci/view/istorenext/login.htm:143
msgid "Password"
msgstr ""
#: luci/luci-mod-istorenext/root/usr/lib/lua/luci/view/istorenext/login.htm:149
msgid "Please enter password"
msgstr ""
#: luci/luci-mod-istorenext/root/usr/lib/lua/luci/view/istorenext/login.htm:138
#: luci/luci-mod-istorenext/root/usr/lib/lua/luci/view/istorenext/login.htm:169
msgid "Please enter username"
msgstr ""
#: luci/luci-mod-istorenext/root/usr/lib/lua/luci/view/istorenext/login.htm:131
msgid "Username"
msgstr ""
#: luci/luci-mod-istorenext/root/usr/lib/lua/luci/view/istorenext/login.htm:124
msgid "Welcome back, please enter your credentials"
msgstr ""

View File

@@ -0,0 +1 @@
zh_Hans

View File

@@ -0,0 +1,39 @@
msgid ""
msgstr ""
"Content-Type: text/plain; charset=UTF-8\n"
"Project-Id-Version: PACKAGE VERSION\n"
"Last-Translator: Automatically generated\n"
"Language-Team: none\n"
"Language: zh_Hans\n"
"MIME-Version: 1.0\n"
"Content-Transfer-Encoding: 8bit\n"
#: luci/luci-mod-istorenext/root/usr/lib/lua/luci/view/istorenext/login.htm:160
msgid "Invalid username and/or password! Please try again."
msgstr ""
#: luci/luci-mod-istorenext/root/usr/lib/lua/luci/view/istorenext/login.htm:123
#: luci/luci-mod-istorenext/root/usr/lib/lua/luci/view/istorenext/login.htm:152
msgid "Log in"
msgstr ""
#: luci/luci-mod-istorenext/root/usr/lib/lua/luci/view/istorenext/login.htm:143
msgid "Password"
msgstr ""
#: luci/luci-mod-istorenext/root/usr/lib/lua/luci/view/istorenext/login.htm:149
msgid "Please enter password"
msgstr "请输入密码"
#: luci/luci-mod-istorenext/root/usr/lib/lua/luci/view/istorenext/login.htm:138
#: luci/luci-mod-istorenext/root/usr/lib/lua/luci/view/istorenext/login.htm:169
msgid "Please enter username"
msgstr "请输入用户名"
#: luci/luci-mod-istorenext/root/usr/lib/lua/luci/view/istorenext/login.htm:131
msgid "Username"
msgstr ""
#: luci/luci-mod-istorenext/root/usr/lib/lua/luci/view/istorenext/login.htm:124
msgid "Welcome back, please enter your credentials"
msgstr "欢迎回来,请输入您的凭证"

View File

@@ -0,0 +1,12 @@
#!/bin/sh /etc/rc.common
START=79
USE_PROCD=1
start_service() {
procd_open_instance
procd_set_param command /usr/sbin/uhttpd -f -h /demo -r Test -x /cgi-bin/luci/istorenext/cgi-bin -u /ubus -t 360 -T 30 -k 20 -A 1 -n 50 -N 100 -R -p 0.0.0.0:8080
procd_set_param stderr 1
procd_set_param respawn
procd_close_instance
}

View File

@@ -1 +0,0 @@
uhttpd -f -h /demo -r Test -x /cgi-bin/luci/istorenext/cgi-bin -u /ubus -t 360 -T 30 -k 20 -A 1 -n 50 -N 100 -R -p 0.0.0.0:8080

View File

@@ -1,4 +1,5 @@
map $request_method:$query_string $login_request {
default 0;
~^POST:istorenextlogin=1$ 1;
~^GET:istorenextlogin=1$ 2;
}

View File

@@ -1,9 +1,13 @@
if ($login_request = 2) {
return 302 $uri;
}
proxy_intercept_errors on;
uwsgi_intercept_errors on;
error_page 403 /istorenext-login.html;
error_page 403 /cgi-bin/luci/istorenext-login;
location /cgi-bin/luci/istorenext {
location ~ ^/cgi-bin/luci/istorenext(/|$) {
include uwsgi_params;
uwsgi_param SERVER_ADDR $server_addr;

View File

@@ -1,9 +1,17 @@
<%
local util = require "luci.util"
local http = require "luci.http"
local boardinfo = util.ubus("system", "board")
http.prepare_content("text/html; charset=UTF-8")
-%>
<!DOCTYPE html>
<html lang="zh-CN">
<html lang="<%=luci.i18n.context.lang%>">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>登录</title>
<title><%=striptags( boardinfo.hostname or "?" ) %> - LuCI</title>
<style>
* {
margin: 0;
@@ -112,63 +120,66 @@
<body>
<div class="login-container">
<div class="login-header">
<h1>登录</h1>
<p>欢迎回来,请输入您的凭证</p>
<h1><%:Log in%></h1>
<p><%:Welcome back, please enter your credentials%></p>
</div>
<div id="errorMessage" class="error-message"></div>
<form action="?istorenextlogin=1" method="post" id="loginForm">
<div class="form-group">
<label for="username">用户名</label>
<label for="username"><%:Username%></label>
<input
type="text"
id="username"
name="luci_username"
required
autocomplete="username"
placeholder="请输入用户名"
placeholder="<%:Please enter username%>"
value="root">
</div>
<div class="form-group">
<label for="password">密码</label>
<label for="password"><%:Password%></label>
<input
type="password"
id="password"
name="luci_password"
autocomplete="current-password"
placeholder="请输入密码">
placeholder="<%:Please enter password%>">
</div>
<button type="submit" class="login-button">登录</button>
<button type="submit" class="login-button"><%:Log in%></button>
</form>
</div>
<script>
// 客户端表单验证
const errorMessage = document.getElementById('errorMessage');
if ("?istorenextlogin=1" == location.search) {
errorMessage.textContent = '<%:Invalid username and/or password! Please try again.%>';
errorMessage.classList.add('show');
}
document.getElementById('loginForm').addEventListener('submit', function(e) {
const username = document.getElementById('username').value.trim();
const errorMessage = document.getElementById('errorMessage');
if (!username) {
e.preventDefault();
errorMessage.textContent = '请输入用户名';
errorMessage.textContent = '<%:Please enter username%>';
errorMessage.classList.add('show');
return false;
}
// 清除错误消息
errorMessage.classList.remove('show');
});
// 输入时清除错误消息
const inputs = document.querySelectorAll('input');
inputs.forEach(input => {
input.addEventListener('input', function() {
document.getElementById('errorMessage').classList.remove('show');
errorMessage.classList.remove('show');
});
});
</script>
</body>
</html>
</html>

View File

@@ -10,5 +10,11 @@
"methods": [ "cookie:sysauth_https", "cookie:sysauth_http" ],
"login": true
}
},
"istorenext-login": {
"action": {
"type": "template",
"path": "istorenext/login"
}
}
}

View File

@@ -28,6 +28,7 @@ http {
map $request_method:$query_string $login_request {
default 0;
~^POST:istorenextlogin=1$ 1;
~^GET:istorenextlogin=1$ 2;
}
server { #see uci show 'nginx._redirect2ssl'
@@ -36,12 +37,16 @@ http {
server_name _redirect2ssl;
include restrict_locally;
if ($login_request = 2) {
return 302 $uri;
}
proxy_intercept_errors on;
uwsgi_intercept_errors on;
error_page 403 /istorenext-login.html;
error_page 403 /cgi-bin/luci/istorenext-login;
location /cgi-bin/luci/istorenext {
location ~ ^/cgi-bin/luci/istorenext(/|$) {
include uwsgi_params;
uwsgi_param SERVER_ADDR $server_addr;