luci-app-privoxy: add support for https inspection
authorRichard Schneidt <redacted>
Sun, 7 Jun 2026 07:37:59 +0000 (07:37 +0000)
committerHannu Nyman <redacted>
Sun, 14 Jun 2026 06:34:52 +0000 (09:34 +0300)
Enables the user to create a custom ca and enable https inspection

Signed-off-by: Richard Schneidt <redacted>
applications/luci-app-privoxy/htdocs/luci-static/resources/view/privoxy/privoxy.js
applications/luci-app-privoxy/root/usr/share/rpcd/acl.d/luci-app-privoxy.json

index 691b9bd3c3d3dc1580fdb9a3f47d8a94dcee56b6..72ef2619eaab063c23c4337c855310b52ec6d863 100644 (file)
@@ -260,7 +260,10 @@ return view.extend({
                let caCertPath = s.taboption("https", form.DummyValue, '_ca_cert_path', _('CA Certificate Path'),
                        _('Path to the CA certificate file. Install this in your browser/trusted CA store on each client.'));
                caCertPath.rawhtml = true;
-               caCertPath.default = '/etc/privoxy/ssl/ca-cert.pem';
+               caCertPath.cfgvalue = function(section_id) {
+                       var dir = uci.get(this.map.config, section_id, 'certdir') || '/etc/privoxy/ssl';
+                       return dir + '/ca-cert.pem';
+               };
 
                // Download button
                let downloadBtn = s.taboption("https", form.Button, '_download_ca_cert', _('Download CA Certificate'),
@@ -268,8 +271,7 @@ return view.extend({
                downloadBtn.inputstyle = 'primary';
                downloadBtn.inputtitle = _('Download CA Certificate');
                downloadBtn.onclick = L.bind(function() {
-                       var certDir = document.querySelector('input[name="w.-privoxy.-privoxy.certdir"]');
-                       var dir = certDir ? certDir.value : '/etc/privoxy/ssl';
+                       var dir = certdir.formvalue('privoxy') || '/etc/privoxy/ssl';
                        var certPath = dir + '/ca-cert.pem';
 
                        fs.read_direct(certPath, 'blob').then(function(blob) {
@@ -298,12 +300,10 @@ return view.extend({
                        if (confirm(_('Are you sure you want to regenerate the CA certificate? This will cause SSL warnings on all clients until the new certificate is installed.'))) {
                                // Create marker file to trigger certificate regeneration
                                return fs.write('/etc/privoxy/regenerate_ca', '1').then(function() {
-                                       console.log('UCI: marker file created successfully');
                                        return callRcInit('privoxy', 'reload');
                                }).then(function() {
                                        L.ui.addNotification(null, E('p', {}, _('CA certificate has been regenerated.')), 'info');
                                }).catch(function(err) {
-                                       console.error('UCI error:', err);
                                        L.ui.addNotification(null, E('p', {}, _('Failed to regenerate CA certificate: ') + err.message), 'error');
                                });
                        }
@@ -459,27 +459,6 @@ return view.extend({
                o.description = _("Log the applying actions");
                o.orientation = "horizontal";
 
-
-               // Post-render: Setup dynamic behavior
-               return m.render().then(function(node) {
-                       // Update certificate path display
-                       function updateCertPath() {
-                               var certDir = document.querySelector('input[name="w.-privoxy.-privoxy.certdir"]');
-                               var certPathDisplay = document.querySelector('input[name="w.-privoxy.-privoxy._ca_cert_path"]');
-                               if (certDir && certPathDisplay) {
-                                       var dir = certDir.value || '/etc/privoxy/ssl';
-                                       certPathDisplay.value = dir + '/ca-cert.pem';
-                               }
-                       }
-
-                       // Update path when certdir changes
-                       var certDirInput = document.querySelector('input[name="w.-privoxy.-privoxy.certdir"]');
-                       if (certDirInput) {
-                               certDirInput.addEventListener('input', updateCertPath);
-                               updateCertPath();
-                       }
-
-                       return node;
-               });
+               return m.render();
        }
 });
index d08296feeecd95f416ed38935da65e8b1e3a660c..7276135cc6fbafb85941e53ff6c9c715e3c96cad 100644 (file)
@@ -14,6 +14,9 @@
                        "file": {
                                "/etc/config/privoxy": ["write"],
                                "/etc/privoxy/regenerate_ca": ["write"]
+                       },
+                       "ubus": {
+                               "rc": [ "init" ]
                        }
                }
        }
git clone https://git.99rst.org/PROJECT