Skip to content

Commit 2d1d456

Browse files
committed
chore: htm cache
1 parent aafe3db commit 2d1d456

4 files changed

Lines changed: 30 additions & 10 deletions

File tree

luci-app-openclash/luasrc/openclash.lua

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -498,3 +498,17 @@ function ps_cmd()
498498
return "ps -w"
499499
end
500500
end
501+
502+
--- Returns the installed version of luci-app-openclash.
503+
-- Supports both opkg and apk package managers.
504+
-- @return String containing the version number, or "0" if not found
505+
function oc_version()
506+
local v = SYS.exec("opkg status luci-app-openclash 2>/dev/null |grep '^Version:' |awk '{print $2}' |tr -d '\n'")
507+
if v == "" then
508+
v = SYS.exec("apk info luci-app-openclash 2>/dev/null |grep '^luci-app-openclash-[0-9]' |sed 's/luci-app-openclash-//' |tr -d '\n'")
509+
end
510+
if v == "" then
511+
v = "0"
512+
end
513+
return v
514+
end

luci-app-openclash/luasrc/view/openclash/config_editor.htm

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
1-
<link rel="stylesheet" href="/luci-static/resources/openclash/css/oc.css">
1+
<%
2+
local fs = require "luci.openclash"
3+
local plugin_version = fs.oc_version()
4+
%>
5+
<link rel="stylesheet" href="/luci-static/resources/openclash/css/oc.css?v=<%=plugin_version%>">
26
<script type="text/javascript">//<![CDATA[
37
var _cmReady = false;
48
var _cmQueue = [];

luci-app-openclash/luasrc/view/openclash/status.htm

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,13 @@
11
<%
2-
local random = tostring(os.time()):reverse():sub(1, 9)
2+
local fs = require "luci.openclash"
3+
local plugin_version = fs.oc_version()
4+
local uci = require("luci.model.uci").cursor()
5+
local RELEASE_BRANCH = fs.uci_get_config("config", "release_branch")
36
%>
47
<html>
58
<head>
6-
<link rel="stylesheet" href="/luci-static/resources/openclash/css/oc.css?v=<%=random%>">
9+
<link rel="stylesheet" href="/luci-static/resources/openclash/css/oc.css?v=<%=plugin_version%>">
710
</head>
8-
<%
9-
local uci = require("luci.model.uci").cursor()
10-
local fs = require "luci.openclash"
11-
local RELEASE_BRANCH = fs.uci_get_config("config", "release_branch")
12-
%>
1311
<fieldset class="cbi-section">
1412
<table width="100%">
1513
<tr>
@@ -94,7 +92,7 @@
9492
<button type="button" class="icon-btn action-btn" id="go_telegram" title="<%:Telegram%>" onclick="return telegrampage()"><svg width="14" height="14" viewBox="0 0 256 256" fill="none" stroke="currentColor" stroke-width="20"><path d="M80,134.87,170.26,214a8,8,0,0,0,13.09-4.21L224,33.22a1,1,0,0,0-1.34-1.15L20,111.38A6.23,6.23,0,0,0,21,123.3Z" stroke-linecap="round" stroke-linejoin="round"/><line x1="80" y1="134.87" x2="223.41" y2="32.09" stroke-linecap="round" stroke-linejoin="round"/><path d="M124.37,173.78,93.76,205.54A8,8,0,0,1,80,200V134.87" stroke-linecap="round" stroke-linejoin="round"/></svg></button>
9593
<button type="button" class="icon-btn action-btn" id="go_sponsor" title="<%:Sponsor%>" onclick="return sponsorpage()"><svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M20.84 4.61a5.5 5.5 0 0 0-7.78 0L12 5.67l-1.06-1.06a5.5 5.5 0 0 0-7.78 7.78l1.06 1.06L12 21.23l7.78-7.78 1.06-1.06a5.5 5.5 0 0 0 0-7.78z"></path></svg></button>
9694
<button type="button" class="icon-btn action-btn" id="logo_btn" title="Mihomo" onclick="return go_mihomo();">
97-
<img id="_logo" src="/luci-static/resources/openclash/img/logo.png?<%=random%>" loading="lazy" width="14px" height="14px" alt="Mihomo"/>
95+
<img id="_logo" src="/luci-static/resources/openclash/img/logo.png?v=<%=plugin_version%>" loading="lazy" width="14px" height="14px" alt="Mihomo"/>
9896
<span class="logo-text">Powered by <span class="mihomo-link">Mihomo</span></span>
9997
</button>
10098
</div>

luci-app-openclash/luasrc/view/openclash/toolbar_show.htm

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
1+
<%
2+
local fs = require "luci.openclash"
3+
local plugin_version = fs.oc_version()
4+
%>
15
<head>
2-
<link rel="stylesheet" href="/luci-static/resources/openclash/css/oc.css">
6+
<link rel="stylesheet" href="/luci-static/resources/openclash/css/oc.css?v=<%=plugin_version%>">
37
</head>
48

59
<li id="tool_label" class="tool_label">

0 commit comments

Comments
 (0)