luci/applications/luci-app-squid/root/usr/libexec/rpcd/luci.squid
Daniel Nilsson 5c6b08cf89 luci-app-squid: convert to JavaScript
The conversion adds the missing parameters in the UI which is
configurable in the principal package.

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>
2024-10-17 19:10:17 +02:00

39 sor
699 B
Bash

#!/bin/sh
# Reference: https://openwrt.org/docs/techref/rpcd
. /usr/share/libubox/jshn.sh
get_compile_time_options() {
# Extract all options that begins with '--' as a comma-separated string
source="$(squid -v)"
options="$(echo $source | grep -o "'--[^']*'" | sed "s/'//g")"
json_init
json_add_array 'options'
# For each option, add it to the array
set -- $options
for option; do
json_add_string '' "$option"
done
json_close_array
json_dump
json_cleanup
}
case "$1" in
list)
json_init
json_add_object 'getCompileTimeOptions'
json_close_object
json_dump
json_cleanup
;;
call)
case "$2" in
getCompileTimeOptions)
get_compile_time_options
;;
esac
;;
esac