diff --git a/api/.gitkeep b/api/.gitkeep deleted file mode 100644 index e69de29..0000000 diff --git a/css/base.php b/css/base.php index 28effc3..11049a6 100644 --- a/css/base.php +++ b/css/base.php @@ -40,6 +40,12 @@ body { .center { margin: auto } .wmax { width: 100vw } .hmax { height: 100vh } +.w100 { width: 100% } +.h100 { height: 100% } +.card { + border-radius: .5em; + box-shadow: 0px 0px .5em #0000004f; +} textarea { max-width: -moz-available; @@ -74,4 +80,22 @@ a { height: 2.5em; } +#window-instance_config { + background: #d7d7d7; +} +#window-instance_config #title { + margin-top: 0; +} +#window-instance_config form { + background: #fff; + padding: 2.5em 2em; +} +#window-instance_config form .item { + margin-bottom: 1em; +} +#window-instance_config form .item input[type="text"] { + padding: .5em; + margin-top: .4em; +} + diff --git a/index.php b/index.php index 9b5fc11..544c765 100644 --- a/index.php +++ b/index.php @@ -14,7 +14,8 @@ window.consts = { 'instance_config': { 'mastodon': { - 'musthave': ['psql_host','psql_port','psql_db','psql_name','psql_pwd','redis_host','redis_port'], + 'musthave': ['instance_url','psql_host','psql_port','psql_db', + 'psql_username','psql_password','redis_host','redis_port','api_authkey'], }, } }; diff --git a/js/base.php b/js/base.php index acb509d..71afabe 100644 --- a/js/base.php +++ b/js/base.php @@ -42,10 +42,21 @@ var E = { } }, template: function(_id, cback) { - var tpl = E.elemid(_id+'-item').outerHTML; - tpl = tpl.replace('id="'+_id+'-item"','class="item"'); - tpl = tpl.replace('data-src=', 'src='); - E.elemid(_id).innerHTML = cback(tpl); + var tpl = E.elemid(_id+'-item'); + if (tpl !== null) { + tpl = tpl.outerHTML; + tpl = tpl.replace('id="'+_id+'-item"','class="item"'); + tpl = tpl.replace('data-src=', 'src='); + } + var elem = null; + elem = E.elemid(_id); + if (elem === null) + elem = E.element(_id); + if (elem === null) + return; + if (typeof cback === 'string') + elem.innerText = cback; + else elem.innerHTML = cback(tpl); }, }; @@ -123,6 +134,17 @@ function parse_hash_arguments(str,by) { return args; } +function human_field_name(str) { + str = ' '+str+' '; + return capitalize( + str.replaceAll('_', ' ') + .replaceAll(' api ',' API ') + .replaceAll(' db ',' DB ') + .replaceAll(' url ',' URL ') + .replaceAll(' psql ',' Postgres ') + .trim() + ); +} function capitalize(str) { return str[0].toUpperCase() + str.substring(1) } function printstack() { console.error(new Error().stack) } function uuidv4() { diff --git a/views/instance_config.php b/views/instance_config.php index 784eb05..f55248c 100644 --- a/views/instance_config.php +++ b/views/instance_config.php @@ -1,7 +1,32 @@