Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

luci-app-ddns: fix toggle state button #7426

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Try2079
Copy link

@Try2079 Try2079 commented Nov 26, 2024

  • This PR is not from my main or master branch πŸ’©, but a separate branch βœ…
  • Each commit has a valid βœ’οΈ Signed-off-by: <my@email.address> row (via git commit --signoff)
  • Each commit and PR title has a valid πŸ“ <package name>: title first line subject for packages
  • Incremented πŸ†™ any PKG_VERSION in the Makefile
  • Tested on: (x86_64, v23.05.5, chrome) βœ…
  • ( Preferred ) Mention: @systemcrash
  • ( Preferred ) Screenshot or mp4 of changes:
  • ( Optional ) Closes: luci-app-ddns: Toggle Button Won't Work.Β #7423#issuecomment-2498227219
  • Description: Fixed toggle state button. This is my first time using pull request on github. Please forgive me if there is anything wrong.

Signed-off-by: Try2079 <114682512+Try2079@users.noreply.github.com>
@systemcrash
Copy link
Contributor

See 8d26279. This might close this issue.

@Try2079
Copy link
Author

Try2079 commented Dec 4, 2024

I think it won't work. Because this.callInitAction() only return true, it never return false.

# sys.lua
local function init_action(action, name)
	name = fs.basename(name)
	if fs.access(init.dir..name) then
		return call("env -i %s%s %s >/dev/null" %{ init.dir, name, action })
	end
end
// luci
setInitAction: {
	args: { name: 'name', action: 'action' },
	call: function(request) {
		switch (request.args.action) {
		case 'enable':
		case 'disable':
		case 'start':
		case 'stop':
		case 'restart':
		case 'reload':
			const rc = init_action(request.args.name, request.args.action);

			if (rc === false)
				return { error: 'No such init script' };

			return { result: rc == 0 };

		default:
			return { error: 'Invalid action' };
		}
	}
},

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

luci-app-ddns: Toggle Button Won't Work.
2 participants