From f0a9d8c70f1c4ddb3d960c139f41480c0cba8097 Mon Sep 17 00:00:00 2001 From: jilotta Date: Sat, 7 Sep 2024 12:59:39 +0300 Subject: [PATCH] Init commit. Practically everything done. Supports apt and pacman. --- gencmd.js | 49 +++++++++++++ index.html | 96 +++++++++++++++++++++++++ install.html | 99 +++++++++++++++++++++++++ password.js | 48 +++++++++++++ reveal.png | Bin 0 -> 2176 bytes style.css | 199 +++++++++++++++++++++++++++++++++++++++++++++++++++ textarea.js | 17 +++++ 7 files changed, 508 insertions(+) create mode 100644 gencmd.js create mode 100644 index.html create mode 100644 install.html create mode 100644 password.js create mode 100644 reveal.png create mode 100644 style.css create mode 100644 textarea.js diff --git a/gencmd.js b/gencmd.js new file mode 100644 index 0000000..bec10b2 --- /dev/null +++ b/gencmd.js @@ -0,0 +1,49 @@ +var pacman_f = document.getElementById("pacman"); +var username_f = document.getElementById("username"); +var password_f = document.getElementById("pass"); +var db_password_f = document.getElementById("dbpass"); +var output_f = document.getElementById("output"); +var cmd_el = document.getElementById("cmd"); +var username, password, db_password, pacman, cmd; + +function sanitize(s) { + return s + .replaceAll("\\", "\\\\") + .replaceAll('"', '\\"') + .replaceAll("'", "\\'") + .replaceAll("$", "\\$"); +} + +function generate_cmd(e) { + install_deps = pacman_f.value; + username = sanitize(username_f.value); + password = sanitize(password_f.value); + db_password = sanitize(db_password_f.value); + if (username && password && db_password) { + cmd_el.style.display = "block"; + } else { + cmd_el.style.display = "none"; + console.log("empty"); + return; + } + + clone_repo = + "git clone -b prototype https://git.thedroth.rocks/DecUp/platform /opt/decup"; + run_ansible = + "ansible-playbook /opt/decup/install.yml --extra-vars 'adminpanel=\\\"" + + username + + '\\" panelpassword=\\"' + + password + + '\\" dbpassword=\\"' + + db_password + + "\\\"'"; + + cmd = install_deps + " && " + clone_repo + " && " + run_ansible; + output_f.value = 'sudo sh -c "' + cmd + '"'; + resize_textarea(output_f); +} + +username_f.oninput = generate_cmd; +pacman_f.onchange = generate_cmd; +password_f.oninput = generate_cmd; +db_password_f.oninput = generate_cmd; diff --git a/index.html b/index.html new file mode 100644 index 0000000..29975cd --- /dev/null +++ b/index.html @@ -0,0 +1,96 @@ + + + + + DecUp + + + + + +
+
+

Ваши сервисы — наша забота

+ +

+ DecUp поможет развернуть собственную инфраструктуру + легче, чем когда-либо. +

+ +
+

Зачем?

+

+ Два года назад блокировки Facebook*, + Instagram* и Twitter были + немыслимыми. +

+

Также как и вычистка банков из Play Store.

+

Также как и «замедление» YouTube.

+

+ Уже понятно, что будущее России + закрыто чёрной плашкой. +

+

+ * — принадлежит корпорации Meta, признанной в РФ экстремистской +

+
+
+

Что делать?

+

+ Сейчас набирают популярность + децентрализованные сервисы. +

+

+ Их крайне сложно заблокировать: всё раздроблено на маленькие + сервера, которые можно создать за минуты. +

+

+ Они предлагают полный контроль за вашими данными, + будь то секрет компании или план по захвату мира. + ;) +

+
+
+

Почему мы?

+

Легковесность:

+

+ DecUp оптимизирован, чтобы не мешать вам пользоваться сервисами. +

+ +
лучше, чем SelfPrivacy
+

Контроль:

+

+ DecUp не привязан к чужому компьютеру. С нами вы можете выбрать, + где хранятся ваши данные. +

+ +
лучше, чем Yunohost
+

Отделённость:

+

+ DecUp — не ОС. После установки программы сервером + можно продолжать пользоваться как угодно. +

+ +

Простота установки:

+

+ Единственное, что нужно — Unix-подобная ОС + с правами root. +

+ +

Поддержка:

+

+ Большинство подобных проектов предоставляются «как есть» (as is). + Мы предлагаем техподдержку по различным вопросам, + связанным с DecUp. +

+
+ Установить +
+
+ + diff --git a/install.html b/install.html new file mode 100644 index 0000000..eab75af --- /dev/null +++ b/install.html @@ -0,0 +1,99 @@ + + + + + Установка DecUp + + + + + +
+ + + +
+ + diff --git a/password.js b/password.js new file mode 100644 index 0000000..c738d04 --- /dev/null +++ b/password.js @@ -0,0 +1,48 @@ +var password_fields = document.getElementsByClassName("password"); +var password_toggle_buttons = []; + +for (let i = 0; i < password_fields.length; i++) { + try { + password_fields.item(i).type = "password"; // ie8 fails here + + password_toggle_buttons.push(document.createElement("button")); + password_toggle_buttons[i].setAttribute( + "style", + "position: relative; top: -38px; right: 2px; float: right; padding: 6px 14px; height: 36px; border: 0" + ); + password_toggle_buttons[i].setAttribute( + "class", + "tertiary no-text button" + ); + password_toggle_buttons[i].onclick = function () { + showPass(password_fields.item(i).id); + }; + password_toggle_buttons[i].type = "button"; + + var me = document.querySelector("script[data-type='password']"); + var icons = me.getAttribute("data-icons"); + var alt = me.getAttribute("data-alt"); + + var img = document.createElement("img"); + img.setAttribute("src", icons + "/reveal.png"); + img.setAttribute("alt", alt); + + password_toggle_buttons[i].appendChild(img); + password_fields + .item(i) + .insertAdjacentElement("afterend", password_toggle_buttons[i]); + } catch (e) { + window.console.log(e); + window.console.log("Browser doesn't support modifying the type of input."); + window.console.log("Password field left visible."); + } +} + +function showPass(field_id) { + var password_field = document.getElementById(field_id); + if (password_field.type === "password") { + password_field.type = "text"; + } else { + password_field.type = "password"; + } +} diff --git a/reveal.png b/reveal.png new file mode 100644 index 0000000000000000000000000000000000000000..6d4e2e03527625d5a6655b0ba6606e788df505af GIT binary patch literal 2176 zcmV-`2!Hp9P)DWy!?sNpFEgb#>fP!g4xl86BUu~dT^nnD{Bi*!C{ zBEiH*jD#qld@&eHVodOZL>_ipUX_Ga3l+3lA(TgFNFsc5X76*> zIs4w}`6nx#-t4oU=bXLw+H3FABZ(U6&`7PoiH(gU@dSv zu%s%Xkr)Af0^CnUfv73~S7Jt;Q-v@Gyb7!X9xYo?+3(#YSZB9|?r}cAM}R*9e*l)1 zDX7cM{uT?w zVNa&s0k{}b^eiWS?_fj4ZNQ7b%fOpVJ!I?!mI5n)3$cmZ<-j~AefD5C)=npWAjykv zmNcf~ct_GENmonibI_|V1fBtt_Iv6Rpg2$%`js zzNj<+1CoYwD*Udbdx|Js0?n25JxSv^ZF)x1$$4bwb^g|zivC5?d3hAAh|bG&%!4h; z(SPN+Q}W*VKam?q7t;2%QNJ0Y8YGczXzX^&k(a$(k+rkBIUQ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9gA)Vz^q2Hs80 z9e~8B1CSVX01~4PKw{JZNQ^oFiBSh2G3o#$#{U6C#mY+n2<;&N0000 .container > * { + margin-top: 32px; +} + +.block { + margin-left: -16px; + margin-right: -16px; + padding: 16px; + padding-top: 0; + background-color: #505050; + border: 3px #808080 solid; + border-radius: 16px; +} + +.block > * { + margin-top: 16px; +} + +span.ref { + color: #ccc; +} + +p.ref { + color: #ccc; + font-size: 12px; +} + +.primary { + background-color: #354fcf; + color: #fff; + text-decoration: none; + font-weight: 700; + border: 0; + border-radius: 16px; + padding: 8px 16px; + line-height: 24px; +} + +#header a.primary { + float: right; +} + +#header h1 { + display: inline; + line-height: 40px; +} + +p.details { + margin-top: 0; + margin-left: 16px; +} + +address { + font-style: normal; + color: #ccc; + float: right; +} + +.full { + display: block; + text-align: center; +} + +a { + color: #00bcff; +} + +input, +select, +textarea { + border-radius: 16px; + height: 24px; + font-size: 16px; + line-height: 16px; + padding: 6px 14px; + height: 40px; + box-sizing: border-box; + min-height: 24px; + width: 100%; + display: block; + line-height: 24px; +} + +.tertiary, +input, +select, +textarea { + background-color: #505050; + border-color: #808080; + color: #fff; +} + +.tertiary:hover, +input:hover, +select:hover, +textarea:hover, +#header .btns img:hover { + background-color: #4c4c4c; +} + +.tertiary:focus, +#header .btns img:focus { + background-color: #4c4c4c; +} + +:focus { + border-color: #ccc; + outline: none; +} + +.tertiary:active, +#header .btns img:active { + background-color: #474747; +} + +input, +select, +textarea { + border: 2px solid #808080; + text-decoration: none; +} + +input, +select, +textarea, +.password-wrapper { + margin: 0 !important; +} + +label { + margin-bottom: 4px; + display: inline-block; +} + +.button.no-text > img { + width: 24px; + height: 24px; + margin-left: 0; +} + +button { + border-radius: 16px; +} + +.code { + font-family: + JetBrains Mono, + Consolas, + "Courier New", + Courier, + monospace; +} diff --git a/textarea.js b/textarea.js new file mode 100644 index 0000000..91ca38e --- /dev/null +++ b/textarea.js @@ -0,0 +1,17 @@ +const tx = document.getElementsByTagName("textarea"); +for (let i = 0; i < tx.length; i++) { + tx[i].setAttribute( + "style", + tx[i].getAttribute("style") + + ";height:" + + (tx[i].scrollHeight + 4) + + "px;overflow-y:hidden;" + ); + tx[i].addEventListener("change", resize_textarea, false); +} + +function resize_textarea(t) { + t = t instanceof Element ? t : this; + t.style.height = "auto"; + t.style.height = t.scrollHeight + 4 + "px"; +}