diff --git a/luciexpress/htdocs/js/uci.js b/luciexpress/htdocs/js/uci.js
index 1d57b5307..020a3ea36 100644
--- a/luciexpress/htdocs/js/uci.js
+++ b/luciexpress/htdocs/js/uci.js
@@ -405,10 +405,10 @@
if(self[x].constructor == UCI.Section) to_delete[x] = self[x];
});
//console.log("To delete: "+Object.keys(to_delete));
- /*$rpc.uci.rollback({
- config: self[".name"],
- ubus_rpc_session: $rpc.$sid()
- }).done(function(){*/
+ $rpc.uci.revert({
+ config: self[".name"]//,
+ //ubus_rpc_session: $rpc.$sid()
+ }).done(function(){
$rpc.uci.state({
config: self[".name"]
}).done(function(data){
@@ -433,9 +433,9 @@
}).fail(function(){
deferred.reject();
});
- /*}).fail(function(){
+ }).fail(function(){
deferred.reject("Could not revert config before sync!");
- }); */
+ });
return deferred.promise();
}
// set object values on objects that match search criteria
diff --git a/luciexpress/htdocs/plugins/settings/pages/settings.energy.html b/luciexpress/htdocs/plugins/settings/pages/settings.energy.html
index 4b2b8988b..517c69579 100644
--- a/luciexpress/htdocs/plugins/settings/pages/settings.energy.html
+++ b/luciexpress/htdocs/plugins/settings/pages/settings.energy.html
@@ -17,6 +17,7 @@
+
diff --git a/luciexpress/share/acl.d/luci2.json b/luciexpress/share/acl.d/luci2.json
index 3a5a665f5..57d709f18 100644
--- a/luciexpress/share/acl.d/luci2.json
+++ b/luciexpress/share/acl.d/luci2.json
@@ -141,7 +141,8 @@
"dropbear",
"easybox",
"hosts",
- "voice_client"
+ "voice_client",
+ "juci"
]
},
"write": {
diff --git a/rpcd/src/uci.c b/rpcd/src/uci.c
index acbbfd808..5b6183c7b 100644
--- a/rpcd/src/uci.c
+++ b/rpcd/src/uci.c
@@ -1161,7 +1161,35 @@ rpc_uci_revert(struct ubus_context *ctx, struct ubus_object *obj,
struct ubus_request_data *req, const char *method,
struct blob_attr *msg)
{
- return rpc_uci_revert_commit(ctx, msg, false);
+ struct blob_attr *tb[__RPC_C_MAX];
+ //struct uci_package *p = NULL;
+ struct uci_ptr ptr = { 0 };
+
+ blobmsg_parse(rpc_uci_config_policy, __RPC_C_MAX, tb,
+ blob_data(msg), blob_len(msg));
+
+ if (!tb[RPC_C_CONFIG])
+ return UBUS_STATUS_INVALID_ARGUMENT;
+
+ if (!rpc_uci_write_access(tb[RPC_C_SESSION], tb[RPC_C_CONFIG]))
+ return UBUS_STATUS_PERMISSION_DENIED;
+
+ char *package = blobmsg_data(tb[RPC_C_CONFIG]);
+ int ret = UCI_OK;
+
+ if (uci_lookup_ptr(cursor, &ptr, package, true) == UCI_OK){
+ //printf("Reverting %s\n", ptr.package);
+ ret = uci_revert(cursor, &ptr);
+ if(ptr.p) uci_unload(cursor, ptr.p);
+ }
+
+ blob_buf_init(&buf, 0);
+
+ blobmsg_add_u32(&buf, "code", ret);
+
+ ubus_send_reply(ctx, req, buf.head);
+
+ return ret;
}
static int