diff options
author | Mika Havela <mika.havela@gmail.com> | 2008-01-17 09:38:24 +0000 |
---|---|---|
committer | Mika Havela <mika.havela@gmail.com> | 2008-01-17 09:38:24 +0000 |
commit | a83f38291b0de75d5f92f5cda7a9cabd8518faee (patch) | |
tree | 8ce090d035491056282a9cfbbcbe9901eee24754 | |
parent | f07ff07b2b56a0fe23a186632d9d3ff39bbd57e6 (diff) | |
download | acf-alpine-conf-a83f38291b0de75d5f92f5cda7a9cabd8518faee.tar.bz2 acf-alpine-conf-a83f38291b0de75d5f92f5cda7a9cabd8518faee.tar.xz |
Starts showing current config on the config-tab
git-svn-id: svn://svn.alpinelinux.org/acf/lbu/trunk@594 ab2d0c66-481e-0410-8bed-d214d4d58bed
-rw-r--r-- | lbu-config-html.lsp | 23 | ||||
-rw-r--r-- | lbu-controller.lua | 4 | ||||
-rw-r--r-- | lbu-model.lua | 33 |
3 files changed, 48 insertions, 12 deletions
diff --git a/lbu-config-html.lsp b/lbu-config-html.lsp index 24ef5a1..095f6bc 100644 --- a/lbu-config-html.lsp +++ b/lbu-config-html.lsp @@ -18,9 +18,11 @@ <dl> <dt>Default media for commit</dt> <dd><select name="LBU_MEDIA" size="1"> -<option value="">No default</option> -<option value="floppy">floppy</option> -<option value="usb">usb</option> +<? for i=1, table.maxn(view.config.LBU_MEDIA_LIST) do ?> +<option value="<?= view.config.LBU_MEDIA_LIST[i]["value"] ?>" +<? if (string.lower(view.config.LBU_MEDIA_LIST[i]["value"]) == string.lower(view.config.LBU_MEDIA)) then io.write("selected='selected'") end?>> +<?= view.config.LBU_MEDIA_LIST[i]["name"] ?></option> +<? end ?> </select></dd> </dl> @@ -28,20 +30,21 @@ <dl> <dt>Password protected commits</dt> -<dd><input type="checkbox" name="settings_startup"></dd> +<dd><input type="checkbox" name="ENCRYPTION" <? if (view.config.ENCRYPTION) then io.write("checked=yes") end ?>></dd> </dl> <dl> <dt>Cipher to use at encryption</dt> -<dd><select name="hosts_list" size="1"> -<option value="">aes-256-cbc</option> -</select> -(For possible ciphers, try: openssl -v)</dd> +<dd><select name="DEFAULT_CIPHER" size="1"> +<? for i=1, table.maxn(view.config.DEFAULT_CIPHER_LIST) do ?> +<option value="<?= view.config.DEFAULT_CIPHER_LIST[i] ?>" <? if (string.lower(view.config.DEFAULT_CIPHER_LIST[i]) == string.lower(view.config.DEFAULT_CIPHER)) then io.write("selected='selected'") end?>><?= view.config.DEFAULT_CIPHER_LIST[i] ?></option> +<? end ?> +</select></dd> </dl> <dl> <dt>Password when encrypting</dt> -<dd><input type="text" class="text" name="settings_startup"></dd> +<dd><input type="text" class="text" value="<?= view.config.PASSWORD or "" ?>" name="PASSWORD"></dd> </dl> <H2>Save and apply above settings</H2> @@ -68,7 +71,7 @@ <? ---[[ DEBUG INFORMATION +---[[ DEBUG INFORMATION require("debugs") io.write(debugs.variables(view)) --]] diff --git a/lbu-controller.lua b/lbu-controller.lua index 079bf4c..853219b 100644 --- a/lbu-controller.lua +++ b/lbu-controller.lua @@ -27,7 +27,9 @@ end config = function (self) local cmd = self.clientdata.cmd local url = ENV["SCRIPT_NAME"] .. self.conf.prefix .. self.conf.controller - return ( {status = self.model:getstatus(), url = url } ) + return ( {status = self.model:getstatus(), + config = self.model:getconfig(), + url = url, } ) end -- ################################################################################ diff --git a/lbu-model.lua b/lbu-model.lua index 8a362ce..3170736 100644 --- a/lbu-model.lua +++ b/lbu-model.lua @@ -1,6 +1,8 @@ module (..., package.seeall) -require "fs" +require("fs") +require("getopts") + local configfile = "/etc/lbu/lbu.conf" -- ################################################################################ @@ -29,6 +31,22 @@ local function getLbuStatus() return ret end +local function getciphers() + local opensslciphers = {} + local watchdog = nil + local f = io.popen("/usr/bin/openssl -v 2>&1", "r") + if not (f) then return ciphers end + for line in f:lines() do + if (watchdog) then + for cipher in string.gmatch(line, "(%S+)") do + table.insert(opensslciphers,tostring(cipher)) + end + end + if (string.match(line, "^Cipher commands")) then watchdog="yes" end + end + f:close() + return opensslciphers +end -- ################################################################################ -- PUBLIC FUNCTIONS @@ -57,6 +75,19 @@ function list(self) return ret end +function getconfig () + local path = configfile + local config = {} + local lbumedias = {} + table.insert(lbumedias, {name="No default", value=""}) + table.insert(lbumedias, {name="floppy", value="floppy"}) + table.insert(lbumedias, {name="usb", value="usb"}) + config = getopts.getoptsfromfile(path) + config["LBU_MEDIA_LIST"]= lbumedias + config["DEFAULT_CIPHER_LIST"]= getciphers() +-- config["debug"] = getciphers() + return config +end -- ################################################################################ -- OLD FUNCTIONS |