-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
luci-app-squid: convert to JavaScript
Assumption has been made that the config file is stored in /etc/squid since the principal package limits the sysconfdir to this directory. If that assumption is changed in the future we need to adjust the ACL. Signed-off-by: Daniel Nilsson <dannil+github@protonmail.com>
- Loading branch information
Showing
43 changed files
with
303 additions
and
300 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
63 changes: 63 additions & 0 deletions
63
applications/luci-app-squid/htdocs/luci-static/resources/view/squid.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
'use strict'; | ||
|
||
'require form'; | ||
'require fs'; | ||
'require uci'; | ||
'require ui'; | ||
'require view'; | ||
|
||
return view.extend({ | ||
|
||
load: function() { | ||
return uci.load('squid') | ||
.then(() => uci.get('squid', 'squid', 'config_file')); | ||
}, | ||
|
||
render: function(config_file) { | ||
var m, s, o; | ||
|
||
m = new form.Map('squid', _('Squid')); | ||
|
||
s = m.section(form.TypedSection, 'squid'); | ||
s.anonymous = true; | ||
s.addremove = false; | ||
|
||
s.tab('general', _('General Settings')); | ||
s.tab('advanced', _('Advanced Settings')); | ||
|
||
o = s.taboption('general', form.Value, 'http_port', _('Port')); | ||
o.datatype = 'portrange'; | ||
o.placeholder = '0-65535'; | ||
|
||
o = s.taboption('general', form.Value, 'visible_hostname', _('Visible Hostname')); | ||
o.datatype = 'string'; | ||
o.placeholder = 'OpenWrt'; | ||
|
||
o = s.taboption('general', form.Value, 'coredump_dir', _('Coredump files directory')); | ||
o.datatype = 'string'; | ||
o.placeholder = '/tmp/squid'; | ||
|
||
o = s.taboption('advanced', form.TextValue, '_data'); | ||
o.wrap = false; | ||
o.rows = 25; | ||
o.rmempty = false; | ||
o.cfgvalue = function(section_id) { | ||
return fs.read(config_file); | ||
}; | ||
o.write = function(section_id, value) { | ||
if (value) { | ||
var normalized = value.replaceAll('\r\n', '\n'); | ||
fs.write(config_file, normalized); | ||
} | ||
}; | ||
|
||
return m.render(); | ||
}, | ||
|
||
handleSaveApply: function (ev) { | ||
this.handleSave() | ||
.then(() => ui.changes.apply()) | ||
.then(() => fs.exec('/etc/init.d/squid', ['restart'])); | ||
} | ||
|
||
}); |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.