Skip to content

luci-app-v2raya: add overview and richer settings - #9220

Closed
amrfateem wants to merge 1 commit into
openwrt:masterfrom
amrfateem:luci-app-v2raya-overview
Closed

amrfateem wants to merge 1 commit into
openwrt:masterfrom
amrfateem:luci-app-v2raya-overview

Conversation

@amrfateem

@amrfateem amrfateem commented Nov 9, 2026 •

Copy link
Copy Markdown

Pull request details

Description

This replaces the minimal v2rayA configuration form with three pages:

  • Overview: service state, v2rayA and v2raya_core versions, listening
    address, web UI link, and start/stop/restart buttons.
  • Settings: tabbed form for general, transparent proxy, logging and
    advanced options that the OpenWrt init script supports (base URL, core
    startup timeout, hooks, Go memory/scheduler limits, descriptor limit).
  • Log: the tail of /var/log/v2raya/v2raya.log with refresh and clear.

The overview uses /usr/libexec/v2raya-detect from the v2raya package to
show installed cores and to warn about a second transparent-proxy stack.
When that helper is missing (v2raya 2.2.x), the overview skips detection
instead of reporting false results.

The menu and ACL use the existing admin/services/v2raya paths and the ACL
adds only the exec/read permissions the pages need. The existing po/
translations are untouched; new strings fall back to English until
Weblate regenerates them.

Screenshot or video of changes (if applicable)

Not included; the pages use the standard LuCI form, table and pre
elements and have no custom styling.

Maintainer (preferred)

@cnsztl, @amrfateem

Checklist

I built the app from the luci feed in the 25.12.6 ipq40xx SDK; the
modules pass the LuCI minifier and the same views are deployed on an
OpenWrt 25.12 ipq40xx router running v2raya 2.5.13.

I used an AI assistant to help draft the code and this description; I
reviewed every line and take responsibility for it.

This app targets v2rayA 2.5.13 from openwrt/packages#31203. The extra
settings and the core detection depend on the 2.5.x init script and the
detection helper; with the 2.2.x package currently in the feed they are
stored but ignored, and detection is skipped. The PR is a draft until
#31203 merges.

amrfateem added a commit to amrfateem/luci-V2raya-NextGen that referenced this pull request Nov 9, 2026
Add the upstream-shaped luci-app-v2raya tree under contrib/upstream,
install v2raya-detect from the service package for the LuCI overview,
and record the open openwrt/packages#31203 and openwrt/luci#9220 pull
requests.

Also make the overview persist enabled=1 when the Start button is used,
skip false core warnings when the detection helper is absent, and check
both /usr/share/v2ray and /usr/share/v2raya for rule data.

Signed-off-by: Amr Fateem <amr.fateem@yahoo.com>
};
o.description = _('The web interface listens on this address. Use 127.0.0.1:2017 to keep it off the LAN.');

o = s.taboption('general', form.Value, 'baseurl', _('Base URL'));

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Frontend-only with no backend consumer: the v2raya package currently in packages (2.2.7.5, +xray-core) only exports the options in start_service at v2raya.init:46-57. baseurl, core_startup_timeout, redirect_respect_bound_device, v2ray_assetsdir, gomemlimit, gomaxprocs, gogc and nofile are ignored, and the "v2raya_core only" texts are wrong for the xray-core based package. Is this meant to wait for openwrt/packages#31203? If so, the PR description should say these settings depend on it, not only the detection helper.


Generated by Claude Code

return m.render();
},

handleSaveApply: function (ev, mode) {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The comment's premise is wrong. The default handleSaveApply never restarts the service. It calls ui.changes.apply(), and this override loses that call's apply modal, page reload, and the unchecked-apply mode. Drop the override.


Generated by Claude Code

uci.set('v2raya', 'config', 'enabled', '1');

return L.resolveDefault(uci.save(), null).then(function () {
return runAction('start', button);

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

uci.save() only stages enabled=1 in the session delta, so the init script still sees enabled=0 and returns early at v2raya.init:37. Start does nothing on a disabled service until the later uci.apply() fires the reload trigger. Run uci.apply() before runAction('start'), or skip the explicit start.


Generated by Claude Code

"description": "Grant access to the v2rayA service and configuration",
"read": {
"file": {
"/etc/init.d/v2raya": [ "exec" ],

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Putting init-script exec in the read section lets read-only users stop and restart the service. Keep it only under write, and list the allowed commands as other apps do, e.g. luci-app-adblock's ACL:`` "/etc/init.d/v2raya start", `"... stop"`, `"... restart"`.

Suggested change
"/etc/init.d/v2raya": [ "exec" ],

Generated by Claude Code

return E('div', { class: 'cbi-map' }, [
E('h2', {}, _('v2rayA')),
E('div', { class: 'cbi-map-descr' }, [
_('A web client for its own Xray-based core, with transparent proxy support.'),

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: "Xray-based core" contradicts line 170 and the settings page, which say Xray-core is never used as the v2rayA backend.


Generated by Claude Code

E('h2', {}, _('v2rayA log')),
E('div', { class: 'cbi-map-descr' },
_('Showing the last %d lines of %s. Refreshes every %d seconds.')
.format(MAX_LINES, LOG_PATH, L.env.pollinterval || 5)),

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: poll.add(refresh, 5) hardcodes 5 s, so showing L.env.pollinterval can state the wrong interval.

Suggested change
.format(MAX_LINES, LOG_PATH, L.env.pollinterval || 5)),
.format(MAX_LINES, LOG_PATH, 5)),

Generated by Claude Code

@amrfateem
amrfateem force-pushed the luci-app-v2raya-overview branch from 23bccf5 to 8ff1690 Compare November 11, 2026 16:51
Replace the single settings form with three pages: an overview with the
service state, versions, detected cores and start/stop controls; a
tabbed settings form for the options the 2.5.x init script supports; and
a log viewer with refresh and clear.

The overview reads /usr/libexec/v2raya-detect, which the v2raya package
installs, to report the installed core and any other proxy service.
Detection is skipped cleanly when the helper is absent. The extra
settings are consumed by the 2.5.x init script; older releases store but
ignore them.

Signed-off-by: Amr Fateem <amr.fateem@yahoo.com>
@amrfateem
amrfateem force-pushed the luci-app-v2raya-overview branch from 8ff1690 to bac74fb Compare November 11, 2026 16:51
@amrfateem
amrfateem marked this pull request as draft November 11, 2026 16:55
@amrfateem

Copy link
Copy Markdown
Author

Addressed in bac74fb:

  • dropped the custom handleSaveApply; the default apply modal, reload and mode handling are back;
  • Start now commits enabled=1 with uci.apply() before running the start action, so the init script sees it;
  • the ACL keeps init-script exec under write and lists only start, stop and restart; read-only users can no longer control the service;
  • the log page uses one POLL_INTERVAL constant in both the description and poll.add;
  • the overview says "bundled v2raya_core" instead of "Xray-based core";
  • the PR is now a draft and the description states that the extra settings and detection depend on v2raya: update to 2.5.13 packages#31203 (v2raya 2.5.13).

amrfateem added a commit to amrfateem/luci-V2raya-NextGen that referenced this pull request Nov 11, 2026
Record that openwrt/luci#9220 is a draft until openwrt/packages#31203 lands, and that it needs to be marked ready after the merge.

Signed-off-by: Amr Fateem <amr.fateem@yahoo.com>
@amrfateem amrfateem closed this Nov 11, 2026
@amrfateem
amrfateem deleted the luci-app-v2raya-overview branch November 11, 2026 20:08
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.

2 participants