├── README.md ├── luci-app-lucky ├── Makefile ├── luasrc │ ├── controller │ │ └── lucky.lua │ ├── model │ │ └── cbi │ │ │ └── lucky │ │ │ └── lucky.lua │ └── view │ │ └── lucky │ │ └── lucky_status.htm ├── po │ └── zh_Hans │ │ └── lucky.po └── root │ ├── etc │ └── uci-defaults │ │ └── 66_luci-lucky │ └── usr │ ├── bin │ └── luckyarch │ └── share │ ├── luci │ └── menu.d │ │ └── luci-app-lucky.json │ └── rpcd │ └── acl.d │ └── luci-app-lucky.json ├── lucky ├── Makefile └── files │ ├── lucky.init │ └── luckyuci └── previews ├── 001.png └── 002.png /README.md: -------------------------------------------------------------------------------- 1 | 2 | ## 怎么确定当前系统CPU架构下载相应lucky核心包 3 | 复制以下指令到终端执行,根据显示下载文件名含有架构字符串的ipk包 4 | ``` 5 | cd /tmp ;if [ -f /usr/bin/curl ];then curl -sSO http://release.66666.host/luckyarch.sh;else wget -O http://release.66666.host/luckyarch.sh;fi;sh luckyarch.sh 6 | ``` 7 | 8 | 9 | ## 1.X升级2.X版本注意 10 | 11 | 第一种方法:先通过lucky后台上传tar.gz方式升级lucky 12 | 再安装 13 | 14 | - luci-app-lucky 15 | - luci-i18n-lucky-zh-cn 16 | 17 | 两个ipk包 18 | 19 | 第二种方法: 20 | 21 | lucky后台备份配置下载保存后,将lucky相关IPK卸载干净 22 | ``` 23 | opkg remove lucky 24 | opkg remove luci-i18n-lucky-zh-cn 25 | opkg remove luci-app-lucky 26 | ``` 27 | 28 | 再安装 29 | - lucky 30 | - luci-app-lucky 31 | - luci-i18n-lucky-zh-cn 32 | 33 | 三个ipk包 34 | 35 | 36 | 37 | 本分支本人自用,仅供参考. 38 | 配置文件架构和https://github.com/sirpdboy/luci-app-lucky 版本可能存在冲突, 39 | 40 | 替换版本前请使用前备份下载lucky配置 41 | 42 | 然后执行执行 43 | ``` 44 | opkg remove lucky 45 | opkg remove luci-i18n-lucky-zh-cn 46 | opkg remove luci-app-lucky 47 | ``` 48 | 卸载删除干净之前文件. 49 | 50 | 51 | 52 | 53 | 最新版本编译好的IPK包请在 54 | https://url21.ctfile.com/d/44547821-55537427-a5525e?p=16601 55 | 下载 56 | 57 | 58 | 59 | 60 | 61 | ## 使用方法 62 | 63 | - 将luci-app-lucky添加至 LEDE/OpenWRT 源码的方法。 64 | 65 | 66 | 67 | ### 下载源码: 68 | 69 | ```Brach 70 | 71 | 进入lede/openwrt项目根目录下 72 | # 下载源码 73 | 74 | git clone https://github.com/gdy666/luci-app-lucky.git package/lucky 75 | 76 | ``` 77 | ### 配置菜单 78 | 79 | ```Brach 80 | make menuconfig 81 | # 找到 LuCI -> Applications, 选择 luci-app-lucky, 保存后退出。 82 | ``` 83 | 84 | ### 编译 85 | 86 | ```Brach 87 | # 编译lucky IPK包 88 | make package/lucky/lucky/compile V=s 89 | # 编译luci-app-lucky IPK包 90 | make package/lucky/luci-app-lucky/compile V=s 91 | 92 | ``` 93 | 94 | 95 | ## 截图 96 |  97 |  -------------------------------------------------------------------------------- /luci-app-lucky/Makefile: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | # Copyright (C) 2022-2023 gdy 4 | # 5 | # This is free software, licensed under the Apache License, Version 2.0 . 6 | # 7 | include $(TOPDIR)/rules.mk 8 | 9 | PKG_NAME:=luci-app-lucky 10 | PKG_VERSION:=2.2.2 11 | PKG_RELEASE:=1 12 | 13 | LUCI_TITLE:=LuCI Support for lucky 14 | LUCI_DEPENDS:=+lucky +luci-compat 15 | LUCI_PKGARCH:=all 16 | 17 | 18 | define Package/$(PKG_NAME)/install 19 | $(INSTALL_BIN) ./root/usr/bin/luckyarch $(1)/usr/bin/luckyarch 20 | endef 21 | 22 | include $(TOPDIR)/feeds/luci/luci.mk 23 | 24 | 25 | 26 | 27 | # call BuildPackage - OpenWrt buildroot signature 28 | -------------------------------------------------------------------------------- /luci-app-lucky/luasrc/controller/lucky.lua: -------------------------------------------------------------------------------- 1 | 2 | module("luci.controller.lucky", package.seeall) 3 | 4 | function index() 5 | if not nixio.fs.access("/etc/config/lucky") then 6 | return 7 | end 8 | 9 | entry({"admin", "services", "lucky"}, alias("admin", "services", "lucky", "setting"),_("Lucky"), 57).dependent = true 10 | entry({"admin", "services", "lucky", "setting"}, cbi("lucky/lucky"), _("Base Setting"), 20).leaf=true 11 | entry({"admin", "services", "lucky_status"}, call("act_status")) 12 | entry({"admin", "services", "lucky_info"}, call("lucky_info")) 13 | entry({"admin", "services", "lucky_set_config"}, call("lucky_set_config")) 14 | entry({"admin", "services", "lucky_service"}, call("lucky_service")) 15 | end 16 | 17 | 18 | 19 | 20 | function act_status() 21 | local sys = require "luci.sys" 22 | local e = { } 23 | e.running = sys.call("pgrep -f 'lucky -c' >/dev/null") == 0 24 | luci.http.prepare_content("application/json") 25 | luci.http.write_json(e) 26 | end 27 | 28 | 29 | 30 | 31 | function lucky_info() 32 | local e = { } 33 | 34 | 35 | 36 | local luckyInfo = luci.sys.exec("/usr/bin/lucky -info") 37 | if (luckyInfo~=nil) 38 | then 39 | e.luckyInfo = luckyInfo 40 | local configObj = GetLuckyConfigureObj() 41 | if (configObj~=nil) 42 | then 43 | e.LuckyBaseConfigure = configObj["BaseConfigure"] 44 | end 45 | 46 | end 47 | e.luckyArch = luci.sys.exec("/usr/bin/luckyarch") 48 | --e.runStatus = luci.sys.call("pidof lucky >/dev/null") == 0 49 | 50 | 51 | luci.http.prepare_content("application/json") 52 | luci.http.write_json(e) 53 | end 54 | 55 | 56 | function lucky_set_config() 57 | local key = luci.http.formvalue("key") 58 | local value = luci.http.formvalue("value") 59 | 60 | local e = { } 61 | e.ret = 1 62 | if (key == "admin_http_port") 63 | then 64 | e.ret =setLuckyConf("AdminWebListenPort",value) 65 | end 66 | 67 | if(key=="admin_safe_url") 68 | then 69 | e.ret =setLuckyConf("SetSafeURL",value) 70 | end 71 | 72 | if(key=="reset_auth_info") 73 | then 74 | setLuckyConf("AdminAccount","666") 75 | setLuckyConf("AdminPassword","666") 76 | luci.sys.exec("/etc/init.d/lucky restart") 77 | e.ret=0 78 | end 79 | if(key=="switch_Internetaccess") 80 | then 81 | e.ret =setLuckyConf("AllowInternetaccess",value) 82 | end 83 | 84 | 85 | 86 | 87 | luci.http.prepare_content("application/json") 88 | luci.http.write_json(e) 89 | end 90 | 91 | 92 | function lucky_service() 93 | local action = luci.http.formvalue("action") 94 | if (action=="restart") 95 | then 96 | luci.sys.exec("uci set lucky.@lucky[0].enabled=1") 97 | luci.sys.exec("uci commit") 98 | luci.sys.exec("/etc/init.d/lucky restart") 99 | end 100 | 101 | if (action=="start") 102 | then 103 | luci.sys.exec("uci set lucky.@lucky[0].enabled=1") 104 | luci.sys.exec("uci commit") 105 | luci.sys.exec("/etc/init.d/lucky start") 106 | end 107 | 108 | if (action=="stop") 109 | then 110 | luci.sys.exec("uci set lucky.@lucky[0].enabled=0") 111 | luci.sys.exec("uci commit") 112 | luci.sys.exec("/etc/init.d/lucky stop") 113 | end 114 | 115 | end 116 | 117 | 118 | function trim(s) 119 | return (string.gsub(s, "^%s*(.-)%s*$", "%1")) 120 | end 121 | 122 | 123 | function GetLuckyConfigureObj() 124 | configPath = trim(luci.sys.exec("uci get lucky.@lucky[0].configdir")) 125 | local configContent = luci.sys.exec("lucky -baseConfInfo -cd "..configPath) 126 | 127 | configObj = luci.jsonc.parse(trim(configContent)) 128 | return configObj 129 | end 130 | 131 | 132 | 133 | function setLuckyConf(key,value) 134 | configPath = trim(luci.sys.exec("uci get lucky.@lucky[0].configdir")) 135 | 136 | cmd = "/usr/bin/lucky ".." -setconf ".."-key "..key.." -value "..value.." -cd "..configPath 137 | if (value=="") 138 | then 139 | cmd = "/usr/bin/lucky ".." -setconf ".."-key "..key.." -cd "..configPath 140 | end 141 | 142 | 143 | luci.sys.exec(cmd) 144 | 145 | 146 | return 0 147 | end -------------------------------------------------------------------------------- /luci-app-lucky/luasrc/model/cbi/lucky/lucky.lua: -------------------------------------------------------------------------------- 1 | -- 2 | local m, s ,o 3 | 4 | local m = Map("lucky", translate("Lucky"), translate("ipv4/ipv6 portforward,ddns,reverseproxy proxy,wake on lan,IOT and more...") ) 5 | 6 | m:section(SimpleSection).template = "lucky/lucky_status" 7 | 8 | s = m:section(TypedSection, "lucky", translate("Basic Settings")) 9 | s.addremove=false 10 | s.anonymous=true 11 | 12 | --o=s:option(Flag,"enabled",translate("Enable")) 13 | --o.default=0 14 | 15 | o = s:option( Value, "configdir", translate("Config dir path"), 16 | translate("The path to store the config file")) 17 | o.placeholder = "/etc/config/lucky.daji" 18 | 19 | 20 | m.apply_on_parse = true 21 | m.on_after_apply = function(self,map) 22 | luci.sys.exec("/etc/init.d/lucky restart") 23 | end 24 | 25 | return m 26 | -------------------------------------------------------------------------------- /luci-app-lucky/luasrc/view/lucky/lucky_status.htm: -------------------------------------------------------------------------------- 1 | 11 | 12 |
15 | 16 | 17 | 26 | 27 | 52 | 53 | 66 | 67 | 68 | 69 | 70 | -------------------------------------------------------------------------------- /luci-app-lucky/po/zh_Hans/lucky.po: -------------------------------------------------------------------------------- 1 | msgid "" 2 | msgstr "Content-Type: text/plain; charset=UTF-8" 3 | 4 | msgid "Main Program" 5 | msgstr "主程序" 6 | 7 | msgid "Main Program Information" 8 | msgstr "主程序信息" 9 | 10 | msgid "Installation Status" 11 | msgstr "安装状态" 12 | 13 | msgid "Compilation Time" 14 | msgstr "编译时间" 15 | 16 | msgid "Admin Panel Information" 17 | msgstr "管理面板信息" 18 | 19 | msgid "Config dir path" 20 | msgstr "配置文件夹位置" 21 | 22 | msgid "Lucky" 23 | msgstr "Lucky" 24 | 25 | msgid "ipv4/ipv6 portforward,ddns,reverseproxy proxy,wake on lan,IOT and more..." 26 | msgstr "IPv4/IPv6端口转发,动态域名服务,http/https反向代理,网络唤醒(可通过第三方物联网平台接入各大语音助手实现语音控制开关电脑)" 27 | 28 | msgid "Running state" 29 | msgstr "运行状态" 30 | 31 | msgid "The Lucky service is running." 32 | msgstr "已启动" 33 | 34 | msgid "The Lucky service is not running." 35 | msgstr "未启动" 36 | 37 | msgid "Lucky Status" 38 | msgstr "Lucky服务状态" 39 | 40 | msgid "Collecting data..." 41 | msgstr "收集数据..." 42 | 43 | msgid "Set the Lucky access port" 44 | msgstr "设置访问端口" 45 | 46 | msgid "For specific usage, see:" 47 | msgstr "具体使用方法参见:" 48 | 49 | msgid "Base Setting" 50 | msgstr "基本设置" 51 | 52 | msgid "Not installed" 53 | msgstr "没有安装" 54 | 55 | msgid "Installed" 56 | msgstr "已安装" 57 | 58 | msgid "Admin Panel Login HTTP URL" 59 | msgstr "管理后台登录地址(http)" 60 | 61 | msgid "Lucky Arch" 62 | msgstr "当前环境CPU架构" 63 | 64 | msgid "Lucky Status" 65 | msgstr "Lucky运行状态" 66 | 67 | msgid "Lucky Compilation time" 68 | msgstr "编译时间" 69 | 70 | msgid "Lucky Version" 71 | msgstr "版本" 72 | 73 | msgid "Admin Panel Login Info" 74 | msgstr "管理后台登录信息" 75 | 76 | msgid "Account" 77 | msgstr "账号" 78 | 79 | msgid "Password" 80 | msgstr "密码" 81 | 82 | msgid "Admin Panel" 83 | msgstr "Lucky 后台管理" 84 | 85 | msgid "Open AdminURL" 86 | msgstr "打开后台管理" 87 | 88 | msgid "Lucky Admin Http Port" 89 | msgstr "Lucky 后台HTTP端口" 90 | 91 | msgid "Change" 92 | msgstr "更改" 93 | 94 | msgid "portValueError" 95 | msgstr "端口值有误" 96 | 97 | msgid "Get Lucky Latest Version" 98 | msgstr "获取Lucky最新版本" 99 | 100 | msgid "get latest version" 101 | msgstr "查询最新" 102 | 103 | msgid "Admin Safe URL" 104 | msgstr "安全入口" 105 | 106 | msgid "DefaultAuth" 107 | msgstr "默认登录账号密码" 108 | 109 | msgid "Reset 666 as admin account and password?" 110 | msgstr "重置账号密码为666?" 111 | 112 | msgid "update success" 113 | msgstr "修改成功" 114 | 115 | msgid "update failed" 116 | msgstr "修改失败" 117 | 118 | msgid "Allow Internet access" 119 | msgstr "外网登录后台" 120 | 121 | msgid "Are you sure Enalbe Internetaccess?" 122 | msgstr "确定要启用外网访问?" 123 | 124 | msgid "Are you sure Disable Internetaccess?" 125 | msgstr "确定要禁用外网访问?" 126 | 127 | msgid "are you sure stop lucky service?" 128 | msgstr "确定要停止Lucky服务?" 129 | 130 | msgid "are you sure start lucky service?" 131 | msgstr "确定要启动Lucky服务?" 132 | 133 | msgid "Config file path" 134 | msgstr "配置文件存放位置" 135 | 136 | msgid "The path to store the config file" 137 | msgstr "存放配置文件的位置" 138 | 139 | msgid "allow" 140 | msgstr "允许" 141 | 142 | msgid "not allow" 143 | msgstr "禁止" 144 | 145 | msgid "Basic Settings" 146 | msgstr "基础设置" -------------------------------------------------------------------------------- /luci-app-lucky/root/etc/uci-defaults/66_luci-lucky: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | uci -q batch <<-EOF >/dev/null 4 | delete ucitrack.@lucky[-1] 5 | add ucitrack lucky 6 | set ucitrack.@lucky[-1].init=lucky 7 | commit ucitrack 8 | EOF 9 | 10 | chmod +x /usr/bin/luckyarch 11 | rm -f /tmp/luci-indexcache* 2>/dev/null 12 | rm -f /tmp/luci-modulecache/* 2>/dev/null # 针对OpenWrt 21.02+ 13 | rm -f /tmp/luci-indexcache 14 | return 0 -------------------------------------------------------------------------------- /luci-app-lucky/root/usr/bin/luckyarch: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | cputype=$(uname -ms | tr ' ' '_' | tr '[A-Z]' '[a-z]') 4 | [ -n "$(echo $cputype | grep -E "linux.*armv.*")" ] && cpucore="armv5" 5 | [ -n "$(echo $cputype | grep -E "linux.*armv7.*")" ] && [ -n "$(cat /proc/cpuinfo | grep vfp)" ] && [ ! -d /jffs/clash ] && cpucore="armv7" 6 | [ -n "$(echo $cputype | grep -E "linux.*aarch64.*|linux.*armv8.*")" ] && cpucore="arm64" 7 | [ -n "$(echo $cputype | grep -E "linux.*86.*")" ] && cpucore="i386" 8 | [ -n "$(echo $cputype | grep -E "linux.*86_64.*")" ] && cpucore="x86_64" 9 | if [ -n "$(echo $cputype | grep -E "linux.*mips.*")" ];then 10 | mipstype=$(echo -n I | hexdump -o 2>/dev/null | awk '{ print substr($2,6,1); exit}') #通过判断大小端判断mips或mipsle 11 | [ "$mipstype" = "0" ] && cpucore="mips_softfloat" || cpucore="mipsle_softfloat" 12 | fi 13 | 14 | echo $cpucore 15 | -------------------------------------------------------------------------------- /luci-app-lucky/root/usr/share/luci/menu.d/luci-app-lucky.json: -------------------------------------------------------------------------------- 1 | { 2 | "admin/services/lucky": { 3 | "title": "Lucky", 4 | "order": 60, 5 | "action": { 6 | "type": "view", 7 | "path": "lucky" 8 | }, 9 | "depends": { 10 | "acl": ["luci-app-lucky"], 11 | "uci": {"lucky": true} 12 | } 13 | } 14 | } -------------------------------------------------------------------------------- /luci-app-lucky/root/usr/share/rpcd/acl.d/luci-app-lucky.json: -------------------------------------------------------------------------------- 1 | { 2 | "luci-app-lucky": { 3 | "description": "Grant UCI access for luci-app-lucky", 4 | "read": { 5 | "ubus": { 6 | "service": [ "list" ] 7 | }, 8 | "uci": [ "lucky" ] 9 | }, 10 | "write": { 11 | "uci": [ "lucky" ] 12 | } 13 | } 14 | } -------------------------------------------------------------------------------- /lucky/Makefile: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-3.0-only 2 | # 3 | 4 | include $(TOPDIR)/rules.mk 5 | 6 | PKG_NAME:=lucky 7 | PKG_VERSION:=2.17.8 8 | PKG_RELEASE:=1 9 | PKGARCH:=all 10 | LUCKY_CONF_DIR := /etc/config/lucky.daji 11 | LUCKY_TMP_BACKUP := /tmp/luckyconfdir 12 | 13 | ifeq ($(ARCH),mipsel) 14 | LUCKY_ARCH:=mipsle_softfloat 15 | endif 16 | ifeq ($(ARCH),mips) 17 | LUCKY_ARCH:=mips_softfloat 18 | endif 19 | ifeq ($(ARCH),i386) 20 | LUCKY_ARCH:=i386 21 | endif 22 | ifeq ($(ARCH),x86_64) 23 | LUCKY_ARCH:=x86_64 24 | endif 25 | ifeq ($(ARCH),arm) 26 | ifeq ($(BOARD),bcm53xx) 27 | LUCKY_ARCH:=armv6 28 | else 29 | LUCKY_ARCH:=armv7 30 | endif 31 | endif 32 | ifeq ($(BOARD),bcm53xx) 33 | LUCKY_ARCH:=armv6 34 | ifeq ($(word 2,$(subst +,$(space),$(call qstrip,$(CONFIG_CPU_TYPE)))),) 35 | LUCKY_ARCH:=armv5 36 | endif 37 | endif 38 | ifeq ($(BOARD),kirkwood) 39 | LUCKY_ARCH:=armv5 40 | endif 41 | ifeq ($(ARCH),aarch64) 42 | LUCKY_ARCH:=arm64 43 | endif 44 | 45 | PKG_LICENSE:=GPL-3.0-only 46 | PKG_LICENSE_FILES:=LICENSE 47 | PKG_MAINTAINER:=GDY666