Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion mihomo-control/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ noctalia msg plugin mdj2812/mihomo-control:service all self-test
## Development

- `service.luau` — headless API backend, publishes `mihomo.*` state.
- `group_logic.lua` — pure helpers for group ordering and traffic dedup (unit-tested).
- `group_logic.luau` — pure helpers for group ordering and traffic dedup (unit-tested).
- `widget.luau` — bar widget (rates + tooltip).
- `panel.luau` — control panel.
- `shortcut.luau` — rule/global mode toggle.
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion mihomo-control/plugin.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

id = "mdj2812/mihomo-control"
name = "Mihomo Control"
version = "0.1.2"
version = "0.1.3"
plugin_api = 9
author = "mdj2812"
license = "MIT"
Expand Down
14 changes: 3 additions & 11 deletions mihomo-control/service.luau
Original file line number Diff line number Diff line change
Expand Up @@ -44,15 +44,7 @@ local function require_group_logic()
if group_logic ~= nil then
return group_logic
end
local source, err = noctalia.readFile("group_logic.lua")
if source == nil then
error("failed to read group_logic.lua: " .. tostring(err))
end
local chunk, load_err = load(source, "@group_logic.lua")
if chunk == nil then
error("failed to load group_logic.lua: " .. tostring(load_err))
end
group_logic = chunk()
group_logic = require("./group_logic.luau")
return group_logic
end

Expand Down Expand Up @@ -669,7 +661,7 @@ local function run_self_test(quiet)
logic.apply_group_order(ordered, { "beta", "alpha" })
check(
"apply_group_order",
ordered[1].name == "beta" and ordered[2].name == "alpha" and ordered[3].name == "zeta",
ordered[1].name == "beta" and ordered[2].name == "alpha" and ordered[3].name == "zeta"
)

local reordered, order = logic.reorder_groups({
Expand All @@ -681,7 +673,7 @@ local function run_self_test(quiet)

check(
"traffic_changed",
logic.traffic_changed({ up = 1, down = 2, upTotal = 3, downTotal = 4 }, { up = 9, down = 2, upTotal = 3, downTotal = 4 }),
logic.traffic_changed({ up = 1, down = 2, upTotal = 3, downTotal = 4 }, { up = 9, down = 2, upTotal = 3, downTotal = 4 })
)

check("interval_at_load", interval_applied_at_load)
Expand Down
2 changes: 1 addition & 1 deletion mihomo-control/tests/group_order_test.lua
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ local function assert_tables_eq(actual, expected, message)
end
end

local logic = dofile(plugin_root() .. "/group_logic.lua")
local logic = dofile(plugin_root() .. "/group_logic.luau")

local groups = {
{ name = "zeta" },
Expand Down
Loading