[PATCH luci] luci-base: use actual JSON-RPC for verifying ubus RPC URL

Rafał Miłecki zajec5 at gmail.com
Tue Sep 15 04:37:09 EDT 2020


On 14.09.2020 18:31, Rafał Miłecki wrote:
> @@ -2553,10 +2553,19 @@
>   				rpcBaseURL = Session.getLocalData('rpcBaseURL');
>   
>   			if (rpcBaseURL == null) {
> +				var msg = {
> +					jsonrpc: '2.0',
> +					id:      'init',
> +					method:  'list',
> +					params:  undefined
> +				};
> +				var options = {
> +					nobatch: true
> +				};
>   				var rpcFallbackURL = this.url('admin/ubus');
>   
> -				rpcBaseURL = Request.get(env.ubuspath).then(function(res) {
> -					return (rpcBaseURL = (res.status == 400) ? env.ubuspath : rpcFallbackURL);
> +				rpcBaseURL = Request.post(env.ubuspath, msg, options).then(function(res) {
> +					return (rpcBaseURL = res.status == 200 ? env.ubuspath : rpcFallbackURL);

Pushing with "options" variable object inlined.



More information about the openwrt-devel mailing list