diff --git a/asset/adminscreen.css b/asset/adminscreen.css index 824ed84..b8258aa 100644 --- a/asset/adminscreen.css +++ b/asset/adminscreen.css @@ -1,144 +1,144 @@ -::-webkit-scrollbar { - background-color: #1C1C1C; - border-radius: 10px; -} - -::-webkit-scrollbar-button { - background-color: #1C1C1C; - height: 0px; -} - -::-webkit-scrollbar-thumb { - background-color: var(--accent-color); - margin: 5px; - border-radius: 5px; -} - -::-webkit-scrollbar-track { - background-color: #1C1C1C; - padding: 10px; -} - -@keyframes turn { - 100% { - transform: rotate(2turn); - } -} - -::selection { - background-color: transparent; -} - -* { - cursor: default; -} - -@font-face { - font-family: "Instrument Sans"; - src: url("InstrumentSans-Regular.ttf"); -} - -@font-face { - font-family: "Instrument Sans Bold"; - src: url("InstrumentSans-Bold.ttf"); -} - -@font-face { - font-family: "Instrument Sans Italic"; - src: url("InstrumentSans-Italic.ttf"); -} - -*:focus { - outline: none; -} - -body { - background-color: var(--background-color); - color: var(--foreground-color); - font-family: "Instrument Sans", sans-serif; - margin: 0px; -} - -nav { - padding: 15px; - color: var(--foreground-color); - font-size: 18px; - background-color: var(--accent-color); -} - -nav a#exit { - color: var(--nav-exit); - text-decoration: none; - padding-right: 10px; - cursor: pointer; -} - -nav b { - padding-right: 10px; -} - -div.infocard { - padding: 10px; - display: inline-table; - border-radius: 10px; - width: 30vw; - height: 330px; - text-align: left; - margin-left: 10px; - margin-bottom: 10px; - border-style: solid; - border-width: 1px; - border-color: var(--grey-3); -} - -div.infocard h3 { - color: var(--foreground-color); - padding: 10px; - margin: 0px; -} - -div.infocard table { - padding: 10px; - font-size: 18px; -} - -div.infocard table td { - padding-bottom: 7px; - width: 160px; -} - -div.wide { - padding: 10px; - width: calc(60vw + 40px); - height: 30vh !important; - max-height: 50vh !important; - overflow-y: scroll; - display: block; -} - -div.userdiv { - padding: 10px; - border-radius: 5px; - padding-top: 0px; - padding-bottom: 0px; -} - -div.userdiv button { - background-color: transparent; - color: red; - border-width: 0px; - box-shadow: none; -} - -div.userdiv button { - filter: brightness(1); -} - -select { - border-width: 0px; - background-color: var(--accent-color); - padding: 10px; - border-radius: 5px; - font-family: "Instrumental", sans-serif; - color: var(--background-color); +::-webkit-scrollbar { + background-color: #1C1C1C; + border-radius: 10px; +} + +::-webkit-scrollbar-button { + background-color: #1C1C1C; + height: 0px; +} + +::-webkit-scrollbar-thumb { + background-color: var(--accent-color); + margin: 5px; + border-radius: 5px; +} + +::-webkit-scrollbar-track { + background-color: #1C1C1C; + padding: 10px; +} + +@keyframes turn { + 100% { + transform: rotate(2turn); + } +} + +::selection { + background-color: transparent; +} + +* { + cursor: default; +} + +@font-face { + font-family: "Instrument Sans"; + src: url("InstrumentSans-Regular.ttf"); +} + +@font-face { + font-family: "Instrument Sans Bold"; + src: url("InstrumentSans-Bold.ttf"); +} + +@font-face { + font-family: "Instrument Sans Italic"; + src: url("InstrumentSans-Italic.ttf"); +} + +*:focus { + outline: none; +} + +body { + background-color: var(--background-color); + color: var(--foreground-color); + font-family: "Instrument Sans", sans-serif; + margin: 0px; +} + +nav { + padding: 15px; + color: var(--foreground-color); + font-size: 18px; + background-color: var(--accent-color); +} + +nav a#exit { + color: var(--nav-exit); + text-decoration: none; + padding-right: 10px; + cursor: pointer; +} + +nav b { + padding-right: 10px; +} + +div.infocard { + padding: 10px; + display: inline-table; + border-radius: 10px; + width: 30vw; + height: 330px; + text-align: left; + margin-left: 10px; + margin-bottom: 10px; + border-style: solid; + border-width: 1px; + border-color: var(--grey-3); +} + +div.infocard h3 { + color: var(--foreground-color); + padding: 10px; + margin: 0px; +} + +div.infocard table { + padding: 10px; + font-size: 18px; +} + +div.infocard table td { + padding-bottom: 7px; + width: 160px; +} + +div.wide { + padding: 10px; + width: calc(60vw + 40px); + height: 30vh !important; + max-height: 50vh !important; + overflow-y: scroll; + display: block; +} + +div.userdiv { + padding: 10px; + border-radius: 5px; + padding-top: 0px; + padding-bottom: 0px; +} + +div.userdiv button { + background-color: transparent; + color: red; + border-width: 0px; + box-shadow: none; +} + +div.userdiv button { + filter: brightness(1); +} + +select { + border-width: 0px; + background-color: var(--accent-color); + padding: 10px; + border-radius: 5px; + font-family: "Instrumental", sans-serif; + color: var(--background-color); } \ No newline at end of file diff --git a/asset/chat.css b/asset/chat.css index 274266f..27867fb 100644 --- a/asset/chat.css +++ b/asset/chat.css @@ -1,160 +1,160 @@ -::selection { - background-color: transparent; -} - -::placeholder { - color: var(--foreground-color); - font-family: "Instrument Sans"; -} - -::-webkit-scrollbar { - display: none; -} - -* { - cursor: default; -} - -@font-face { - font-family: "Instrument Sans"; - src: url("InstrumentSans-Regular.ttf"); -} - -@font-face { - font-family: "Instrument Sans Bold"; - src: url("InstrumentSans-Bold.ttf"); -} - -@font-face { - font-family: "Instrument Sans Italic"; - src: url("InstrumentSans-Italic.ttf"); -} - -body { - background-color: var(--background-color); - color: var(--foreground-color); - font-family: "Instrument Sans", sans-serif; - margin: 0px; - height: 100vh; -} - -table, -table tr { - height: 100%; -} - -table tr #userlist { - width: 200px; - background-color: var(--light-grey-2); - vertical-align: top; - padding: 20px; -} - -table tr #userlist button { - width: 100%; - transition: all ease-in-out 200ms; -} - -table tr #userlist button:hover { - width: 100%; - filter: brightness(1.1); -} - -table tr #userlist button.user { - background-color: transparent; - color: var(--foreground-color); - text-align: left; - margin-top: 5px; - font-size: 16px; - transition: ease-in-out 100ms; - box-shadow: none; -} - -table tr #userlist button.user:hover { - background-color: var(--highlight-middle); -} - -table tr #messages { - width: calc(100vw - 200px); - vertical-align: top; - padding: 20px; -} - -table tr #messages #container { - overflow: scroll; - padding-top: 60px; - height: calc(100% - 130px); -} - -table tr #messages #container b { - font-size: x-large; - color: var(--foreground-color); - font-weight: 100; - position: absolute; - top: 20px; - background-color: var(--background-color); - width: 100vw; - padding: 10px; -} - -table tr #messages #input { - padding: 10px; -} - -table tr #messages #input input { - background-color: var(--light-grey-input); - border-radius: 5px; - border-width: 1px; - border-style: solid; - border-color: var(--accent-color); - width: 250px; - max-width: 20vw; - margin-right: 5px; - color: var(--foreground-color); - font-size: 18px; - letter-spacing: 1px; - height: 40px; -} - -table tr #messages button { - width: 50px; -} - -button.circle { - border-radius: 50%; - width: 40px !important; - height: 40px; - text-align: center; - padding-left: 5px; -} - -table tr #messages #input input:focus { - outline: none; -} - -.msg_you { - margin-top: 20px; - padding: 10px; - width: 200px; - min-width: 200px; - background-color: var(--msg-1); - border-radius: 5px; - overflow-wrap: break-word; -} - -.msg_oth { - margin-top: 20px; - padding: 10px; - width: 200px; - min-width: 200px; - background-color: var(--msg-2); - border-radius: 5px; - display: block; - margin-left: auto; - overflow-wrap: break-word; -} - -#upload_button { - box-shadow: none; - margin-left: 7.5px !important; +::selection { + background-color: transparent; +} + +::placeholder { + color: var(--foreground-color); + font-family: "Instrument Sans"; +} + +::-webkit-scrollbar { + display: none; +} + +* { + cursor: default; +} + +@font-face { + font-family: "Instrument Sans"; + src: url("InstrumentSans-Regular.ttf"); +} + +@font-face { + font-family: "Instrument Sans Bold"; + src: url("InstrumentSans-Bold.ttf"); +} + +@font-face { + font-family: "Instrument Sans Italic"; + src: url("InstrumentSans-Italic.ttf"); +} + +body { + background-color: var(--background-color); + color: var(--foreground-color); + font-family: "Instrument Sans", sans-serif; + margin: 0px; + height: 100vh; +} + +table, +table tr { + height: 100%; +} + +table tr #userlist { + width: 200px; + background-color: var(--light-grey-2); + vertical-align: top; + padding: 20px; +} + +table tr #userlist button { + width: 100%; + transition: all ease-in-out 200ms; +} + +table tr #userlist button:hover { + width: 100%; + filter: brightness(1.1); +} + +table tr #userlist button.user { + background-color: transparent; + color: var(--foreground-color); + text-align: left; + margin-top: 5px; + font-size: 16px; + transition: ease-in-out 100ms; + box-shadow: none; +} + +table tr #userlist button.user:hover { + background-color: var(--highlight-middle); +} + +table tr #messages { + width: calc(100vw - 200px); + vertical-align: top; + padding: 20px; +} + +table tr #messages #container { + overflow: scroll; + padding-top: 60px; + height: calc(100% - 130px); +} + +table tr #messages #container b { + font-size: x-large; + color: var(--foreground-color); + font-weight: 100; + position: absolute; + top: 20px; + background-color: var(--background-color); + width: 100vw; + padding: 10px; +} + +table tr #messages #input { + padding: 10px; +} + +table tr #messages #input input { + background-color: var(--light-grey-input); + border-radius: 5px; + border-width: 1px; + border-style: solid; + border-color: var(--accent-color); + width: 250px; + max-width: 20vw; + margin-right: 5px; + color: var(--foreground-color); + font-size: 18px; + letter-spacing: 1px; + height: 40px; +} + +table tr #messages button { + width: 50px; +} + +button.circle { + border-radius: 50%; + width: 40px !important; + height: 40px; + text-align: center; + padding-left: 5px; +} + +table tr #messages #input input:focus { + outline: none; +} + +.msg_you { + margin-top: 20px; + padding: 10px; + width: 200px; + min-width: 200px; + background-color: var(--msg-1); + border-radius: 5px; + overflow-wrap: break-word; +} + +.msg_oth { + margin-top: 20px; + padding: 10px; + width: 200px; + min-width: 200px; + background-color: var(--msg-2); + border-radius: 5px; + display: block; + margin-left: auto; + overflow-wrap: break-word; +} + +#upload_button { + box-shadow: none; + margin-left: 7.5px !important; } \ No newline at end of file diff --git a/asset/chat.js b/asset/chat.js index b9d0516..44f0de8 100644 --- a/asset/chat.js +++ b/asset/chat.js @@ -1,20 +1,20 @@ -function chat(username) { - document.getElementById("loader_form_username").value = username - document.getElementById("loader_form").submit() -} - -window.onload = function () { - document.body.innerHTML = document.body.innerHTML.replaceAll(":smile:", "๐Ÿ˜€") - elem = document.getElementById("container") - elem.scrollTop = elem.scrollHeight; - if (document.getElementById('username').value != '') { document.getElementById('input').hidden = false } - document.getElementById("file-upload").onchange = function () { - document.getElementById("message").value = "New file: "+document.getElementById("file-upload").value.split("\\")[document.getElementById("file-upload").value.split("\\").length - 1] - document.getElementById("filename").value = document.getElementById("file-upload").value.split("\\")[document.getElementById("file-upload").value.split("\\").length - 1] - } -} - -function file_upload() { - document.getElementById("file-upload").click() -} - +function chat(username) { + document.getElementById("loader_form_username").value = username + document.getElementById("loader_form").submit() +} + +window.onload = function () { + document.body.innerHTML = document.body.innerHTML.replaceAll(":smile:", "๐Ÿ˜€") + elem = document.getElementById("container") + elem.scrollTop = elem.scrollHeight; + if (document.getElementById('username').value != '') { document.getElementById('input').hidden = false } + document.getElementById("file-upload").onchange = function () { + document.getElementById("message").value = "New file: "+document.getElementById("file-upload").value.split("\\")[document.getElementById("file-upload").value.split("\\").length - 1] + document.getElementById("filename").value = document.getElementById("file-upload").value.split("\\")[document.getElementById("file-upload").value.split("\\").length - 1] + } +} + +function file_upload() { + document.getElementById("file-upload").click() +} + diff --git a/asset/emojis/dont_care.svg b/asset/emojis/dont_care.svg new file mode 100644 index 0000000..431636b --- /dev/null +++ b/asset/emojis/dont_care.svg @@ -0,0 +1,69 @@ + + + + + + + + + + + + + + + + + diff --git a/asset/emojis/smile.svg b/asset/emojis/smile.svg new file mode 100644 index 0000000..d4ed4af --- /dev/null +++ b/asset/emojis/smile.svg @@ -0,0 +1,84 @@ + + + + + + + + + + + + + + + + + + + diff --git a/asset/emojis/unhappy.svg b/asset/emojis/unhappy.svg new file mode 100644 index 0000000..e12a336 --- /dev/null +++ b/asset/emojis/unhappy.svg @@ -0,0 +1,87 @@ + + + + + + + + + + + + + + + + + + + diff --git a/asset/emojis/warning.svg b/asset/emojis/warning.svg new file mode 100644 index 0000000..77c5c2e --- /dev/null +++ b/asset/emojis/warning.svg @@ -0,0 +1,84 @@ + + + + + + + + + + + + + + + + + + + + + + + diff --git a/asset/filebox.css b/asset/filebox.css index f91dd43..db711aa 100644 --- a/asset/filebox.css +++ b/asset/filebox.css @@ -1,209 +1,209 @@ -::-webkit-scrollbar { - display: none; -} - -@font-face { - font-family: "Instrument Sans"; - src: url("InstrumentSans-Regular.ttf"); -} - -@font-face { - font-family: "Instrument Sans Bold"; - src: url("InstrumentSans-Bold.ttf"); -} - -@font-face { - font-family: "Instrument Sans Italic"; - src: url("InstrumentSans-Italic.ttf"); -} - -@keyframes fall-down { - 0% { - opacity: 0%; - height: 0px; - } -} - -::selection { - background-color: transparent; -} - -*:focus { - outline: none; -} - -* { - cursor: default; -} - -a, -button, -label, -button img { - cursor: pointer; -} - -body { - background-color: var(--background-color); - color: var(--foreground-color); - font-family: "Instrument Sans", sans-serif; - margin: 0px; - padding: 10px; - max-height: 100vh; -} - -button { - background-color: var(--accent-color); - color: var(--foreground-color); - border-width: 0px; - border-color: 0px; - border-style: solid; - border-radius: 5px; - font-family: "Instrument Sans"; - padding: 10px; - padding-left: 10px; - font-size: 18px; - width: 125px; - margin-top: 7.5px; - margin-bottom: 7.5px; - transition: ease-in-out 0.25s; -} - -input[type="text"], -input[type="password"] { - background-color: var(--transparent-heavy); - color: var(--foreground-color); - border-width: 0px; - border-color: 0px; - border-style: solid; - border-radius: 5px; - font-family: "Instrument Sans"; - padding: 7.5px; - font-size: 18px; - width: 250px; - margin-top: 7.5px; - margin-bottom: 7.5px; - transition: ease-in-out 0.25s; -} - -button:hover, -input[type="text"]:focus, -input[type="password"]:focus { - filter: brightness(110%); -} - -button:focus { - filter: brightness(120%); -} - -button:active { - filter: brightness(130%); -} - -b { - font-family: "Instrument Sans Bold"; -} - -i { - font-family: "Instrument Sans Italic"; -} - -a, -a::after, -a:hover, -a:active { - color: var(--link-color); -} - -/* --- Login Box -- -Width: 33vw -Padding: 40px; -Height: 100vh - 80 -Margin-Top: 40px; -*/ - -div#login_box { - width: 33vw; - min-width: 450px; - padding: 40px; - height: calc(100vh - 160px); - margin-top: 40px; - background-color: var(--transparent-low); - border-radius: 25px; - box-shadow: var(--box-shadow-ten-ten); -} - -h1, -h2, -h3, -h4 { - margin: 0px; - padding: 0px; - letter-spacing: 1px; - font-weight: 100; -} - -h1 { - font-size: 15px; - font-family: "Instrument Sans", sans-serif; - margin-bottom: 5px; - opacity: 80%; -} - -h2 { - font-size: 18px; -} - -nav#menu_bar { - padding: 10px; - width: calc(100% - 20px); - background-color: var(--accent-color); - height: 27px; -} - -nav#menu_bar img { - top: 14px; - left: 15px; - position: absolute; - transition: ease-in-out 0.25s; -} - -nav#menu_bar img.l1 { - left: 42px; -} - -nav#menu_bar img.l2 { - left: 69px; -} - -nav#menu_bar img:hover { - filter: brightness(125%); -} - -nav#menu_bar h1 { - font-size: 20px; - margin-left: 30px; -} - -button.circle { - width: auto; - border-radius: 50%; - width: 50px; - height: 50px; - text-align: center; - padding-left: 7.5px; -} - -span.sender { - color: var(--light-grey-1); - width: 100px; - text-overflow: ellipsis; - display: inline-block; -} - -div.filelist { - padding: 10px; - background-color: var(--light-grey-2); - border-radius: 5px; +::-webkit-scrollbar { + display: none; +} + +@font-face { + font-family: "Instrument Sans"; + src: url("InstrumentSans-Regular.ttf"); +} + +@font-face { + font-family: "Instrument Sans Bold"; + src: url("InstrumentSans-Bold.ttf"); +} + +@font-face { + font-family: "Instrument Sans Italic"; + src: url("InstrumentSans-Italic.ttf"); +} + +@keyframes fall-down { + 0% { + opacity: 0%; + height: 0px; + } +} + +::selection { + background-color: transparent; +} + +*:focus { + outline: none; +} + +* { + cursor: default; +} + +a, +button, +label, +button img { + cursor: pointer; +} + +body { + background-color: var(--background-color); + color: var(--foreground-color); + font-family: "Instrument Sans", sans-serif; + margin: 0px; + padding: 10px; + max-height: 100vh; +} + +button { + background-color: var(--accent-color); + color: var(--foreground-color); + border-width: 0px; + border-color: 0px; + border-style: solid; + border-radius: 5px; + font-family: "Instrument Sans"; + padding: 10px; + padding-left: 10px; + font-size: 18px; + width: 125px; + margin-top: 7.5px; + margin-bottom: 7.5px; + transition: ease-in-out 0.25s; +} + +input[type="text"], +input[type="password"] { + background-color: var(--transparent-heavy); + color: var(--foreground-color); + border-width: 0px; + border-color: 0px; + border-style: solid; + border-radius: 5px; + font-family: "Instrument Sans"; + padding: 7.5px; + font-size: 18px; + width: 250px; + margin-top: 7.5px; + margin-bottom: 7.5px; + transition: ease-in-out 0.25s; +} + +button:hover, +input[type="text"]:focus, +input[type="password"]:focus { + filter: brightness(110%); +} + +button:focus { + filter: brightness(120%); +} + +button:active { + filter: brightness(130%); +} + +b { + font-family: "Instrument Sans Bold"; +} + +i { + font-family: "Instrument Sans Italic"; +} + +a, +a::after, +a:hover, +a:active { + color: var(--link-color); +} + +/* +-- Login Box -- +Width: 33vw +Padding: 40px; +Height: 100vh - 80 +Margin-Top: 40px; +*/ + +div#login_box { + width: 33vw; + min-width: 450px; + padding: 40px; + height: calc(100vh - 160px); + margin-top: 40px; + background-color: var(--transparent-low); + border-radius: 25px; + box-shadow: var(--box-shadow-ten-ten); +} + +h1, +h2, +h3, +h4 { + margin: 0px; + padding: 0px; + letter-spacing: 1px; + font-weight: 100; +} + +h1 { + font-size: 15px; + font-family: "Instrument Sans", sans-serif; + margin-bottom: 5px; + opacity: 80%; +} + +h2 { + font-size: 18px; +} + +nav#menu_bar { + padding: 10px; + width: calc(100% - 20px); + background-color: var(--accent-color); + height: 27px; +} + +nav#menu_bar img { + top: 14px; + left: 15px; + position: absolute; + transition: ease-in-out 0.25s; +} + +nav#menu_bar img.l1 { + left: 42px; +} + +nav#menu_bar img.l2 { + left: 69px; +} + +nav#menu_bar img:hover { + filter: brightness(125%); +} + +nav#menu_bar h1 { + font-size: 20px; + margin-left: 30px; +} + +button.circle { + width: auto; + border-radius: 50%; + width: 50px; + height: 50px; + text-align: center; + padding-left: 7.5px; +} + +span.sender { + color: var(--light-grey-1); + width: 100px; + text-overflow: ellipsis; + display: inline-block; +} + +div.filelist { + padding: 10px; + background-color: var(--light-grey-2); + border-radius: 5px; } \ No newline at end of file diff --git a/asset/homescreen.css b/asset/homescreen.css index 0ecbc3b..cade1c4 100644 --- a/asset/homescreen.css +++ b/asset/homescreen.css @@ -1,444 +1,471 @@ -::placeholder { - color: var(--foreground-color); -} - -::-webkit-scrollbar { - display: none; -} - -@font-face { - font-family: "Instrument Sans"; - src: url("InstrumentSans-Regular.ttf"); -} - -@font-face { - font-family: "Instrument Sans Bold"; - src: url("InstrumentSans-Bold.ttf"); -} - -@font-face { - font-family: "Instrument Sans Italic"; - src: url("InstrumentSans-Italic.ttf"); -} - -@keyframes fall-down { - 0% { - opacity: 0%; - height: 0px; - } -} - -::selection { - background-color: transparent; -} - -*.selectable::selection { - background-color: var(--accent-color); -} - -*:focus { - outline: none; -} - -* { - cursor: default; -} - -/* --- Login Box -- -Width: 33vw -Padding: 40px; -Height: 100vh - 80 -Margin-Top: 40px; -*/ - -html { - height: 100%; -} - -body { - background-color: var(--background-color); - color: var(--foreground-color); - font-family: "Instrument Sans", sans-serif; - margin: 0px; - height: 100%; -} - -nav { - background-color: var(--background-color); -} - -div#login_box { - width: 33vw; - min-width: 450px; - padding: 40px; - height: calc(100vh - 160px); - margin-top: 40px; - background-color: var(--transparent-low); - border-radius: 25px; - box-shadow: var(--box-shadow-ten-ten); -} - -div#menu { - background-color: var(--grey-1); - position: absolute; - left: 10px; - top: 60px; - border-radius: 5px; - animation-name: fall-down; - animation-duration: 0.25s; - animation-fill-mode: forwards; - z-index: 100; - box-shadow: 0px 1px 0px 0px #A0A0A0 inset, 0px 5px 15px 0px rgba(0, 0, 0, 0.50); -} - -div#menu a { - font-size: large; - text-decoration: none; - display: inline-block; - padding: 10px; - color: var(--foreground-color); - transition: all ease-in-out 200ms; - text-decoration: underline; - text-decoration-color: transparent; -} - -div#info { - padding: 10px; - background-color: var(--grey-3); - color: var(--foreground-color); - position: absolute; - left: calc(50vw - 30vw); - top: calc(50vh - 40vh + 40px); - width: 60vw; - height: 60vh; - border-radius: 10px; - padding: 20px; - box-shadow: 0px 1px 0px 0px #A0A0A0 inset, 0px 5px 15px 0px rgba(0, 0, 0, 0.50); -} - -div#info h1 { - font-size: xx-large; -} - -div#info h2 { - font-size: x-large; -} - -div#info h3 { - font-size: large; -} - -div#info #body { - height: 50vh; - overflow-x: scroll; -} - -div#info #nav { - height: 10vh; -} - -div#info #nav * { - margin-top: 5vh; -} - -div#info #nav button#bf { - margin-left: 10px; - width: 50px; -} - -div#main_box table { - width: 100%; - height: calc(100vh - 50px); -} - -div#main_box { - width: 100%; - vertical-align: top; -} - -div#main_box #file_box { - padding-left: 10px; - background-color: var(--transparent-low); - overflow-y: scroll; - height: 100%; - padding-top: 50px; -} - -div#main_box #file_box a { - color: var(--foreground-color); - text-decoration: none; -} - -div.file_button { - padding: 15px; - width: calc(100% - 40px); - margin-top: 10px; - border-bottom: var(--grey-1) 1px solid; - border-radius: 5px; - transition: ease-in-out 100ms; - border-bottom-left-radius: 0px; - border-bottom-right-radius: 0px; -} - -div.file_button:hover { - border-bottom: transparent 1px solid; - border-bottom-left-radius: 5px; - border-bottom-right-radius: 5px; -} - -div.file_button img { - margin-bottom: -5px; - margin-right: 10px; -} - -div#file_menu { - background-color: var(--grey-3); - border-radius: 2.5px; - position: absolute; - width: 200px; - overflow-x: hidden; - z-index: 100; - padding-top: 10px; - padding-bottom: 10px; - box-shadow: 0px 1px 0px 0px #A0A0A0 inset, 0px 5px 15px 0px rgba(0, 0, 0, 0.50); -} - -div#file_menu button { - width: 100%; - background-color: var(--grey-3) !important; - height: auto; - font-size: 12pt; - border-radius: 0px; - margin-bottom: 0px; - margin-top: 0px; - padding: 10px; - text-align: left; - transition: ease-in-out 100ms; - box-shadow: none; - border-width: 0px; -} - -div#file_menu button:hover { - filter: brightness(150%); -} - -div#file_menu #file_menu_title { - color: var(--foreground-color); - font-weight: 100; - font-size: small; - margin-bottom: 10px; -} - -button.dangerous { - background-color: var(--accent-color-red) !important; -} - -img#empty_icon { - margin-top: calc(50vh - 200px); - -webkit-user-drag: none; - user-select: none; - -moz-user-select: none; - -webkit-user-select: none; - -ms-user-select: none; -} - -@keyframes flow_down { - 0% {top: 0px;} - 100% { - top: 20px; - } -} - -#password_request { - position: absolute; - top: 70px; - left: calc(50vw - 150px); - width: 300px; - padding: 20px; - border-radius: 10px; - background-color: var(--background-color-2); - animation: flow_down 0.25s; -} - -*.margin-left-small { - margin-left: 10px; -} - -@keyframes fade-in { - 0%{opacity: 0%;} -} - -#chat_inframe, #editor_popup, #security_advisor { - position: absolute; - top: calc(10vh); - left: calc(10vw); - height: 80vh; - width: 80vw; - border-radius: 10px; - border-style: solid; - border-width: 0px; - z-index: 100; - box-shadow: 0px 5px 25px 0px rgba(0, 0, 0, 0.50); - animation-name: fade-in; - animation-duration: 200ms; - background-color: var(--background-color); -} - -#security_advisor { - width: 25vw; - height: 25vw; - left: 37.5vw; - top: 12.5vw; - border-color: var(--grey-3); - border-width: 1px; -} - -div#file_info_menu { - height: calc(100% - 70px); - position: fixed; - top: 52px; - right: 0px; - padding: 10px; - background-color: var(--grey-2); - width: 25vw; - min-width: 250px; - z-index: 100; -} - -div#file_info_menu #img_wrapper img { - object-fit: cover; - width: 90px; -} - -div#file_info_menu span#file_info_menu_filename { - width: calc(100% - 20px); - text-align: center; - display: inline-block; - font-size: x-large; - padding: 5px; -} -div#file_info_menu span#file_info_menu_filetype { - display: inline-block; - text-align: center; - width: calc(100% - 20px); - opacity: 50%; - padding: 10px; - padding-bottom: 10px; -} - -div#file_info_menu span#file_info_menu_filesize, span#file_info_menu_fmd, span#file_info_menu_fcd { - padding: 10px; - font-size: medium; -} - -iframe#file_preview { - position: absolute; - width: 75vw; - height: 75vh; - top: 12.5vh; - left: 12.5vw; - border-radius: 5px; - border-width: 1px; - border-style: solid; - border-color: var(--grey-3); - z-index: 100; -} - - -div#encryption_popup { - position: absolute; - width: 50vh; - height: 50vh; - top: 25vh; - left: 37.5vw; - background-color: var(--grey-2); - color: var(--foreground-color); - border-radius: 5px; - overflow: hidden; -} - -div#encryption_popup .modal_title { - background-color: var(--accent-color); - padding: 10px; -} - -div#encryption_popup input { - margin: 10px; -} - -@keyframes flow_down_b { - 0% { - top: 0px; - } -} - -div#confirm_popup { - color: white; - position: absolute; - top: 60px; - left: calc(50vw - 160px); - width: 300px; - padding: 10px; - padding-bottom: 5px; - background-color: #282828; - border-radius: 5px; - animation-name: flow_down_b; - animation-duration: 0.25s; - border-style: solid; - border-width: 0px; - box-shadow: 0px 1px 0px 0px #717171 inset, 0px 5px 15px 0px rgba(0, 0, 0, 0.50); - z-index: 1000; -} - -div#confirm_popup button { - margin-top: 15px; - border-width: 0px !important; - padding: 10px; - font-size: 15px; - color: white !important; - margin-bottom: 7.5px; - box-shadow: none; -} - -div#confirm_popup b { - letter-spacing: 0.75px; -} - -#new_name_input { - border-width: 0px; - border-radius: 5px; - padding: 10px; - background-color: #ffffff39; - color: var(--foreground-color); - font-family: "Instrumental", sans-serif; - border-width: 1px; - border-style: solid; - border-color: #ffffff39; -} - -#new_name_input::selection { - background-color: #02050f; -} - -#info_msg { - position: absolute; - top: 50px; - left: calc(50vw - (300px + 20px)); - width: 300px; - padding: 20px; - border-radius: 10px; - background-color: #565656; - color: white; - animation: flow_down 0.25s; - z-index: 100; - box-shadow: 0px 1px 0px 0px #A0A0A0 inset, 0px 5px 15px 0px rgba(0, 0, 0, 0.50); -} - -#search_input { - height: 20px; -} - -#search_input::placeholder { - color: white; +::placeholder { + color: var(--foreground-color); +} + +::-webkit-scrollbar { + display: none; +} + +@font-face { + font-family: "Instrument Sans"; + src: url("InstrumentSans-Regular.ttf"); +} + +@font-face { + font-family: "Instrument Sans Bold"; + src: url("InstrumentSans-Bold.ttf"); +} + +@font-face { + font-family: "Instrument Sans Italic"; + src: url("InstrumentSans-Italic.ttf"); +} + +@keyframes fall-down { + 0% { + opacity: 0%; + height: 0px; + } +} + +::selection { + background-color: transparent; +} + +*.selectable::selection { + background-color: var(--accent-color); +} + +*:focus { + outline: none; +} + +* { + cursor: default; +} + +/* +-- Login Box -- +Width: 33vw +Padding: 40px; +Height: 100vh - 80 +Margin-Top: 40px; +*/ + +html { + height: 100%; +} + +body { + background-color: var(--background-color); + color: var(--foreground-color); + font-family: "Instrument Sans", sans-serif; + margin: 0px; + height: 100%; +} + +nav { + background-color: var(--background-color); +} + +div#login_box { + width: 33vw; + min-width: 450px; + padding: 40px; + height: calc(100vh - 160px); + margin-top: 40px; + background-color: var(--transparent-low); + border-radius: 25px; + box-shadow: var(--box-shadow-ten-ten); +} + +div#menu { + background-color: var(--grey-1); + position: absolute; + left: 10px; + top: 60px; + border-radius: 5px; + animation-name: fall-down; + animation-duration: 0.25s; + animation-fill-mode: forwards; + z-index: 100; + box-shadow: 0px 1px 0px 0px #A0A0A0 inset, 0px 5px 15px 0px rgba(0, 0, 0, 0.50); +} + +div#menu a { + font-size: large; + text-decoration: none; + display: inline-block; + padding: 10px; + color: var(--foreground-color); + transition: all ease-in-out 200ms; + text-decoration: underline; + text-decoration-color: transparent; +} + +div#info { + padding: 10px; + background-color: var(--grey-3); + color: var(--foreground-color); + position: absolute; + left: calc(50vw - 30vw); + top: calc(50vh - 40vh + 40px); + width: 60vw; + height: 60vh; + border-radius: 10px; + padding: 20px; + box-shadow: 0px 1px 0px 0px #A0A0A0 inset, 0px 5px 15px 0px rgba(0, 0, 0, 0.50); +} + +div#info h1 { + font-size: xx-large; +} + +div#info h2 { + font-size: x-large; +} + +div#info h3 { + font-size: large; +} + +div#info #body { + height: 50vh; + overflow-x: scroll; +} + +div#info #nav { + height: 10vh; +} + +div#info #nav * { + margin-top: 5vh; +} + +div#info #nav button#bf { + margin-left: 10px; + width: 50px; +} + +div#main_box table { + width: 100%; + height: calc(100vh - 50px); +} + +div#main_box { + width: 100%; + vertical-align: top; +} + +div#main_box #file_box { + padding-left: 10px; + background-color: var(--transparent-low); + overflow-y: scroll; + height: 100%; + padding-top: 50px; +} + +div#main_box #file_box a { + color: var(--foreground-color); + text-decoration: none; +} + +div.file_button { + padding: 15px; + width: calc(100% - 40px); + margin-top: 10px; + border-bottom: var(--grey-1) 1px solid; + border-radius: 5px; + transition: ease-in-out 100ms; + border-bottom-left-radius: 0px; + border-bottom-right-radius: 0px; +} + +div.file_button:hover { + border-bottom: transparent 1px solid; + border-bottom-left-radius: 5px; + border-bottom-right-radius: 5px; +} + +div.file_button img { + margin-bottom: -5px; + margin-right: 10px; +} + +div#file_menu { + background-color: var(--grey-3); + border-radius: 2.5px; + position: absolute; + width: 200px; + overflow-x: hidden; + z-index: 100; + padding-top: 10px; + padding-bottom: 10px; + box-shadow: 0px 1px 0px 0px #A0A0A0 inset, 0px 5px 15px 0px rgba(0, 0, 0, 0.50); +} + +div#file_menu button { + width: 100%; + background-color: var(--grey-3) !important; + height: auto; + font-size: 12pt; + border-radius: 0px; + margin-bottom: 0px; + margin-top: 0px; + padding: 10px; + text-align: left; + transition: ease-in-out 100ms; + box-shadow: none; + border-width: 0px; +} + +div#file_menu button:hover { + filter: brightness(150%); +} + +div#file_menu #file_menu_title { + color: var(--foreground-color); + font-weight: 100; + font-size: small; + margin-bottom: 10px; +} + +button.dangerous { + background-color: var(--accent-color-red) !important; +} + +img#empty_icon { + margin-top: calc(50vh - 200px); + -webkit-user-drag: none; + user-select: none; + -moz-user-select: none; + -webkit-user-select: none; + -ms-user-select: none; +} + +@keyframes flow_down { + 0% {top: 0px;} + 100% { + top: 20px; + } +} + +#password_request { + position: absolute; + top: 70px; + left: calc(50vw - 150px); + width: 300px; + padding: 20px; + border-radius: 10px; + background-color: var(--background-color-2); + animation: flow_down 0.25s; +} + +*.margin-left-small { + margin-left: 10px; +} + +@keyframes fade-in { + 0%{opacity: 0%;} +} + +#chat_inframe, #editor_popup, #security_advisor { + position: absolute; + top: calc(10vh); + left: calc(10vw); + height: 80vh; + width: 80vw; + border-radius: 10px; + border-style: solid; + border-width: 0px; + z-index: 100; + box-shadow: 0px 5px 25px 0px rgba(0, 0, 0, 0.50); + animation-name: fade-in; + animation-duration: 200ms; + background-color: var(--background-color); +} + +#security_advisor { + width: 25vw; + height: 25vw; + left: 37.5vw; + top: 12.5vw; + border-color: var(--grey-3); + border-width: 1px; +} + +div#file_info_menu { + height: calc(100% - 70px); + position: fixed; + top: 52px; + right: 0px; + padding: 10px; + background-color: var(--grey-2); + width: 25vw; + min-width: 250px; + z-index: 100; +} + +div#file_info_menu #img_wrapper img { + object-fit: cover; + width: 90px; +} + +div#file_info_menu span#file_info_menu_filename { + width: calc(100% - 20px); + text-align: center; + display: inline-block; + font-size: x-large; + padding: 5px; +} +div#file_info_menu span#file_info_menu_filetype { + display: inline-block; + text-align: center; + width: calc(100% - 20px); + opacity: 50%; + padding: 10px; + padding-bottom: 10px; +} + +div#file_info_menu span#file_info_menu_filesize, span#file_info_menu_fmd, span#file_info_menu_fcd { + padding: 10px; + font-size: medium; +} + +iframe#file_preview { + position: absolute; + width: 75vw; + height: 75vh; + top: 12.5vh; + left: 12.5vw; + border-radius: 5px; + border-width: 1px; + border-style: solid; + border-color: var(--grey-3); + z-index: 100; +} + + +div#encryption_popup { + position: absolute; + width: 50vh; + height: 50vh; + top: 25vh; + left: 37.5vw; + background-color: var(--grey-2); + color: var(--foreground-color); + border-radius: 5px; + overflow: hidden; +} + +div#encryption_popup .modal_title { + background-color: var(--accent-color); + padding: 10px; +} + +div#encryption_popup input { + margin: 10px; +} + +@keyframes flow_down_b { + 0% { + top: 0px; + } +} + +div#confirm_popup { + color: white; + position: absolute; + top: 60px; + left: calc(50vw - 160px); + width: 300px; + padding: 10px; + padding-bottom: 5px; + background-color: #282828; + border-radius: 5px; + animation-name: flow_down_b; + animation-duration: 0.25s; + border-style: solid; + border-width: 0px; + box-shadow: 0px 1px 0px 0px #717171 inset, 0px 5px 15px 0px rgba(0, 0, 0, 0.50); + z-index: 1000; +} + +div#confirm_popup button { + margin-top: 15px; + border-width: 0px !important; + padding: 10px; + font-size: 15px; + color: white !important; + margin-bottom: 7.5px; + box-shadow: none; +} + +div#confirm_popup b { + letter-spacing: 0.75px; +} + +#new_name_input { + border-width: 0px; + border-radius: 5px; + padding: 10px; + background-color: #ffffff39; + color: var(--foreground-color); + font-family: "Instrumental", sans-serif; + border-width: 1px; + border-style: solid; + border-color: #ffffff39; +} + +#new_name_input::selection { + background-color: #02050f; +} + +#info_msg { + position: absolute; + top: 50px; + left: calc(50vw - (300px + 20px)); + width: 300px; + padding: 20px; + border-radius: 10px; + background-color: #565656; + color: white; + animation: flow_down 0.25s; + z-index: 100; + box-shadow: 0px 1px 0px 0px #A0A0A0 inset, 0px 5px 15px 0px rgba(0, 0, 0, 0.50); +} + +#search_input { + height: 20px; +} + +#search_input::placeholder { + color: white; +} + +@keyframes slider { + 50% { + width: 0px; + rotate: 2turn; + filter: hue-rotate(1turn); + } +} + +#upload_loading_indicator #slider { + height: 7.5px; + background-color: var(--accent-color); + border-radius: 5px; + width: 100px; + animation-name: slider; + animation-duration: 2s; + animation-iteration-count: infinite; + display: inline-block; + box-shadow: 0px 1px 0px 0px #A0A0A0 inset, 0px 5px 20px 0px rgba(0, 0, 0, 0.50); +} + +#upload_loading_indicator { + position: absolute; + top: calc(50vh - 3.75px); + left: calc(50vw - 50px); + width: 100px; } \ No newline at end of file diff --git a/asset/homescreen.js b/asset/homescreen.js index 90f9aef..7bd0ddc 100644 --- a/asset/homescreen.js +++ b/asset/homescreen.js @@ -1,316 +1,320 @@ -function simple_post_fetch(url, data) { - const formData = new FormData(); - for (const key in data) { - if (data.hasOwnProperty(key)) { - formData.append(key, data[key]); - } - } - - fetch(url, { - method: "POST", - body: formData - }) - .then(response => response.text()) - .then( - function (response) { - console.log(response) - } - ) - -} - -function hide_menu() { - setTimeout(function () { - document.getElementById("menu").hidden = true; - }, 200) -} - -function open_menu() { - document.getElementById("menu").style.top = "60px" - document.getElementById("menu").style.opacity = "100%" - document.getElementById("menu").hidden = !document.getElementById("menu").hidden -} - -function open_info() { - document.getElementById("info").hidden = !document.getElementById("info").hidden -} - -function l_confirm(message, function_if_confirmed) { - document.getElementById("confirm_popup").hidden = false; - document.getElementById("confirm_popup_message").innerHTML = message; - document.getElementById("confirm_popup_confirm").onclick = function_if_confirmed; -} - -function show_file_menu(file, event) { - document.getElementById("file_menu").hidden = false - document.getElementById("file_menu_delete_button").onclick = function () { - filename = event.srcElement.innerHTML.split("> ")[1].replaceAll(" ", "_") - l_confirm("Do you want to delete \"" + filename + "\"?", function () { - fetch(location.protocol + "//" + location.hostname + ":" + location.port + "/delete-file/" + filename) - event.srcElement.remove() - document.getElementById("confirm_popup").hidden = true; - }) - } - document.getElementById("file_menu_encryption_button").onclick = function () { - filename = event.srcElement.innerHTML.split("> ")[1].replaceAll(" ", "_") - document.getElementById("encryption_popup").hidden = false; - document.getElementById("filename_encpop").value = filename - setTimeout(function () { - window.onclick = function (event) { - var divElement = document.getElementById("encryption_popup") - var targetElement = event.target; - - if (!divElement.contains(targetElement) && divElement != targetElement) { - console.log(targetElement) - document.getElementById("encryption_popup").hidden = true; - setTimeout(function () { - window.onclick = function () { } - }, 100) - } - } - - }, 100) - } - document.getElementById("file_menu_rawedit_button").onclick = function () { - filename = event.srcElement.innerHTML.split("> ")[1].replaceAll(" ", "_") - document.getElementById("editor_popup").hidden = false - document.getElementById("editor_popup").src = "/rawedit/" + filename - setTimeout(function () { - window.onclick = function (event) { - var divElement = document.getElementById("editor_popup") - var targetElement = event.target; - - if (!divElement.contains(targetElement) && divElement != targetElement) { - console.log(targetElement) - document.getElementById("editor_popup").hidden = true; - } - } - - }, 100) - } - - document.getElementById("file_menu_download_button").onclick = function () { - filename = event.srcElement.innerHTML.split("> ")[1].replaceAll(" ", "_") - window.open("/load-file/" + filename) - } - document.getElementById("file_menu_rename_button").onclick = function () { - l_confirm("Rename
")[1] + "\">", function () { - new_name = document.getElementById("new_name_input").value - if (new_name != "") { - event.srcElement.innerHTML = event.srcElement.innerHTML.split(">")[0] + "> " + event.srcElement.innerHTML.split(">")[1].replaceAll(event.srcElement.innerHTML.split(">")[1], new_name.replaceAll("_", " ")) - fetch(location.protocol + "//" + location.hostname + ":" + location.port + "/rename-file/" + file + "/" + new_name) - document.getElementById("confirm_popup").hidden = true; - } - }) - } - document.getElementById("file_menu_share_button").onclick = async function () { - filename = event.srcElement.innerHTML.split("> ")[1].replaceAll(" ", "_") - console.log("/share/info/" + btoa(filename)) - fetch("/share/info/" + btoa(filename)) - .then((response) => { - if (response.ok) { - return response.text() - } - else { - return "Error" - } - }) - .then( - function (response) { - if (response == "not_shared") { - l_confirm("Do you want to create a sharing link for " + filename + "?", function () { - fetch("/share/reglink/" + btoa(filename)).then( - (response) => { - if (response.ok) { - return response.text() - } - else { - return "Failed to get" - } - } - ) - .then( - function (response) { - document.getElementById("confirm_popup").hidden = true; - code = "https://"+location.host+response - l_confirm("Copy this code with CTRL+C.
"+code+"
", function () { - document.getElementById("confirm_popup").hidden = true; - }) - } - ) - }) - } - else { - l_confirm("Do you want to remove the sharing link for this file?", function () { - fetch("/share/unreg/"+btoa(filename)) - l_confirm("The share link is removed for this file.", function () { - document.getElementById("confirm_popup").hidden = true; - }) - }) - } - } - ) - } - - var x = event.clientX; - var y = event.clientY; - document.getElementById("file_menu").style.left = (x - document.getElementById("file_menu").offsetWidth / 2 + 90) + 'px'; - document.getElementById("file_menu").style.top = (y - document.getElementById("file_menu").offsetHeight / 2 + 90) + 'px'; - document.body.onclick = function () { - document.getElementById("file_menu").hidden = true - } - return false; -} - -help_page = 0 -sites = ["upload_file", "file_options"] - -function next_topic() { - help_page = help_page + 1 - location.href = "#" + sites[help_page] - if (help_page > sites.length - 1) { - help_page = sites.length - 1 - location.href = "#" + sites[help_page] - } -} - -function last_topic() { - help_page = help_page - 1 - location.href = "#" + sites[help_page] - if (help_page < 0) { - help_page = 0 - location.href = "#" + sites[help_page] - } -} - -window.onload = function () { - if (sessionStorage.getItem("last_screen_info") == "password_load_file") { - document.getElementById("password_request").hidden = false; - sessionStorage.removeItem("last_screen_info") - } - else if (sessionStorage.getItem('last_screen_info') == "upload_fail_virus") { - document.getElementById("info_msg").hidden = false; - document.getElementById("info_message").innerHTML = "The file is a virus
" + sessionStorage.getItem("virus_name+"); - sessionStorage.removeItem("last_screen_info") - sessionStorage.removeItem("virus_name") - setTimeout(hide_info, 6500) - } - if (sessionStorage.getItem("filename") != undefined) { - document.getElementById("filename").value = sessionStorage.getItem("filename") - sessionStorage.removeItem("filename") - } - if (localStorage.getItem("intro_homescreen") != "true") { - document.getElementById("info").hidden = false; - localStorage.setItem("intro_homescreen", "true") - } - -} -function show_file_info(filename, filesize, filetype, filemday, filecday, mimeicon) { - filename = event.srcElement.innerHTML.split("> ")[1].replaceAll(" ", "_") - document.getElementById("file_info_menu").hidden = false; - document.getElementById("file_info_menu_icon").src = "/asset/" + mimeicon - document.getElementById("file_info_menu_filename").innerHTML = filename.replaceAll("_", " "); - document.getElementById("file_info_menu_filesize").innerHTML = filesize + "MB"; - document.getElementById("file_info_menu_filetype").innerHTML = filetype; - document.getElementById("file_info_menu_fmd").innerHTML = "Edited: " + filemday; - document.getElementById("file_info_menu_fcd").innerHTML = "Created: " + filecday - if (filename.includes(".jpg") || filename.includes(".png") || filename.includes(".jpeg") || filename.includes(".tiff") || filename.includes(".webp") || filename.includes(".heic") || filename.includes(".ico")) { - document.getElementById("file_info_menu_icon").src = "/thumbnail-load-file/" + filename.replaceAll(" ", "_") - document.getElementById("file_info_menu_icon").style.borderRadius = "5px" - } - else { - document.getElementById("file_info_menu_icon").style.borderRadius = "0px" - } - -} - -function show_file(file) { - filename = event.srcElement.innerHTML.split("> ")[1].replaceAll(" ", "_") - var elbgb = event.srcElement.style.backgroundColor - event.srcElement.style.backgroundColor = "dodgerblue" - var evl = event - fetch(location.protocol + "//" + location.hostname + ":" + location.port + "/load-file/" + filename).then( - function (response) { - if (response.status == "901") { - sessionStorage.setItem('last_screen_info', 'password_load_file'); sessionStorage.setItem('filename', filename - ); location.reload() - } - else { - evl.srcElement.style.backgroundColor = elbgb - evl.srcElement.blur() - location.assign("/load-file/" + filename) - } - } - ) -} -function search_for_file(filename) { - if (filename != "") { - fetch(location.protocol + "//" + location.hostname + ":" + location.port + "/search/q/" + filename) - .then(function (response) { - return response.text(); - }) - .then(function (data) { - document.getElementById("file_box").innerHTML = data; - }) - .catch(function () { - location.reload(); - }); - } else { - location.reload(); - } -} - -function upload_new_file() { - function hide_info() { - document.getElementById("info_msg").hidden = true; - } - document.getElementById("file_upload_button").click() - document.getElementById("file_upload_button").onchange = function () { - const upload_form_data = new FormData(); - upload_form_data.append("file_upload", document.getElementById("file_upload_button").files[0]); - upload_form_data.append("filename", document.getElementById("file_upload_button").value.split("\\")[document.getElementById("file_upload_button").value.split("\\").length - 1]); - const requestOptions = { - method: "POST", - body: upload_form_data, - }; - fetch(location.protocol + "//" + location.hostname + ":" + location.port + "/upload/web", requestOptions).then( - function (response) { - if (response.status == 903) { - document.getElementById("info_msg").hidden = false; - document.getElementById("info_message").innerHTML = "The file type is blocked"; - sessionStorage.removeItem("last_screen_info") - setTimeout(hide_info, 2000) - } - else if (response.status == 904) { - document.getElementById("info_msg").hidden = false; - document.getElementById("info_message").innerHTML = "This file already exists"; - sessionStorage.removeItem("last_screen_info") - setTimeout(hide_info, 6500) - } - else if (response.status == 905) { - document.getElementById("info_msg").hidden = false; - document.getElementById("info_message").innerHTML = "This file is malicious"; - sessionStorage.removeItem("last_screen_info") - setTimeout(hide_info, 6500) - } - else { - location.reload() - } - } - ) - - } - -} - -function security_advisor() { - var advisorElement = document.getElementById("security_advisor"); - advisorElement.hidden = false; - - setTimeout(function () { - window.addEventListener("click", function hideAdvisor() { - advisorElement.hidden = true; - window.removeEventListener("click", hideAdvisor); - }); - }, 100); +function simple_post_fetch(url, data) { + const formData = new FormData(); + for (const key in data) { + if (data.hasOwnProperty(key)) { + formData.append(key, data[key]); + } + } + + fetch(url, { + method: "POST", + body: formData + }) + .then(response => response.text()) + .then( + function (response) { + console.log(response) + } + ) + +} + +function hide_menu() { + setTimeout(function () { + document.getElementById("menu").hidden = true; + }, 200) +} + +function open_menu() { + document.getElementById("menu").style.top = "60px" + document.getElementById("menu").style.opacity = "100%" + document.getElementById("menu").hidden = !document.getElementById("menu").hidden +} + +function open_info() { + document.getElementById("info").hidden = !document.getElementById("info").hidden +} + +function l_confirm(message, function_if_confirmed) { + document.getElementById("confirm_popup").hidden = false; + document.getElementById("confirm_popup_message").innerHTML = message; + document.getElementById("confirm_popup_confirm").onclick = function_if_confirmed; +} + +function show_file_menu(file, event) { + document.getElementById("file_menu").hidden = false + document.getElementById("file_menu_delete_button").onclick = function () { + filename = event.srcElement.innerHTML.split("> ")[1].replaceAll(" ", "_") + l_confirm("Do you want to delete \"" + filename + "\"?", function () { + fetch(location.protocol + "//" + location.hostname + ":" + location.port + "/delete-file/" + filename) + event.srcElement.remove() + document.getElementById("confirm_popup").hidden = true; + }) + } + document.getElementById("file_menu_encryption_button").onclick = function () { + filename = event.srcElement.innerHTML.split("> ")[1].replaceAll(" ", "_") + document.getElementById("encryption_popup").hidden = false; + document.getElementById("filename_encpop").value = filename + setTimeout(function () { + window.onclick = function (event) { + var divElement = document.getElementById("encryption_popup") + var targetElement = event.target; + + if (!divElement.contains(targetElement) && divElement != targetElement) { + console.log(targetElement) + document.getElementById("encryption_popup").hidden = true; + setTimeout(function () { + window.onclick = function () { } + }, 100) + } + } + + }, 100) + } + document.getElementById("file_menu_rawedit_button").onclick = function () { + filename = event.srcElement.innerHTML.split("> ")[1].replaceAll(" ", "_") + document.getElementById("editor_popup").hidden = false + document.getElementById("editor_popup").src = "/rawedit/" + filename + setTimeout(function () { + window.onclick = function (event) { + var divElement = document.getElementById("editor_popup") + var targetElement = event.target; + + if (!divElement.contains(targetElement) && divElement != targetElement) { + console.log(targetElement) + document.getElementById("editor_popup").hidden = true; + } + } + + }, 100) + } + + document.getElementById("file_menu_download_button").onclick = function () { + filename = event.srcElement.innerHTML.split("> ")[1].replaceAll(" ", "_") + window.open("/load-file/" + filename) + } + document.getElementById("file_menu_rename_button").onclick = function () { + l_confirm("Rename
")[1] + "\">", function () { + new_name = document.getElementById("new_name_input").value + if (new_name != "") { + event.srcElement.innerHTML = event.srcElement.innerHTML.split(">")[0] + "> " + event.srcElement.innerHTML.split(">")[1].replaceAll(event.srcElement.innerHTML.split(">")[1], new_name.replaceAll("_", " ")) + fetch(location.protocol + "//" + location.hostname + ":" + location.port + "/rename-file/" + file + "/" + new_name) + document.getElementById("confirm_popup").hidden = true; + } + }) + } + document.getElementById("file_menu_share_button").onclick = async function () { + filename = event.srcElement.innerHTML.split("> ")[1].replaceAll(" ", "_") + console.log("/share/info/" + btoa(filename)) + fetch("/share/info/" + btoa(filename)) + .then((response) => { + if (response.ok) { + return response.text() + } + else { + return "Error" + } + }) + .then( + function (response) { + if (response == "not_shared") { + l_confirm("Do you want to create a sharing link for " + filename + "?", function () { + fetch("/share/reglink/" + btoa(filename)).then( + (response) => { + if (response.ok) { + return response.text() + } + else { + return "Failed to get" + } + } + ) + .then( + function (response) { + document.getElementById("confirm_popup").hidden = true; + code = "https://"+location.host+response + l_confirm("Copy this code with CTRL+C.
"+code+"
", function () { + document.getElementById("confirm_popup").hidden = true; + }) + } + ) + }) + } + else { + l_confirm("Do you want to remove the sharing link for this file?", function () { + fetch("/share/unreg/"+btoa(filename)) + l_confirm("The share link is removed for this file.", function () { + document.getElementById("confirm_popup").hidden = true; + }) + }) + } + } + ) + } + + var x = event.clientX; + var y = event.clientY; + document.getElementById("file_menu").style.left = (x - document.getElementById("file_menu").offsetWidth / 2 + 90) + 'px'; + document.getElementById("file_menu").style.top = (y - document.getElementById("file_menu").offsetHeight / 2 + 90) + 'px'; + document.body.onclick = function () { + document.getElementById("file_menu").hidden = true + } + return false; +} + +help_page = 0 +sites = ["upload_file", "file_options"] + +function next_topic() { + help_page = help_page + 1 + location.href = "#" + sites[help_page] + if (help_page > sites.length - 1) { + help_page = sites.length - 1 + location.href = "#" + sites[help_page] + } +} + +function last_topic() { + help_page = help_page - 1 + location.href = "#" + sites[help_page] + if (help_page < 0) { + help_page = 0 + location.href = "#" + sites[help_page] + } +} + +window.onload = function () { + if (sessionStorage.getItem("last_screen_info") == "password_load_file") { + document.getElementById("password_request").hidden = false; + sessionStorage.removeItem("last_screen_info") + } + else if (sessionStorage.getItem('last_screen_info') == "upload_fail_virus") { + document.getElementById("info_msg").hidden = false; + document.getElementById("info_message").innerHTML = "The file is a virus
" + sessionStorage.getItem("virus_name+"); + sessionStorage.removeItem("last_screen_info") + sessionStorage.removeItem("virus_name") + setTimeout(hide_info, 6500) + } + if (sessionStorage.getItem("filename") != undefined) { + document.getElementById("filename").value = sessionStorage.getItem("filename") + sessionStorage.removeItem("filename") + } + if (localStorage.getItem("intro_homescreen") != "true") { + document.getElementById("info").hidden = false; + localStorage.setItem("intro_homescreen", "true") + } + +} +function show_file_info(filename, filesize, filetype, filemday, filecday, mimeicon) { + filename = event.srcElement.innerHTML.split("> ")[1].replaceAll(" ", "_") + document.getElementById("file_info_menu").hidden = false; + document.getElementById("file_info_menu_icon").src = "/asset/" + mimeicon + document.getElementById("file_info_menu_filename").innerHTML = filename.replaceAll("_", " "); + document.getElementById("file_info_menu_filesize").innerHTML = filesize + "MB"; + document.getElementById("file_info_menu_filetype").innerHTML = filetype; + document.getElementById("file_info_menu_fmd").innerHTML = "Edited: " + filemday; + document.getElementById("file_info_menu_fcd").innerHTML = "Created: " + filecday + if (filename.includes(".jpg") || filename.includes(".png") || filename.includes(".jpeg") || filename.includes(".tiff") || filename.includes(".webp") || filename.includes(".heic") || filename.includes(".ico")) { + document.getElementById("file_info_menu_icon").src = "/thumbnail-load-file/" + filename.replaceAll(" ", "_") + document.getElementById("file_info_menu_icon").style.borderRadius = "5px" + } + else { + document.getElementById("file_info_menu_icon").style.borderRadius = "0px" + } + +} + +function show_file(file) { + filename = event.srcElement.innerHTML.split("> ")[1].replaceAll(" ", "_") + var elbgb = event.srcElement.style.backgroundColor + event.srcElement.style.backgroundColor = "dodgerblue" + var evl = event + fetch(location.protocol + "//" + location.hostname + ":" + location.port + "/load-file/" + filename).then( + function (response) { + if (response.status == "901") { + sessionStorage.setItem('last_screen_info', 'password_load_file'); sessionStorage.setItem('filename', filename + ); location.reload() + } + else { + evl.srcElement.style.backgroundColor = elbgb + evl.srcElement.blur() + location.assign("/load-file/" + filename) + } + } + ) +} +function search_for_file(filename) { + if (filename != "") { + fetch(location.protocol + "//" + location.hostname + ":" + location.port + "/search/q/" + filename) + .then(function (response) { + return response.text(); + }) + .then(function (data) { + document.getElementById("file_box").innerHTML = data; + }) + .catch(function () { + location.reload(); + }); + } else { + location.reload(); + } +} + +function upload_new_file() { + function hide_info() { + document.getElementById("info_msg").hidden = true; + } + document.getElementById("file_upload_button").click() + document.getElementById("file_upload_button").onchange = function () { + const upload_form_data = new FormData(); + upload_form_data.append("file_upload", document.getElementById("file_upload_button").files[0]); + upload_form_data.append("filename", document.getElementById("file_upload_button").value.split("\\")[document.getElementById("file_upload_button").value.split("\\").length - 1]); + const requestOptions = { + method: "POST", + body: upload_form_data, + }; + document.getElementById("upload_loading_indicator").hidden = false; + fetch(location.protocol + "//" + location.hostname + ":" + location.port + "/upload/web", requestOptions).then( + function (response) { + if (response.status == 903) { + document.getElementById("info_msg").hidden = false; + document.getElementById("info_message").innerHTML = "The file type is blocked"; + sessionStorage.removeItem("last_screen_info") + setTimeout(hide_info, 2000) + document.getElementById("upload_loading_indicator").hidden = true; + } + else if (response.status == 904) { + document.getElementById("info_msg").hidden = false; + document.getElementById("info_message").innerHTML = "This file already exists"; + sessionStorage.removeItem("last_screen_info") + setTimeout(hide_info, 6500) + document.getElementById("upload_loading_indicator").hidden = true; + } + else if (response.status == 905) { + document.getElementById("info_msg").hidden = false; + document.getElementById("info_message").innerHTML = "This file is malicious"; + sessionStorage.removeItem("last_screen_info") + setTimeout(hide_info, 6500) + document.getElementById("upload_loading_indicator").hidden = true; + } + else { + location.reload() + } + } + ) + + } + +} + +function security_advisor() { + var advisorElement = document.getElementById("security_advisor"); + advisorElement.hidden = false; + + setTimeout(function () { + window.addEventListener("click", function hideAdvisor() { + advisorElement.hidden = true; + window.removeEventListener("click", hideAdvisor); + }); + }, 100); } \ No newline at end of file diff --git a/asset/login.js b/asset/login.js index 89267b7..df5c0f4 100644 --- a/asset/login.js +++ b/asset/login.js @@ -1,28 +1,28 @@ -window.onload = function () { - function hide_info() { - document.getElementById("info").hidden = true; - } - function popup(info) { - document.getElementById("info").hidden = false; - document.getElementById("info_message").innerHTML = info; - } - document.getElementById("login_formular").onsubmit = function () { - document.getElementById("loading_wheel").hidden = false; - document.getElementById("submit_button").disabled = "true"; - } - if (sessionStorage.getItem("last_screen_info") == "login_auth_fail_password") { - popup("Wrong password") - sessionStorage.removeItem("last_screen_info"); - setTimeout(hide_info, 3400); - } - else if (sessionStorage.getItem("last_screen_info") == "logged_of") { - popup("You're logged out") - sessionStorage.removeItem("last_screen_info"); - setTimeout(hide_info, 3400); - } - else if (sessionStorage.getItem("last_screen_info") == "register_success") { - popup("Registration worked.
You can now login") - sessionStorage.removeItem("last_screen_info"); - setTimeout(hide_info, 3400); - } +window.onload = function () { + function hide_info() { + document.getElementById("info").hidden = true; + } + function popup(info) { + document.getElementById("info").hidden = false; + document.getElementById("info_message").innerHTML = info; + } + document.getElementById("login_formular").onsubmit = function () { + document.getElementById("loading_wheel").hidden = false; + document.getElementById("submit_button").disabled = "true"; + } + if (sessionStorage.getItem("last_screen_info") == "login_auth_fail_password") { + popup("Wrong password") + sessionStorage.removeItem("last_screen_info"); + setTimeout(hide_info, 3400); + } + else if (sessionStorage.getItem("last_screen_info") == "logged_of") { + popup("You're logged out") + sessionStorage.removeItem("last_screen_info"); + setTimeout(hide_info, 3400); + } + else if (sessionStorage.getItem("last_screen_info") == "register_success") { + popup("Registration worked.
You can now login") + sessionStorage.removeItem("last_screen_info"); + setTimeout(hide_info, 3400); + } } \ No newline at end of file diff --git a/asset/lui.css b/asset/lui.css index 30493f9..cee0685 100644 --- a/asset/lui.css +++ b/asset/lui.css @@ -1,165 +1,165 @@ -a, -button, -label, -button img { - cursor: pointer; -} - -body { - background-color: var(--background-color); - color: var(--foreground-color); - font-family: "Instrument Sans", sans-serif; - margin: 0px; -} - -button { - background-color: var(--accent-color); - color: var(--background-color); - width: 120px; - height: 40px; - font-size: 18px; - border-width: 0px; - border-style: solid; - border-radius: 5px; - font-family: "Instrument Sans", sans-serif; - margin-top: 10px; - box-shadow: 0px 1px 0px 0px #ffffff87 inset, 0px 5px 15px 0px rgba(0, 0, 0, 0.50); - transition: ease-in-out 0.25s; -} - -button.second { - background-color: transparent; - border: 2px solid var(--accent-color) !important; - color: var(--accent-color) !important; -} - -button:focus { - filter: brightness(120%); -} - -button:active { - filter: brightness(130%); -} - -input[type="text"], -input[type="password"] { - background-color: var(--transparent-heavy); - color: var(--foreground-color); - font-family: "Instrument Sans", sans-serif !important; - font-size: 18px; - border-width: 0px; - border-color: 0px; - border-style: solid; - border-radius: 5px; - height: 40px; - width: 240px; - padding-left: 10px; - margin-top: 7.5px; - margin-bottom: 7.5px; -} - -button:hover, -input[type="text"]:focus, -input[type="password"]:focus { - filter: brightness(120%); -} - -b { - font-family: "Instrument Sans Bold"; -} - -i { - font-family: "Instrument Sans Italic"; -} - -a, -a::after, -a:hover, -a:active { - color: var(--link-color); -} - -h1, -h2, -h3, -h4 { - margin: 0px; - padding: 0px; - letter-spacing: 1px; - font-weight: 100; -} - -h1 { - font-size: 15px; - font-family: "Instrument Sans", sans-serif; - margin-bottom: 5px; - opacity: 80%; -} - -h2 { - font-size: 18px; -} - -nav#menu_bar img { - top: 18px; - left: 55px; - position: absolute; - transition: ease-in-out 0.25s; -} - -nav#menu_bar img.l1 { - left: 82px; -} - -nav#menu_bar img.l2 { - left: 109px; -} - -nav#menu_bar img.l3 { - left: 136px; -} - -nav#menu_bar img:hover { - filter: brightness(125%); -} - -nav#menu_bar h1 { - font-size: 20px; - margin-left: 30px; -} - -nav#menu_bar { - padding: 10px; - width: calc(100% - 20px); - height: 32px; - position: fixed; -} - -#logo_button { - padding: 5px; - font-size: 20px; - position: fixed; - background-color: var(--accent-color); - width: 25px; - border-radius: 5px; - transition: all ease-in-out 0.25s; -} - -#logo_button:hover { - filter: brightness(1.1); -} - -nav#menu_bar input[type="text"] { - position: absolute; - right: 10px; - border-radius: 2.5px; - padding: 5px; - border-width: 0px; - font-family: "Instrumental", sans-serif; - background-color: var(--input-background); - margin: 0px; - font-size: 12px; - top: 12px; - z-index: 100; - width: 200px; +a, +button, +label, +button img { + cursor: pointer; +} + +body { + background-color: var(--background-color); + color: var(--foreground-color); + font-family: "Instrument Sans", sans-serif; + margin: 0px; +} + +button { + background-color: var(--accent-color); + color: var(--background-color); + width: 120px; + height: 40px; + font-size: 18px; + border-width: 0px; + border-style: solid; + border-radius: 5px; + font-family: "Instrument Sans", sans-serif; + margin-top: 10px; + box-shadow: 0px 1px 0px 0px #ffffff87 inset, 0px 5px 15px 0px rgba(0, 0, 0, 0.50); + transition: ease-in-out 0.25s; +} + +button.second { + background-color: transparent; + border: 2px solid var(--accent-color) !important; + color: var(--accent-color) !important; +} + +button:focus { + filter: brightness(120%); +} + +button:active { + filter: brightness(130%); +} + +input[type="text"], +input[type="password"] { + background-color: var(--transparent-heavy); + color: var(--foreground-color); + font-family: "Instrument Sans", sans-serif !important; + font-size: 18px; + border-width: 0px; + border-color: 0px; + border-style: solid; + border-radius: 5px; + height: 40px; + width: 240px; + padding-left: 10px; + margin-top: 7.5px; + margin-bottom: 7.5px; +} + +button:hover, +input[type="text"]:focus, +input[type="password"]:focus { + filter: brightness(120%); +} + +b { + font-family: "Instrument Sans Bold"; +} + +i { + font-family: "Instrument Sans Italic"; +} + +a, +a::after, +a:hover, +a:active { + color: var(--link-color); +} + +h1, +h2, +h3, +h4 { + margin: 0px; + padding: 0px; + letter-spacing: 1px; + font-weight: 100; +} + +h1 { + font-size: 15px; + font-family: "Instrument Sans", sans-serif; + margin-bottom: 5px; + opacity: 80%; +} + +h2 { + font-size: 18px; +} + +nav#menu_bar img { + top: 18px; + left: 55px; + position: absolute; + transition: ease-in-out 0.25s; +} + +nav#menu_bar img.l1 { + left: 82px; +} + +nav#menu_bar img.l2 { + left: 109px; +} + +nav#menu_bar img.l3 { + left: 136px; +} + +nav#menu_bar img:hover { + filter: brightness(125%); +} + +nav#menu_bar h1 { + font-size: 20px; + margin-left: 30px; +} + +nav#menu_bar { + padding: 10px; + width: calc(100% - 20px); + height: 32px; + position: fixed; +} + +#logo_button { + padding: 5px; + font-size: 20px; + position: fixed; + background-color: var(--accent-color); + width: 25px; + border-radius: 5px; + transition: all ease-in-out 0.25s; +} + +#logo_button:hover { + filter: brightness(1.1); +} + +nav#menu_bar input[type="text"] { + position: absolute; + right: 10px; + border-radius: 2.5px; + padding: 5px; + border-width: 0px; + font-family: "Instrumental", sans-serif; + background-color: var(--input-background); + margin: 0px; + font-size: 12px; + top: 12px; + z-index: 100; + width: 200px; } \ No newline at end of file diff --git a/asset/manifest.json b/asset/manifest.json index 1ba2942..2c71d03 100644 --- a/asset/manifest.json +++ b/asset/manifest.json @@ -1,9 +1,9 @@ -{ - "name": "Lumos", - "short_name": "Lumos", - "theme_color": "#161616", - "background_color": "#161616", - "display": "standalone", - "scope": "/", - "start_url": "/" +{ + "name": "Lumos", + "short_name": "Lumos", + "theme_color": "#161616", + "background_color": "#161616", + "display": "standalone", + "scope": "/", + "start_url": "/" } \ No newline at end of file diff --git a/asset/musicplayer.css b/asset/musicplayer.css index 9b8eee9..82fec6e 100644 --- a/asset/musicplayer.css +++ b/asset/musicplayer.css @@ -1,137 +1,137 @@ -::placeholder { - color: var(--foreground-color); -} - -::-webkit-scrollbar { - display: none; -} - -@font-face { - font-family: "Instrument Sans"; - src: url("InstrumentSans-Regular.ttf"); -} - -@font-face { - font-family: "Instrument Sans Bold"; - src: url("InstrumentSans-Bold.ttf"); -} - -@font-face { - font-family: "Instrument Sans Italic"; - src: url("InstrumentSans-Italic.ttf"); -} - -@keyframes fall-down { - 0% { - opacity: 0%; - height: 0px; - } -} - -::selection { - background-color: transparent; -} - -*.selectable::selection { - background-color: var(--accent-color); -} - -*:focus { - outline: none; -} - -* { - cursor: default; -} - -/* --- Login Box -- -Width: 33vw -Padding: 40px; -Height: 100vh - 80 -Margin-Top: 40px; -*/ - -html { - height: 100%; -} - -body { - background-color: var(--background-color); - color: var(--foreground-color); - font-family: "Instrument Sans", sans-serif; - margin: 0px; - height: 100%; -} - -#lumos_title { - position: fixed; - top: 10px; - left: 10px; - opacity: 0.3; -} - -#player_box { - --width: 320px; - --height: 400px; - --pading: 20px; - width: var(--width); - height: var(--height); - padding: var(--pading); - position: fixed; - top: calc(50vh - (var(--height) + var(--pading)) / 2); - left: calc(50vw - (var(--width) + var(--pading)) / 2); - background-color: var(--grey-1); - border-radius: 15px; - box-shadow: 0px 1px 0px 0px #A0A0A0 inset, 0px 5px 15px 0px rgba(0, 0, 0, 0.50); -} - -#player_box img { - filter: 0px 5px 15px 0px rgba(0, 0, 0, 0.50); -} - -#song_title { - font-size: large; - max-width: 200px; - margin: 10px; -} - -#play_button { - width: 60px; - height: 60px; - border-radius: 50%; - font-size: 16px; - margin-top: calc(25% - 10px); -} - -#play_button img { - width: 20px; - padding-top: 2.5px; -} - -@keyframes pulse { - 0% {} - 50% {filter: brightness(1.4);} - 100% {} -} - -.pulse { - animation-name: pulse; - animation-duration: 0.5s; - animation-iteration-count: infinite; -} - -#scale_bg { - border-radius: 2px; - background-color: #efefef; - width: 200px; - height: 10px; - box-shadow: 0px 1px 0px 0px #A0A0A0 inset, 0px 5px 15px 0px rgba(0, 0, 0, 0.50); -} - -#scale_fg { - border-radius: 2px; - background-color: var(--accent-color); - height: 10px; - width: 0px; +::placeholder { + color: var(--foreground-color); +} + +::-webkit-scrollbar { + display: none; +} + +@font-face { + font-family: "Instrument Sans"; + src: url("InstrumentSans-Regular.ttf"); +} + +@font-face { + font-family: "Instrument Sans Bold"; + src: url("InstrumentSans-Bold.ttf"); +} + +@font-face { + font-family: "Instrument Sans Italic"; + src: url("InstrumentSans-Italic.ttf"); +} + +@keyframes fall-down { + 0% { + opacity: 0%; + height: 0px; + } +} + +::selection { + background-color: transparent; +} + +*.selectable::selection { + background-color: var(--accent-color); +} + +*:focus { + outline: none; +} + +* { + cursor: default; +} + +/* +-- Login Box -- +Width: 33vw +Padding: 40px; +Height: 100vh - 80 +Margin-Top: 40px; +*/ + +html { + height: 100%; +} + +body { + background-color: var(--background-color); + color: var(--foreground-color); + font-family: "Instrument Sans", sans-serif; + margin: 0px; + height: 100%; +} + +#lumos_title { + position: fixed; + top: 10px; + left: 10px; + opacity: 0.3; +} + +#player_box { + --width: 320px; + --height: 400px; + --pading: 20px; + width: var(--width); + height: var(--height); + padding: var(--pading); + position: fixed; + top: calc(50vh - (var(--height) + var(--pading)) / 2); + left: calc(50vw - (var(--width) + var(--pading)) / 2); + background-color: var(--grey-1); + border-radius: 15px; + box-shadow: 0px 1px 0px 0px #A0A0A0 inset, 0px 5px 15px 0px rgba(0, 0, 0, 0.50); +} + +#player_box img { + filter: 0px 5px 15px 0px rgba(0, 0, 0, 0.50); +} + +#song_title { + font-size: large; + max-width: 200px; + margin: 10px; +} + +#play_button { + width: 60px; + height: 60px; + border-radius: 50%; + font-size: 16px; + margin-top: calc(25% - 10px); +} + +#play_button img { + width: 20px; + padding-top: 2.5px; +} + +@keyframes pulse { + 0% {} + 50% {filter: brightness(1.4);} + 100% {} +} + +.pulse { + animation-name: pulse; + animation-duration: 0.5s; + animation-iteration-count: infinite; +} + +#scale_bg { + border-radius: 2px; + background-color: #efefef; + width: 200px; + height: 10px; + box-shadow: 0px 1px 0px 0px #A0A0A0 inset, 0px 5px 15px 0px rgba(0, 0, 0, 0.50); +} + +#scale_fg { + border-radius: 2px; + background-color: var(--accent-color); + height: 10px; + width: 0px; } \ No newline at end of file diff --git a/asset/rawedit.css b/asset/rawedit.css index d8db4aa..a3b0be4 100644 --- a/asset/rawedit.css +++ b/asset/rawedit.css @@ -1,247 +1,247 @@ -::placeholder { - color: var(--foreground-color); -} - -::-webkit-scrollbar { - display: none; -} - -@font-face { - font-family: "Instrument Sans"; - src: url("InstrumentSans-Regular.ttf"); -} - -@font-face { - font-family: "Instrument Sans Bold"; - src: url("InstrumentSans-Bold.ttf"); -} - -@font-face { - font-family: "Instrument Sans Italic"; - src: url("InstrumentSans-Italic.ttf"); -} - -@keyframes fall-down { - 0% { - opacity: 0%; - height: 0px; - } -} - -::selection { - background-color: transparent; -} - -*:focus { - outline: none; -} - -* { - cursor: default; -} - -/* --- Login Box -- -Width: 33vw -Padding: 40px; -Height: 100vh - 80 -Margin-Top: 40px; -*/ - -body, html { - height: 100%; - max-height: 100vh; - overflow: hidden; -} - -div#login_box { - width: 33vw; - min-width: 450px; - padding: 40px; - height: calc(100vh - 160px); - margin-top: 40px; - background-color: var(--transparent-low); - border-radius: 25px; - box-shadow: var(--box-shadow-ten-ten); -} - -nav#menu_bar { - padding: 10px; - width: calc(100% - 20px); - height: 32px; - position: fixed; -} - -#logo_button { - padding: 5px; - font-size: 20px; - position: fixed; - background-color: var(--accent-color); - width: 25px; - border-radius: 5px; - transition: all ease-in-out 0.25s; -} - -#logo_button:hover { - filter: brightness(1.1); -} - -nav { - padding: 11px; - font-size: 16px; - padding-left: 20px; -} - -nav button { - background-color: transparent; - color: var(--foreground-color); - padding: 0px; - text-align: left; - transition: none; - box-shadow: none; -} - -div#info { - padding: 10px; - background-color: var(--background-color-2); - color: var(--foreground-color); - position: absolute; - left: calc(50vw - 30vw); - top: calc(50vh - 40vh + 40px); - width: 60vw; - height: 60vh; - border-radius: 10px; - padding: 20px; -} - -div#info h1 { - font-size: xx-large; -} - -div#info h2 { - font-size: x-large; -} - -div#info h3 { - font-size: large; -} - -div#info #body { - height: 50vh; - overflow-x: scroll; -} - -div#info #nav { - height: 10vh; -} - -div#info #nav * { - margin-top: 5vh; -} - -div#info #nav button#bf { - margin-left: 10px; - width: 50px; -} - -div#main_box table { - width: 100%; - height: calc(100vh - 50px); -} - -div#main_box { - width: 100%; - vertical-align: top; -} - -div#main_box #file_box { - padding-left: 10px; - background-color: var(--transparent-low); - overflow-y: scroll; - height: 100%; - padding-top: 50px; -} - -div#main_box #file_box a { - color: var(--foreground-color); - text-decoration: none; -} - -div.file_button { - padding: 15px; - width: calc(100% - 40px); - margin-top: 10px; - border-bottom: var(--grey-1) 1px solid; - border-radius: 5px; - transition: ease-in-out 100ms; - border-bottom-left-radius: 0px; - border-bottom-right-radius: 0px; -} - -div.file_button:hover { - border-bottom: transparent 1px solid; - border-bottom-left-radius: 5px; - border-bottom-right-radius: 5px; -} - -div.file_button img { - margin-bottom: -5px; - margin-right: 10px; -} - -div#file_menu { - background-color: var(--grey-3); - border-radius: 5px; - position: absolute; - width: 200px; - overflow-x: hidden; - z-index: 100; - padding-top: 10px; - padding-bottom: 10px; -} - -div#file_menu button { - width: 100%; - background-color: var(--grey-3) !important; - height: auto; - font-size: 12pt; - border-radius: 0px; - margin-bottom: 0px; - margin-top: 0px; - padding: 10px; - text-align: left; - transition: ease-in-out 100ms; -} - -div#file_menu button:hover { - filter: brightness(150%); -} - -div#file_menu #file_menu_title { - color: var(--foreground-color); - font-weight: 100; - font-size: small; - margin-bottom: 10px; -} - -button.dangerous { - background-color: var(--accent-color-red) !important; -} - -textarea { - background-color: var(--grey-1); - border-width: 0px; - width: calc(100% - 60px); - height: calc(100% - 120px); - color: var(--foreground-color); - padding: 10px; - margin: 20px; - border-radius: 5px; - margin-top: 0px; - resize: none; -} - -textarea::selection { - background-color: var(--foreground-color); - color: var(--background-color); +::placeholder { + color: var(--foreground-color); +} + +::-webkit-scrollbar { + display: none; +} + +@font-face { + font-family: "Instrument Sans"; + src: url("InstrumentSans-Regular.ttf"); +} + +@font-face { + font-family: "Instrument Sans Bold"; + src: url("InstrumentSans-Bold.ttf"); +} + +@font-face { + font-family: "Instrument Sans Italic"; + src: url("InstrumentSans-Italic.ttf"); +} + +@keyframes fall-down { + 0% { + opacity: 0%; + height: 0px; + } +} + +::selection { + background-color: transparent; +} + +*:focus { + outline: none; +} + +* { + cursor: default; +} + +/* +-- Login Box -- +Width: 33vw +Padding: 40px; +Height: 100vh - 80 +Margin-Top: 40px; +*/ + +body, html { + height: 100%; + max-height: 100vh; + overflow: hidden; +} + +div#login_box { + width: 33vw; + min-width: 450px; + padding: 40px; + height: calc(100vh - 160px); + margin-top: 40px; + background-color: var(--transparent-low); + border-radius: 25px; + box-shadow: var(--box-shadow-ten-ten); +} + +nav#menu_bar { + padding: 10px; + width: calc(100% - 20px); + height: 32px; + position: fixed; +} + +#logo_button { + padding: 5px; + font-size: 20px; + position: fixed; + background-color: var(--accent-color); + width: 25px; + border-radius: 5px; + transition: all ease-in-out 0.25s; +} + +#logo_button:hover { + filter: brightness(1.1); +} + +nav { + padding: 11px; + font-size: 16px; + padding-left: 20px; +} + +nav button { + background-color: transparent; + color: var(--foreground-color); + padding: 0px; + text-align: left; + transition: none; + box-shadow: none; +} + +div#info { + padding: 10px; + background-color: var(--background-color-2); + color: var(--foreground-color); + position: absolute; + left: calc(50vw - 30vw); + top: calc(50vh - 40vh + 40px); + width: 60vw; + height: 60vh; + border-radius: 10px; + padding: 20px; +} + +div#info h1 { + font-size: xx-large; +} + +div#info h2 { + font-size: x-large; +} + +div#info h3 { + font-size: large; +} + +div#info #body { + height: 50vh; + overflow-x: scroll; +} + +div#info #nav { + height: 10vh; +} + +div#info #nav * { + margin-top: 5vh; +} + +div#info #nav button#bf { + margin-left: 10px; + width: 50px; +} + +div#main_box table { + width: 100%; + height: calc(100vh - 50px); +} + +div#main_box { + width: 100%; + vertical-align: top; +} + +div#main_box #file_box { + padding-left: 10px; + background-color: var(--transparent-low); + overflow-y: scroll; + height: 100%; + padding-top: 50px; +} + +div#main_box #file_box a { + color: var(--foreground-color); + text-decoration: none; +} + +div.file_button { + padding: 15px; + width: calc(100% - 40px); + margin-top: 10px; + border-bottom: var(--grey-1) 1px solid; + border-radius: 5px; + transition: ease-in-out 100ms; + border-bottom-left-radius: 0px; + border-bottom-right-radius: 0px; +} + +div.file_button:hover { + border-bottom: transparent 1px solid; + border-bottom-left-radius: 5px; + border-bottom-right-radius: 5px; +} + +div.file_button img { + margin-bottom: -5px; + margin-right: 10px; +} + +div#file_menu { + background-color: var(--grey-3); + border-radius: 5px; + position: absolute; + width: 200px; + overflow-x: hidden; + z-index: 100; + padding-top: 10px; + padding-bottom: 10px; +} + +div#file_menu button { + width: 100%; + background-color: var(--grey-3) !important; + height: auto; + font-size: 12pt; + border-radius: 0px; + margin-bottom: 0px; + margin-top: 0px; + padding: 10px; + text-align: left; + transition: ease-in-out 100ms; +} + +div#file_menu button:hover { + filter: brightness(150%); +} + +div#file_menu #file_menu_title { + color: var(--foreground-color); + font-weight: 100; + font-size: small; + margin-bottom: 10px; +} + +button.dangerous { + background-color: var(--accent-color-red) !important; +} + +textarea { + background-color: var(--grey-1); + border-width: 0px; + width: calc(100% - 60px); + height: calc(100% - 120px); + color: var(--foreground-color); + padding: 10px; + margin: 20px; + border-radius: 5px; + margin-top: 0px; + resize: none; +} + +textarea::selection { + background-color: var(--foreground-color); + color: var(--background-color); } \ No newline at end of file diff --git a/asset/securityadvisor.css b/asset/securityadvisor.css index 853d230..e41ac3e 100644 --- a/asset/securityadvisor.css +++ b/asset/securityadvisor.css @@ -1,161 +1,161 @@ -::placeholder { - color: var(--foreground-color); -} - -::-webkit-scrollbar { - display: none; -} - -@font-face { - font-family: "Instrument Sans"; - src: url("InstrumentSans-Regular.ttf"); -} - -@font-face { - font-family: "Instrument Sans Bold"; - src: url("InstrumentSans-Bold.ttf"); -} - -@font-face { - font-family: "Instrument Sans Italic"; - src: url("InstrumentSans-Italic.ttf"); -} - -@keyframes fall-down { - 0% { - opacity: 0%; - height: 0px; - } -} - -::selection { - background-color: transparent; -} - -*:focus { - outline: none; -} - -* { - cursor: default; -} - -h1 { - font-size: xx-large; - font-family: "Instrument Sans Bold", sans-serif; - margin-bottom: 10px; -} - -h2 { - font-size: large; - margin-bottom: 10px; -} - -/* --- Login Box -- -Width: 33vw -Padding: 40px; -Height: 100vh - 80 -Margin-Top: 40px; -*/ - -html { - height: 100%; -} - -body { - background-color: var(--background-color); - color: var(--foreground-color); - font-family: "Instrument Sans", sans-serif; - margin: 20px; - height: 100%; - overflow: hidden; -} - - -@keyframes flow_down_b { - 0% { - top: 0px; - } -} - -div#confirm_popup { - color: white; - position: absolute; - top: 60px; - left: calc(50vw - 160px); - width: 300px; - padding: 10px; - padding-bottom: 5px; - background-color: #282828; - border-radius: 5px; - animation-name: flow_down_b; - animation-duration: 0.25s; - border-style: solid; - border-width: 0px; - box-shadow: 0px 1px 0px 0px #717171 inset, 0px 5px 15px 0px rgba(0, 0, 0, 0.50); - z-index: 1000; -} - -div#confirm_popup button { - margin-top: 15px; - border-width: 0px !important; - padding: 10px; - font-size: 15px; - color: white !important; - margin-bottom: 7.5px; - box-shadow: none; -} - -div#confirm_popup b { - letter-spacing: 0.75px; -} - -#info_msg { - position: absolute; - top: 50px; - left: calc(50vw - (300px + 20px)); - width: 300px; - padding: 20px; - border-radius: 10px; - background-color: #565656; - color: white; - animation: flow_down 0.25s; - z-index: 100; - box-shadow: 0px 1px 0px 0px #A0A0A0 inset, 0px 5px 15px 0px rgba(0, 0, 0, 0.50); -} - -@keyframes fill-up { - 0% {width: 0px;} -} - -#bar_cropper { - border-radius: 5px; - overflow: hidden; - height: 14px; - width: 300px; - animation-name: fill-up; - animation-duration: 1s; - animation-fill-mode: forwards; -} - -#level_bar { - background-image: linear-gradient(270deg, #ADFF00 0%, #FF000F 100%); - box-shadow: 0px 5px 15px 0px rgba(0, 0, 0, 0.50), 0px 2px 0px 0px rgba(255, 255, 255, 0.53) inset; - height: 14px; - width: 300px; - border-radius: 5px; -} - -.missing_file { - padding: 10px; - margin-top: 10px; - border-radius: 5px; - background-color: var(--grey-3); - box-shadow: 0px 5px 15px 0px rgba(0, 0, 0, 0.50), 0px 1px 0px 0px rgba(255, 255, 255, 0.53) inset; -} - -#mflistscroll { - height: 140px; - overflow: scroll; +::placeholder { + color: var(--foreground-color); +} + +::-webkit-scrollbar { + display: none; +} + +@font-face { + font-family: "Instrument Sans"; + src: url("InstrumentSans-Regular.ttf"); +} + +@font-face { + font-family: "Instrument Sans Bold"; + src: url("InstrumentSans-Bold.ttf"); +} + +@font-face { + font-family: "Instrument Sans Italic"; + src: url("InstrumentSans-Italic.ttf"); +} + +@keyframes fall-down { + 0% { + opacity: 0%; + height: 0px; + } +} + +::selection { + background-color: transparent; +} + +*:focus { + outline: none; +} + +* { + cursor: default; +} + +h1 { + font-size: xx-large; + font-family: "Instrument Sans Bold", sans-serif; + margin-bottom: 10px; +} + +h2 { + font-size: large; + margin-bottom: 10px; +} + +/* +-- Login Box -- +Width: 33vw +Padding: 40px; +Height: 100vh - 80 +Margin-Top: 40px; +*/ + +html { + height: 100%; +} + +body { + background-color: var(--background-color); + color: var(--foreground-color); + font-family: "Instrument Sans", sans-serif; + margin: 20px; + height: 100%; + overflow: hidden; +} + + +@keyframes flow_down_b { + 0% { + top: 0px; + } +} + +div#confirm_popup { + color: white; + position: absolute; + top: 60px; + left: calc(50vw - 160px); + width: 300px; + padding: 10px; + padding-bottom: 5px; + background-color: #282828; + border-radius: 5px; + animation-name: flow_down_b; + animation-duration: 0.25s; + border-style: solid; + border-width: 0px; + box-shadow: 0px 1px 0px 0px #717171 inset, 0px 5px 15px 0px rgba(0, 0, 0, 0.50); + z-index: 1000; +} + +div#confirm_popup button { + margin-top: 15px; + border-width: 0px !important; + padding: 10px; + font-size: 15px; + color: white !important; + margin-bottom: 7.5px; + box-shadow: none; +} + +div#confirm_popup b { + letter-spacing: 0.75px; +} + +#info_msg { + position: absolute; + top: 50px; + left: calc(50vw - (300px + 20px)); + width: 300px; + padding: 20px; + border-radius: 10px; + background-color: #565656; + color: white; + animation: flow_down 0.25s; + z-index: 100; + box-shadow: 0px 1px 0px 0px #A0A0A0 inset, 0px 5px 15px 0px rgba(0, 0, 0, 0.50); +} + +@keyframes fill-up { + 0% {width: 0px;} +} + +#bar_cropper { + border-radius: 5px; + overflow: hidden; + height: 14px; + width: 300px; + animation-name: fill-up; + animation-duration: 1s; + animation-fill-mode: forwards; +} + +#level_bar { + background-image: linear-gradient(270deg, #ADFF00 0%, #FF000F 100%); + box-shadow: 0px 5px 15px 0px rgba(0, 0, 0, 0.50), 0px 2px 0px 0px rgba(255, 255, 255, 0.53) inset; + height: 14px; + width: 300px; + border-radius: 5px; +} + +.missing_file { + padding: 10px; + margin-top: 10px; + border-radius: 5px; + background-color: var(--grey-3); + box-shadow: 0px 5px 15px 0px rgba(0, 0, 0, 0.50), 0px 1px 0px 0px rgba(255, 255, 255, 0.53) inset; +} + +#mflistscroll { + height: 140px; + overflow: scroll; } \ No newline at end of file diff --git a/asset/securityadvisor.js b/asset/securityadvisor.js index 2bab28a..87bb6ec 100644 --- a/asset/securityadvisor.js +++ b/asset/securityadvisor.js @@ -1,6 +1,6 @@ -window.onload = function () { - if (localStorage.getItem("intro_security_advisor") != "true") { - document.getElementById("intro").hidden = false; - } - localStorage.setItem("intro_security_advisor", "true") +window.onload = function () { + if (localStorage.getItem("intro_security_advisor") != "true") { + document.getElementById("intro").hidden = false; + } + localStorage.setItem("intro_security_advisor", "true") } \ No newline at end of file diff --git a/asset/themeoverride.css b/asset/themeoverride.css index b32844b..60478fe 100644 --- a/asset/themeoverride.css +++ b/asset/themeoverride.css @@ -1,32 +1,32 @@ -:root { - --background-color: #161616; - --foreground-color: #ffffff; - --accent-color: #1F75FE; - --accent-color-red: #FF0800; - --transparent-heavy: rgba(255, 255, 255, 0.15); - --transparent-low: transparent; - --link-color: #599CE9; - --box-shadow-ten-ten: 0px 10px 10px black; - --background-color-2: #171b29; - --box-shadow-color: black; - --filter-gradient: #1d202999; - --box-shadow-color-light: #00000042; - --grey-1: #313131; - --grey-2: #0e0e0e; - --grey-3: #363636; - --grey-4: #474747; - --input-background: #ffffff20; - --light-grey-1: #ffffffd1; - --light-grey-2: #ffffff13; - --msg-1: dodgerblue; - --msg-2: forestgreen; - --nav-exit: #ffffffbe; -} - -div#file_menu button { - color: white !important; -} - -div.file_button:hover { - background-color: #2e2e2e; +:root { + --background-color: #161616; + --foreground-color: #ffffff; + --accent-color: #1F75FE; + --accent-color-red: #FF0800; + --transparent-heavy: rgba(255, 255, 255, 0.15); + --transparent-low: transparent; + --link-color: #599CE9; + --box-shadow-ten-ten: 0px 10px 10px black; + --background-color-2: #171b29; + --box-shadow-color: black; + --filter-gradient: #1d202999; + --box-shadow-color-light: #00000042; + --grey-1: #313131; + --grey-2: #0e0e0e; + --grey-3: #363636; + --grey-4: #474747; + --input-background: #ffffff20; + --light-grey-1: #ffffffd1; + --light-grey-2: #ffffff13; + --msg-1: dodgerblue; + --msg-2: forestgreen; + --nav-exit: #ffffffbe; +} + +div#file_menu button { + color: white !important; +} + +div.file_button:hover { + background-color: #2e2e2e; } \ No newline at end of file diff --git a/asset/themes/default.css b/asset/themes/default.css index b32844b..60478fe 100644 --- a/asset/themes/default.css +++ b/asset/themes/default.css @@ -1,32 +1,32 @@ -:root { - --background-color: #161616; - --foreground-color: #ffffff; - --accent-color: #1F75FE; - --accent-color-red: #FF0800; - --transparent-heavy: rgba(255, 255, 255, 0.15); - --transparent-low: transparent; - --link-color: #599CE9; - --box-shadow-ten-ten: 0px 10px 10px black; - --background-color-2: #171b29; - --box-shadow-color: black; - --filter-gradient: #1d202999; - --box-shadow-color-light: #00000042; - --grey-1: #313131; - --grey-2: #0e0e0e; - --grey-3: #363636; - --grey-4: #474747; - --input-background: #ffffff20; - --light-grey-1: #ffffffd1; - --light-grey-2: #ffffff13; - --msg-1: dodgerblue; - --msg-2: forestgreen; - --nav-exit: #ffffffbe; -} - -div#file_menu button { - color: white !important; -} - -div.file_button:hover { - background-color: #2e2e2e; +:root { + --background-color: #161616; + --foreground-color: #ffffff; + --accent-color: #1F75FE; + --accent-color-red: #FF0800; + --transparent-heavy: rgba(255, 255, 255, 0.15); + --transparent-low: transparent; + --link-color: #599CE9; + --box-shadow-ten-ten: 0px 10px 10px black; + --background-color-2: #171b29; + --box-shadow-color: black; + --filter-gradient: #1d202999; + --box-shadow-color-light: #00000042; + --grey-1: #313131; + --grey-2: #0e0e0e; + --grey-3: #363636; + --grey-4: #474747; + --input-background: #ffffff20; + --light-grey-1: #ffffffd1; + --light-grey-2: #ffffff13; + --msg-1: dodgerblue; + --msg-2: forestgreen; + --nav-exit: #ffffffbe; +} + +div#file_menu button { + color: white !important; +} + +div.file_button:hover { + background-color: #2e2e2e; } \ No newline at end of file diff --git a/asset/themes/green_dark.css b/asset/themes/green_dark.css index 6298598..e96ac35 100644 --- a/asset/themes/green_dark.css +++ b/asset/themes/green_dark.css @@ -1,32 +1,32 @@ -:root { - --background-color: #161616; - --foreground-color: #ffffff; - --accent-color: #0BDA51; - --accent-color-red: #FF0800; - --transparent-heavy: rgba(255, 255, 255, 0.15); - --transparent-low: transparent; - --link-color: #599CE9; - --box-shadow-ten-ten: 0px 10px 10px black; - --background-color-2: #171b29; - --box-shadow-color: black; - --filter-gradient: #1d202999; - --box-shadow-color-light: #00000042; - --grey-1: #313131; - --grey-2: #0e0e0e; - --grey-3: #252525; - --grey-4: #474747; - --input-background: #ffffff20; - --light-grey-1: #ffffffd1; - --light-grey-2: #ffffff13; - --msg-1: dodgerblue; - --msg-2: forestgreen; - --nav-exit: #ffffffbe; -} - -div#file_menu button { - color: white !important; -} - -div.file_button:hover { - background-color: #2e2e2e; +:root { + --background-color: #161616; + --foreground-color: #ffffff; + --accent-color: #0BDA51; + --accent-color-red: #FF0800; + --transparent-heavy: rgba(255, 255, 255, 0.15); + --transparent-low: transparent; + --link-color: #599CE9; + --box-shadow-ten-ten: 0px 10px 10px black; + --background-color-2: #171b29; + --box-shadow-color: black; + --filter-gradient: #1d202999; + --box-shadow-color-light: #00000042; + --grey-1: #313131; + --grey-2: #0e0e0e; + --grey-3: #252525; + --grey-4: #474747; + --input-background: #ffffff20; + --light-grey-1: #ffffffd1; + --light-grey-2: #ffffff13; + --msg-1: dodgerblue; + --msg-2: forestgreen; + --nav-exit: #ffffffbe; +} + +div#file_menu button { + color: white !important; +} + +div.file_button:hover { + background-color: #2e2e2e; } \ No newline at end of file diff --git a/asset/themes/green_dark_lines.css b/asset/themes/green_dark_lines.css index b3f9757..b3211ea 100644 --- a/asset/themes/green_dark_lines.css +++ b/asset/themes/green_dark_lines.css @@ -1,46 +1,46 @@ -:root { - --background-color: #161616; - --foreground-color: #ffffff; - --accent-color: #0BDA51; - --accent-color-red: #FF0800; - --transparent-heavy: rgba(255, 255, 255, 0.15); - --transparent-low: transparent; - --link-color: #599CE9; - --box-shadow-ten-ten: 0px 10px 10px black; - --background-color-2: #171b29; - --box-shadow-color: black; - --filter-gradient: #1d202999; - --box-shadow-color-light: #00000042; - --grey-1: #313131; - --grey-2: #2e2e2e; - --grey-3: #252525; - --grey-4: #474747; - --input-background: #ffffff20; - --light-grey-1: #ffffffd1; - --light-grey-2: #ffffff13; - --msg-1: dodgerblue; - --msg-2: forestgreen; - --nav-exit: #ffffffbe; -} - -div#file_menu button { - color: white !important; -} - -div.file_button:hover { - background-color: #01270e; -} - -nav { - background-color: #011b0a !important; - border-bottom-style: solid; - border-bottom-width: 1px; - border-bottom-color: #043e18; -} - -div#file_info_menu { - background-color: #000e05; - border-left-width: 1px; - border-left-style: solid; - border-left-color: #022a10; +:root { + --background-color: #161616; + --foreground-color: #ffffff; + --accent-color: #0BDA51; + --accent-color-red: #FF0800; + --transparent-heavy: rgba(255, 255, 255, 0.15); + --transparent-low: transparent; + --link-color: #599CE9; + --box-shadow-ten-ten: 0px 10px 10px black; + --background-color-2: #171b29; + --box-shadow-color: black; + --filter-gradient: #1d202999; + --box-shadow-color-light: #00000042; + --grey-1: #313131; + --grey-2: #2e2e2e; + --grey-3: #252525; + --grey-4: #474747; + --input-background: #ffffff20; + --light-grey-1: #ffffffd1; + --light-grey-2: #ffffff13; + --msg-1: dodgerblue; + --msg-2: forestgreen; + --nav-exit: #ffffffbe; +} + +div#file_menu button { + color: white !important; +} + +div.file_button:hover { + background-color: #01270e; +} + +nav { + background-color: #011b0a !important; + border-bottom-style: solid; + border-bottom-width: 1px; + border-bottom-color: #043e18; +} + +div#file_info_menu { + background-color: #000e05; + border-left-width: 1px; + border-left-style: solid; + border-left-color: #022a10; } \ No newline at end of file diff --git a/asset/themes/green_light.css b/asset/themes/green_light.css index cd40b4f..059f213 100644 --- a/asset/themes/green_light.css +++ b/asset/themes/green_light.css @@ -1,74 +1,74 @@ -:root { - --background-color: #ffffff; - --foreground-color: #000000; - --accent-color: #0BDA51; - --accent-color-red: #FF0800; - --transparent-heavy: #00000026; - --transparent-low: transparent; - --link-color: #001c3c; - --box-shadow-ten-ten: 0px 10px 10px #b3b3b3; - --background-color-2: #ececec; - --box-shadow-color: #9e9e9e; - --filter-gradient: #e9e9e999; - --box-shadow-color-light: #b4b4b442; - --grey-1: #b3b3b3; - --grey-2: #bbbbbb; - --grey-3: #252525; - --grey-4: #474747; - --input-background: #aeaeae36; - --light-grey-1: #ffffffd1; - --light-grey-2: #abababcf; - --msg-1: dodgerblue; - --msg-2: forestgreen; - --nav-exit: #ffffffbe; -} - -button { - color: white; -} - -div#file_menu { - background-color: #d6d6d6; -} - -div#file_menu button { - background-color: #d6d6d6 !important; - color: #000000; -} - -div#file_menu button:hover { - background-color: #474747 !important; - color: white !important; -} - -div.file_button { - border-bottom-color: #999999; -} - -table tr #userlist { - background-color: transparent; - border-right-color: var(--accent-color); - border-right-style: solid; - border-right-width: 1px; -} - -nav#menu_bar input[type="text"] { - background-color: #ffffff; -} - -nav#menu_bar { - background-color: black; -} - -#file_info_menu { - backdrop-filter: none; - background-color: white !important; - border-left-color: #000000 !important; - border-left-style: solid; - border-left-width: 1px; - z-index: 100; -} - -div.file_button:hover { - backdrop-filter: brightness(0.9); +:root { + --background-color: #ffffff; + --foreground-color: #000000; + --accent-color: #0BDA51; + --accent-color-red: #FF0800; + --transparent-heavy: #00000026; + --transparent-low: transparent; + --link-color: #001c3c; + --box-shadow-ten-ten: 0px 10px 10px #b3b3b3; + --background-color-2: #ececec; + --box-shadow-color: #9e9e9e; + --filter-gradient: #e9e9e999; + --box-shadow-color-light: #b4b4b442; + --grey-1: #b3b3b3; + --grey-2: #bbbbbb; + --grey-3: #252525; + --grey-4: #474747; + --input-background: #aeaeae36; + --light-grey-1: #ffffffd1; + --light-grey-2: #abababcf; + --msg-1: dodgerblue; + --msg-2: forestgreen; + --nav-exit: #ffffffbe; +} + +button { + color: white; +} + +div#file_menu { + background-color: #d6d6d6; +} + +div#file_menu button { + background-color: #d6d6d6 !important; + color: #000000; +} + +div#file_menu button:hover { + background-color: #474747 !important; + color: white !important; +} + +div.file_button { + border-bottom-color: #999999; +} + +table tr #userlist { + background-color: transparent; + border-right-color: var(--accent-color); + border-right-style: solid; + border-right-width: 1px; +} + +nav#menu_bar input[type="text"] { + background-color: #ffffff; +} + +nav#menu_bar { + background-color: black; +} + +#file_info_menu { + backdrop-filter: none; + background-color: white !important; + border-left-color: #000000 !important; + border-left-style: solid; + border-left-width: 1px; + z-index: 100; +} + +div.file_button:hover { + backdrop-filter: brightness(0.9); } \ No newline at end of file diff --git a/asset/themes/light.css b/asset/themes/light.css index 33279de..3724c54 100644 --- a/asset/themes/light.css +++ b/asset/themes/light.css @@ -1,74 +1,74 @@ -:root { - --background-color: #ffffff; - --foreground-color: #000000; - --accent-color: #3074e1; - --accent-color-red: #FF0800; - --transparent-heavy: #00000026; - --transparent-low: transparent; - --link-color: #001c3c; - --box-shadow-ten-ten: 0px 10px 10px #b3b3b3; - --background-color-2: #ececec; - --box-shadow-color: #9e9e9e; - --filter-gradient: #e9e9e999; - --box-shadow-color-light: #b4b4b442; - --grey-1: #b3b3b3; - --grey-2: #bbbbbb; - --grey-3: #252525; - --grey-4: #474747; - --input-background: #aeaeae36; - --light-grey-1: #ffffffd1; - --light-grey-2: #abababcf; - --msg-1: dodgerblue; - --msg-2: forestgreen; - --nav-exit: #ffffffbe; -} - -button { - color: white; -} - -div#file_menu { - background-color: #d6d6d6; -} - -div#file_menu button { - background-color: #d6d6d6 !important; - color: #000000; -} - -div#file_menu button:hover { - background-color: #474747 !important; - color: white !important; -} - -div.file_button { - border-bottom-color: #999999; -} - -table tr #userlist { - background-color: transparent; - border-right-color: var(--accent-color); - border-right-style: solid; - border-right-width: 1px; -} - -nav#menu_bar input[type="text"] { - background-color: #ffffff; -} - -nav#menu_bar { - background-color: black; -} - -#file_info_menu { - backdrop-filter: none; - background-color: white !important; - border-left-color: #000000 !important; - border-left-style: solid; - border-left-width: 1px; - z-index: 100; -} - -div.file_button:hover { - backdrop-filter: brightness(0.9); +:root { + --background-color: #ffffff; + --foreground-color: #000000; + --accent-color: #3074e1; + --accent-color-red: #FF0800; + --transparent-heavy: #00000026; + --transparent-low: transparent; + --link-color: #001c3c; + --box-shadow-ten-ten: 0px 10px 10px #b3b3b3; + --background-color-2: #ececec; + --box-shadow-color: #9e9e9e; + --filter-gradient: #e9e9e999; + --box-shadow-color-light: #b4b4b442; + --grey-1: #b3b3b3; + --grey-2: #bbbbbb; + --grey-3: #252525; + --grey-4: #474747; + --input-background: #aeaeae36; + --light-grey-1: #ffffffd1; + --light-grey-2: #abababcf; + --msg-1: dodgerblue; + --msg-2: forestgreen; + --nav-exit: #ffffffbe; +} + +button { + color: white; +} + +div#file_menu { + background-color: #d6d6d6; +} + +div#file_menu button { + background-color: #d6d6d6 !important; + color: #000000; +} + +div#file_menu button:hover { + background-color: #474747 !important; + color: white !important; +} + +div.file_button { + border-bottom-color: #999999; +} + +table tr #userlist { + background-color: transparent; + border-right-color: var(--accent-color); + border-right-style: solid; + border-right-width: 1px; +} + +nav#menu_bar input[type="text"] { + background-color: #ffffff; +} + +nav#menu_bar { + background-color: black; +} + +#file_info_menu { + backdrop-filter: none; + background-color: white !important; + border-left-color: #000000 !important; + border-left-style: solid; + border-left-width: 1px; + z-index: 100; +} + +div.file_button:hover { + backdrop-filter: brightness(0.9); } \ No newline at end of file diff --git a/asset/welcome.css b/asset/welcome.css index 3298809..cb4169a 100644 --- a/asset/welcome.css +++ b/asset/welcome.css @@ -1,134 +1,134 @@ -@keyframes turn { - 50% { - transform: rotate(1turn); - } - 100% { - transform: rotate(2turn); - } -} - -@keyframes screen-transition { - 0% { - opacity: 0; - } - 100% { - opacity: 1; - } -} - -::selection { - background-color: transparent; -} - -* { - cursor: default; -} - -@font-face { - font-family: "Instrument Sans"; - src: url("InstrumentSans-Regular.ttf"); -} - -@font-face { - font-family: "Instrument Sans Bold"; - src: url("InstrumentSans-Bold.ttf"); -} - -@font-face { - font-family: "Instrument Sans Italic"; - src: url("InstrumentSans-Italic.ttf"); -} - -*:focus { - outline: none; -} - -button:hover { - filter: brightness(120%); -} - -button:hover:disabled { - filter: brightness(120%) grayscale() brightness(1.3); -} - -button:focus { - filter: brightness(130%); -} - -button:active { - filter: brightness(140%); -} - -button:disabled { - filter: grayscale() brightness(1.3); -} - -button img { - height: 15px; - margin-left: 20px; - animation-name: turn; - animation-duration: 2s; - animation-iteration-count: infinite; -} - -#register_link { - padding-left: 20px; - font-size: 20px; -} - -b { - font-family: "Instrument Sans Bold"; -} - -i { - font-family: "Instrument Sans Italic"; -} - -a, a::after, a:hover, a:active { - color: var(--link-color); -} - -div#login_box { - width: min-content; - height: 400px; - margin-top: calc(75vh - 400px); -} - -div#login_box h1 { - font-size: 3vw; - font-family: "Instrument Sans Bold"; - margin: 0px; - padding-bottom: 15px; - width: max-content; -} -div#login_box h2 { - font-size: 12pt; - font-family: "Instrument Sans"; - margin: 0px; - padding-bottom: 15px; -} - -@keyframes flow_down { - 0% {top: 0px;} - 100% { - top: 20px; - } -} - -#info { - position: absolute; - left: calc(50vw - 100px); - top: 40px; - width: 200px; - padding: 10px; - border-radius: 10px; - background-color: #565656; - animation: flow_down 0.25s; - z-index: 100; - color: white; - box-shadow: 0px 1px 0px 0px #A0A0A0 inset, 0px 5px 15px 0px rgba(0, 0, 0, 0.50); -} - -*.margin-left-small { - margin-left: 10px; +@keyframes turn { + 50% { + transform: rotate(1turn); + } + 100% { + transform: rotate(2turn); + } +} + +@keyframes screen-transition { + 0% { + opacity: 0; + } + 100% { + opacity: 1; + } +} + +::selection { + background-color: transparent; +} + +* { + cursor: default; +} + +@font-face { + font-family: "Instrument Sans"; + src: url("InstrumentSans-Regular.ttf"); +} + +@font-face { + font-family: "Instrument Sans Bold"; + src: url("InstrumentSans-Bold.ttf"); +} + +@font-face { + font-family: "Instrument Sans Italic"; + src: url("InstrumentSans-Italic.ttf"); +} + +*:focus { + outline: none; +} + +button:hover { + filter: brightness(120%); +} + +button:hover:disabled { + filter: brightness(120%) grayscale() brightness(1.3); +} + +button:focus { + filter: brightness(130%); +} + +button:active { + filter: brightness(140%); +} + +button:disabled { + filter: grayscale() brightness(1.3); +} + +button img { + height: 15px; + margin-left: 20px; + animation-name: turn; + animation-duration: 2s; + animation-iteration-count: infinite; +} + +#register_link { + padding-left: 20px; + font-size: 20px; +} + +b { + font-family: "Instrument Sans Bold"; +} + +i { + font-family: "Instrument Sans Italic"; +} + +a, a::after, a:hover, a:active { + color: var(--link-color); +} + +div#login_box { + width: min-content; + height: 400px; + margin-top: calc(75vh - 400px); +} + +div#login_box h1 { + font-size: 3vw; + font-family: "Instrument Sans Bold"; + margin: 0px; + padding-bottom: 15px; + width: max-content; +} +div#login_box h2 { + font-size: 12pt; + font-family: "Instrument Sans"; + margin: 0px; + padding-bottom: 15px; +} + +@keyframes flow_down { + 0% {top: 0px;} + 100% { + top: 20px; + } +} + +#info { + position: absolute; + left: calc(50vw - 100px); + top: 40px; + width: 200px; + padding: 10px; + border-radius: 10px; + background-color: #565656; + animation: flow_down 0.25s; + z-index: 100; + color: white; + box-shadow: 0px 1px 0px 0px #A0A0A0 inset, 0px 5px 15px 0px rgba(0, 0, 0, 0.50); +} + +*.margin-left-small { + margin-left: 10px; } \ No newline at end of file diff --git a/libs/__main__.py b/libs/__main__.py new file mode 100644 index 0000000..f78c5a1 --- /dev/null +++ b/libs/__main__.py @@ -0,0 +1,1205 @@ +""" +Lumos Server Main File +** +by Constantin Volke (wervice@proton.me) +Please notice, that I'm using third party libraries. +Legal notes under https://www.github.com/Wervice/Lumos/legal.md +** +The files accid.cfg, admin_set.cfg, login_subtitle.cfg, no_binary.cfg, virus_scanner.cfg should be set to 0 at first launch. +""" + +import platform +try: + import libs.gethashes +except: + import gethashes +import time +import io +from PIL import Image +from flask import Flask, request, render_template, send_file +import base64 +from werkzeug.utils import secure_filename +import hashlib +import os +import json +from mimetypes import MimeTypes +import pyAesCrypt +import threading +import re +import psutil +import math +import datetime as dt +import random +mime = MimeTypes() + +open("asset/themeoverride.css", "w").write(open("asset/themes/"+open("theme.cfg", "r").read()+".css").read()) + +if not os.path.exists("users"): + os.mkdir("users/") + +def encode_as_base64(str): + if str != "": + message_bytes = str.encode('utf-8') + base64_bytes = base64.b64encode(message_bytes) + base64_message = base64_bytes.decode('utf-8') + return base64_message + else: + return "" + + +def decode_from_base64(str): + if str != "": + message_bytes = str.encode('utf-8') + base64_bytes = base64.b64decode(message_bytes) + base64_message = base64_bytes.decode('utf-8') + return base64_message + else: + return "" + + +if (open("admin_set.cfg").read() == "0"): + print("Welcome to Lumos") + print("----------------\n") + aduse = input("Admin username: ") + adpas = input("Admin password: ") + uservrs = input("Use virus scanner? [y/N]: ") == "y" + blockexe = input("Block executable files? [y/N]: ") == "y" + accid = input("AccID: ") + servername = input("Login Subtitle: ") + open("admin_set.cfg", "w").write("1") + os.mkdir("users/"+encode_as_base64(aduse)) + open("users/"+encode_as_base64(aduse)+"/userpassword.cfg", "w").write(hashlib.sha256(adpas.encode("utf-8")).hexdigest()) + open("users/"+encode_as_base64(aduse)+"/is_admin", "w").write("1yisadmin$") + open("users/"+encode_as_base64(aduse)+"/enoed_files", "w").write("\{\}") + open("virus_scanner.cfg", "w").write(str(int(uservrs))) + open("no_binary.cfg", "w").write(str(int(blockexe))) + open("login_subtitle.cfg", "w").write(servername) + open("accid.cfg", "w").write(accid) + os.mkdir("users/"+encode_as_base64(aduse)+"/chat_inbox") + print("Done. Please restart the application now.") + exit() +else: + pass + +def compress_image(image_bytes, username, filename): + try: + mime_type = mime.guess_type( + "users/"+username+"/"+secure_filename(filename)) + format = str(mime_type)[1].replace( + "image/", "").upper().replace("JPEG", "JPG") + with Image.open(io.BytesIO(image_bytes)) as img: + output_buffer = io.BytesIO() + img.thumbnail((300, 300)) + img.save(output_buffer, format="PNG", optimize=False, quality=10) + output_buffer.seek(0) + return output_buffer + except: + print("Image Compression Error: Maybe encrypted Image") + return None + +def file_html_gen(username): + login_user_input_file = open('loggedin_users') + json_array = json.load(login_user_input_file) + try: + if os.path.exists("users/"+json_array[request.remote_addr]+"/decryption_tempfile.tmp"): + os.remove("users/"+json_array[request.remote_addr]+"/decryption_tempfile.tmp") + except: + pass + files = os.listdir("users/"+username+"/") + html_code = "" + for file in files: + if file != "userpassword.cfg" and file != "enced_files" and file != "Thumbs.db" and file != "ckey.cfg" and not file.startswith("chat_log_file_") and file != "chat_inbox" and file != "shared_files": + # mime_image.svg + # mime_doc.svg + # mime_presentation.svg + # mime_spreadsheet.svg + # mime_pdf.svg + # mime_video.svg + mime_icon_dict = { + # Images + "png": "mime_image.svg", + "jpg": "mime_image.svg", + "heic": "mime_image.svg", + "gif": "mime_image.svg", + "heif": "mime_image.svg", + "bmp": "mime_image.svg", + "ico": "mime_image.svg", + # Text Document + "doc": "mime_doc.svg", + "docx": "mime_doc.svg", + "odt": "mime_doc.svg", + "md": "mime_doc.svg", + "txt": "mime_doc.svg", + # Presentation + "ppt": "mime_presentation.svg", + "pptx": "mime_presentation.svg", + "odp": "mime_presentation.svg", + "pptm": "mime_presentation.svg", + # Spreadsheet + "xls": "mime_spreadsheet.svg", + "xlsx": "mime_spreadsheet.svg", + "ods": "mime_spreadsheet.svg", + "csv": "mime_spreadsheet.svg", + # PDF + "pdf": "mime_pdf.svg", + # Videos + "mp4": "mime_video.svg", + "mov": "mime_video.svg", + "avi": "mime_video.svg", + "webm": "mime_video.svg", + # Archive + "zip": "mime_archive.svg", + "tar": "mime_archive.svg", + "xz": "mime_archive.svg", + "exe": "mime_archive.svg", + "iso": "mime_archive.svg", + } + try: + mimet = file.split(".")[1] + except IndexError: + mimet = "mime_none.svg" + print(mimet) + if mimet in mime_icon_dict: + mime_icon = mime_icon_dict[mimet] + else: + mime_icon = "mime_none.svg" + fileattrs = os.stat("users/"+username+"/"+file) + filesize = str(math.floor(fileattrs.st_size / 1024)) + filetypel = { + # Images + "png": "Image file", + "jpg": "Image file", + "heic": "Image file", + "gif": "Image file", + "heif": "Image file", + "bmp": "Image file", + "ico": "Icon file", + # Text Document + "doc": "Word Document", + "docx": "Word Document", + "odt": "LibreOffice Writer Document", + "md": "Markdown", + "txt": "Plain Text", + # Presentation + "ppt": "PowerPoint Presentation", + "pptx": "PowerPoint Presentation", + "odp": "LibreOffice Impress Document", + "pptm": "PowerPoint Macro File", + # Spreadsheet + "xls": "Excel Spreadsheet", + "xlsx": "Excel Spreadsheet", + "ods": "LibreOffice Spreadsheet", + "csv": "CSV Table Text Document", + # PDF + "pdf": "PDF Document", + # Videos + "mp4": "Video", + "mov": "Video", + "avi": "Video", + "webm": "Video", + # Archive + "zip": "Archive", + "tar": "Archive", + "xz": "Archive", + "exe": "Archive / Windows Executable", + "iso": "Archive / Disk Image", + # Plain + "html": "HTML Code Document", + "js": "JavaScript Code Document", + "css": "CSS Code Document", + "py": "Python Code Document", + "pyw": "Python Code Document", + "c": "C Code Document", + "csharp": "C# Code Document", + "cpp": "C++ Code Document", + "sh": "Shell Code Document", + "bat": "Batch Code Document", + } + if not mimet in filetypel: + filetype = "mime_none.svg" + else: + filetype = filetypel[mimet] + filecday = str(dt.datetime.fromtimestamp(os.path.getctime("users/"+username+"/"+file)).strftime("%Y/%m/%d %H:%M")) + filemday = str(dt.datetime.fromtimestamp(os.path.getmtime("users/"+username+"/"+file)).strftime("%Y/%m/%d %H:%M")) + + html_code += "
"+file.replace("_", " ")+"
" + if html_code == "": + html_code = "
" + return html_code + + +app = Flask(__name__, template_folder="..\\templates", static_folder="..\\asset") + + +@app.after_request +def add_header(response): + response.headers['Cache-Control'] = 'cache, no-store, must-revalidate' + response.headers['Pragma'] = 'no-cache' + response.headers['Expires'] = '0' + return response + + +@app.errorhandler(404) +def page_not_found(error): + return render_template("errors/404.html"), 404 + + +@app.errorhandler(500) +def internal_server_error(error): + return render_template("errors/500.html"), 500 + + +@app.errorhandler(405) +def forbiden(error): + return render_template("errors/405.html"), 405 + + +subtitle_reader = open("login_subtitle.cfg") +login_subtitle = subtitle_reader.read() +subtitle_reader.close() +version_reader = open("version.cfg", "r") +version = version_reader.read() +version_reader.close() + + +if open("no_binary.cfg").read() == "1": + blacklist_extensions = [ + "application/x-msdownload", "application/octet-stream"] + print("Block binaries") +else: + blacklist_extensions = [] +blacklist_filenames = ["is_admin", "userconfig.cfg", "enced_files", "Thumbs.db", "decryption_tempfile.tmp", "", "chat_inbox", "userpassword.cfg", "ckey.cfg", "shared_files"] + +def validate_access_permissions(filename): + if secure_filename(filename) in blacklist_filenames or filename.startswith('chat_log_file_'): + retval = True + else: + retval = False + return retval + +# * Lumos filemanager + +@app.route("/", methods=["GET"]) +def startscreen(): + if request.method == "GET": + login_user_input_file = open('loggedin_users') + json_array = json.load(login_user_input_file) + if request.remote_addr in json_array and "ckey" in request.cookies: + if request.cookies["ckey"] == open("users/"+json_array[request.remote_addr]+"/ckey.cfg").read(): + file_html = file_html_gen(json_array[request.remote_addr]) + if os.path.exists("users/"+json_array[request.remote_addr]+"/is_admin"): + if open("virus_scanner.cfg", "r").read() == "1": + virscanner = "Enabled" + else: + virscanner = "Disabled" + if open("no_binary.cfg", "r").read() == "1": + enbin = "yes" + else: + enbin = "no" + userdirlisthtml = "" + userdirlist = os.listdir("users/") + for username_encoded in userdirlist: + if username_encoded != json_array[request.remote_addr]: + userdirlisthtml += "
"+decode_from_base64(username_encoded)+"
" + ram_value = psutil.virtual_memory()[2] + cpu_value = psutil.cpu_percent(2) + theme = open("theme.cfg", "r").read().split(".")[0] + return render_template("admin/admin_dashboard.html", version=version, + platform=platform.system(), virscanner=virscanner, last_vir_update=open("last_virus_update.txt", "r").read(), blockbinary=enbin, ram=ram_value, cpu=cpu_value, servername = login_subtitle, acttheme=theme).replace("[[ userlist ]]", userdirlisthtml) + else: + return render_template("homescreen.html", version=version).replace("[[ files ]]", file_html) + else: + open("users/"+json_array[request.remote_addr]+"/ckey.cfg", "w").write("") + if request.remote_addr in json_array: + del json_array[request.remote_addr] + loggedin_users_writer = open("loggedin_users", "w") + loggedin_users_writer.write(json.dumps(json_array)) + loggedin_users_writer.close() + return render_template("login.html", login_subtitle=login_subtitle) + else: + return render_template("login.html", login_subtitle=login_subtitle) + else: + return "Method not allowed" + +# * Login & Register + +@app.route("/login", methods=["GET", "POST"]) +def login(): + if request.method == "GET": + login_user_input_file = open('loggedin_users') + json_array = json.load(login_user_input_file) + if not request.remote_addr in json_array: + return render_template("login.html", login_subtitle=login_subtitle) + else: + return "" + elif request.method == "POST": + time.sleep(3) + print("users/"+encode_as_base64(secure_filename(request.form["username"]))+"/userpassword.cfg") + if os.path.exists("users/"+encode_as_base64(secure_filename(request.form["username"]))+"/userpassword.cfg"): + if hashlib.sha256(request.form["password"].encode("utf-8")).hexdigest() ==\ + open("users/"+encode_as_base64(secure_filename(request.form["username"]))+"/userpassword.cfg", "r").read(): + login_user_input_file = open('loggedin_users') + json_array = json.load(login_user_input_file) + json_array[request.remote_addr] = encode_as_base64( + secure_filename(request.form["username"])) + json_array_json = json.dumps(json_array) + loggedin_users_writer = open("loggedin_users", "w") + loggedin_users_writer.write(json_array_json) + loggedin_users_writer.close() + i = 0 + cookiekeystr = "" + while i != 512: + cookiekeystr += chr(random.randint(1, 128)) + i = i+1 + cookiekey = hashlib.sha512(cookiekeystr.encode("utf-8")).hexdigest() + if os.path.exists("users/"+encode_as_base64(secure_filename(request.form["username"]))+"/is_admin"): + if open("virus_scanner.cfg", "r").read() == "1": + virscanner = "Enabled" + else: + virscanner = "Disabled" + if open("no_binary.cfg", "r").read() == "1": + enbin = "yes" + else: + enbin = "no" + userdirlisthtml = "" + userdirlist = os.listdir("users/") + for username_encoded in userdirlist: + if username_encoded != json_array[request.remote_addr]: + userdirlisthtml += "
"+decode_from_base64(username_encoded)+"
" + ram_value = psutil.virtual_memory()[2] + cpu_value = psutil.cpu_percent(2) + theme = open("theme.cfg", "r").read().split(".")[0] + open("users/"+json_array[request.remote_addr]+"/"+"ckey.cfg", "w").write(cookiekey) + return render_template("admin/admin_dashboard.html", version=version, + platform=platform.system(), virscanner=virscanner, last_vir_update=open("last_virus_update.txt", "r").read(), blockbinary=enbin, ram=ram_value, cpu=cpu_value, servername = login_subtitle, acttheme=theme).replace("[[ userlist ]]", userdirlisthtml).replace("[[ ckey ]]", cookiekey) + else: + open("users/"+json_array[request.remote_addr]+"/"+"ckey.cfg", "w").write(cookiekey) + return "" + else: + return "" + else: + return "" + + +@app.route("/register", methods=["GET", "POST"]) +# TODO Messages +def register(): + if request.method == "GET": + return render_template("welcome.html", login_subtitle=login_subtitle) + elif request.method == "POST": + time.sleep(3) + if request.form["accid"] == open("accid.cfg", "r").read(): + if not os.path.exists("users/"+encode_as_base64(secure_filename(request.form["username"]))+"/"+"userpassword.cfg"): + os.mkdir( + "users/"+encode_as_base64(secure_filename(request.form["username"]))+"/") + enced_file_writer = open("users/"+encode_as_base64( + secure_filename(request.form["username"]))+"/enced_files", "w") + enced_file_writer.write("{}") + enced_file_writer.close() + user_info_writer = open("users/"+encode_as_base64( + secure_filename(request.form["username"]))+"/"+"userpassword.cfg", "w") + user_info_writer.write(hashlib.sha256( + request.form["password"].encode("utf-8")).hexdigest()) + user_info_writer.close() + time.sleep(3) + return "" + else: + return "" + else: + return "" + + +@app.route("/logoff") +def logoff(): + login_user_input_file = open('loggedin_users') + json_array = json.load(login_user_input_file) + if request.remote_addr in json_array: + open("users/"+json_array[request.remote_addr]+"/ckey.cfg", "w").write("") + del json_array[request.remote_addr] + loggedin_users_writer = open("loggedin_users", "w") + loggedin_users_writer.write(json.dumps(json_array)) + loggedin_users_writer.close() + return "" + else: + return "" + + +# * File upload + +@app.route("/upload/web", methods=["GET", "POST"]) +# ! Is it secure? +def upload(): + if request.method == "GET": + login_user_input_file = open('loggedin_users') + json_array = json.load(login_user_input_file) + if request.remote_addr in json_array and request.cookies["ckey"] == open("users/"+json_array[request.remote_addr]+"/ckey.cfg").read(): + return render_template("upload.html") + else: + return "You're not logged in", 403 + elif request.method == "POST": + login_user_input_file = open('loggedin_users') + json_array = json.load(login_user_input_file) + username = json_array[request.remote_addr] + if request.remote_addr in json_array and request.cookies["ckey"] == open("users/"+json_array[request.remote_addr]+"/ckey.cfg").read(): + if not os.path.exists("users/"+username+"/"+secure_filename(request.form["filename"])): + file = request.files["file_upload"] + username = json_array[request.remote_addr] + print(file.content_type) + if not file.content_type in blacklist_extensions and not validate_access_permissions(filename=request.form["filename"]): + file_contents = file.read() + if open("virus_scanner.cfg") == "1": + if not hashlib.md5(file_contents).hexdigest() in open("hashes_main.txt", "r").read().split("\n"): + file_writer = open( + "users/"+username+"/" + secure_filename(request.form["filename"]), "wb") + file_writer.write(file_contents) + file_writer.close() + file_html = file_html_gen(json_array[request.remote_addr]) + return render_template("homescreen.html", version=version).replace("[[ files ]]", file_html) + else: + return "", 905 + else: + file_writer = open( + "users/"+username+"/" + secure_filename(request.form["filename"]), "wb") + file_writer.write(file_contents) + file_writer.close() + file_html = file_html_gen(json_array[request.remote_addr]) + return render_template("homescreen.html", version=version).replace("[[ files ]]", file_html) + else: + # Execu or illegal filename detected + return "", 903 + else: + # The file already exists + return "", 904 + else: + return "You're not logged in" + + +@app.route("/load-file/") +def load_file(filename): + login_user_input_file = open('loggedin_users') + json_array = json.load(login_user_input_file) + enced_files = open('users/'+json_array[request.remote_addr]+"/enced_files") + enced_file_array = json.load(enced_files) + if request.remote_addr in json_array and request.cookies["ckey"] == open("users/"+json_array[request.remote_addr]+"/ckey.cfg").read(): + username = json_array[request.remote_addr] + if not validate_access_permissions(filename=filename): + if not filename in enced_file_array: + music_extensions = ["mp3", "wav", "m4a"] + if not filename.split(".")[1] in music_extensions: + return send_file( + io.BytesIO(open("users/"+username+"/" + + secure_filename(filename), 'rb').read()), + mimetype=str(mime.guess_type( + "users/"+username+"/"+secure_filename(filename))), + as_attachment=True, + download_name=filename + ) + else: + b64_data = "data:audio/"+filename.split(".")[1]+";base64,"+str(base64.b64encode(open("users/"+json_array[request.remote_addr]+"/"+filename, "rb").read())).replace("b'", "").replace("'","") + return render_template("music_player.html", filename = filename, song_in_b64 = b64_data) + else: + return "", 901 + else: + return "You aren't allowed to access this file", 403 + else: + return "You're not logged in" + +@app.route("/load-file-password", methods=["POST"]) +def load_file_password(): + login_user_input_file = open('loggedin_users') + json_array = json.load(login_user_input_file) + if request.remote_addr in json_array and request.cookies["ckey"] == open("users/"+json_array[request.remote_addr]+"/ckey.cfg").read(): + if not validate_access_permissions(filename=request.form["filename"]): + try: + pyAesCrypt.decryptFile("users/"+json_array[request.remote_addr]+"/"+secure_filename(request.form["filename"]), outfile="users/"+json_array[request.remote_addr]+"/decryption_tempfile.tmp", passw=hashlib.sha256(request.form["password"].encode("utf-8")).hexdigest(), bufferSize=131072) + except ValueError: + return "" + temp_file_reader_dec = open("users/"+json_array[request.remote_addr]+"/decryption_tempfile.tmp", "rb") + return send_file(temp_file_reader_dec, mimetype=str(mime.guess_type( + "users/"+json_array[request.remote_addr]+"/"+secure_filename(request.form["filename"]))), as_attachment=True, download_name=secure_filename(request.form["filename"])) + else: + return "You're not allowed to access this file" + +@app.route("/thumbnail-load-file/") +def thumbnail_load_file(filename): + login_user_input_file = open('loggedin_users') + json_array = json.load(login_user_input_file) + if request.remote_addr in json_array and request.cookies["ckey"] == open("users/"+json_array[request.remote_addr]+"/ckey.cfg").read(): + username = json_array[request.remote_addr] + if not validate_access_permissions(filename=filename): + file_reader = open("users/"+username+"/" + + secure_filename(filename), "rb").read() + cbytes = compress_image( + file_reader, username=username, filename=filename) + try: + return_data = send_file( + cbytes, + mimetype=str(mime.guess_type( + "users/"+username+"/"+secure_filename(filename)))) + except: + return_data = send_file("asset/no_access.png", "image/png") + return return_data + else: + return "You aren't allowed to access this file", 403 + else: + return "You're not logged in" + + +@app.route("/delete-file/") +def delete_file(filename): + login_user_input_file = open('loggedin_users') + json_array = json.load(login_user_input_file) + if request.remote_addr in json_array and request.cookies["ckey"] == open("users/"+json_array[request.remote_addr]+"/ckey.cfg").read(): + username = json_array[request.remote_addr] + if not validate_access_permissions(filename=filename): + os.remove("users/"+username+"/"+secure_filename(filename)) + input_file_enced = open('users/'+username+"/enced_files") + json_array_enced = json.load(input_file_enced) + if filename in json_array_enced: + del json_array_enced[filename] + loggedin_users_writer = open( + 'users/'+username+"/enced_files", "w") + loggedin_users_writer.write(json.dumps(json_array_enced)) + loggedin_users_writer.close() + filename = str(secure_filename(filename)) + username = json_array[request.remote_addr] + user_shared_list = open('users/'+username+"/shared_files") + user_shared_list_parsed = json.load(user_shared_list) + try: + del user_shared_list_parsed[filename] + except: + pass + open('users/'+username+"/shared_files", "w").write(json.dumps(user_shared_list_parsed)) + return "" + else: + return "You aren't allowed to access this file", 403 + else: + return "You're not logged in" + + +@app.route("/rename-file//") +def rename_file(filename, new_file_name): + login_user_input_file = open('loggedin_users') + json_array = json.load(login_user_input_file) + if request.remote_addr in json_array and request.cookies["ckey"] == open("users/"+json_array[request.remote_addr]+"/ckey.cfg").read(): + username = json_array[request.remote_addr] + if not validate_access_permissions(filename=filename) and not validate_access_permissions(filename=new_file_name): + os.rename("users/"+username+"/"+secure_filename(filename), + "users/"+username+"/"+secure_filename(new_file_name)) + return "" + else: + return "You aren't allowed to access this file", 403 + else: + return "You're not logged in" + +@app.route("/mng-encryption-file-formular-handler", methods=["POST"]) +def mng_encryption_file_formular_handler(): + login_user_input_file = open('loggedin_users') + json_array = json.load(login_user_input_file) + filename = request.form["filename"] + if not validate_access_permissions(filename=filename): + if request.remote_addr in json_array and request.cookies["ckey"] == open("users/"+json_array[request.remote_addr]+"/ckey.cfg").read(): + if request.remote_addr in json_array and request.cookies["ckey"] == open("users/"+json_array[request.remote_addr]+"/ckey.cfg").read(): + input_file_enc = open( + 'users/'+json_array[request.remote_addr]+"/enced_files") + json_array_enc = json.load(input_file_enc) + if request.form["filename"] in json_array_enc: + if json_array_enc[request.form["filename"]] == "1": + is_encrypted = True + else: + is_encrypted = False + else: + is_encrypted = False + if not is_encrypted: + input_file_enced = open( + "users/"+json_array[request.remote_addr]+'/enced_files') + json_array_enced = json.load(input_file_enced) + json_array_enced[request.form["filename"]] = "1" + json_array_json_enced = json.dumps(json_array_enced) + enced_file_writer = open( + "users/"+json_array[request.remote_addr]+'/enced_files', "w") + enced_file_writer.write(json_array_json_enced) + enced_file_writer.close() + password = hashlib.sha256( + request.form["password"].encode("utf-8")).hexdigest() + pyAesCrypt.encryptFile("users/"+json_array[request.remote_addr]+"/"+secure_filename(request.form["filename"]), "users/" + + json_array[request.remote_addr]+"/"+secure_filename(request.form["filename"])+".aes.tmp", passw=password, bufferSize=131072) + os.remove("users/"+json_array[request.remote_addr] + + "/"+secure_filename(request.form["filename"])) + os.rename("users/"+json_array[request.remote_addr]+"/"+secure_filename(request.form["filename"]) + + ".aes.tmp", "users/"+json_array[request.remote_addr]+"/"+secure_filename(request.form["filename"])) + return "" # * There is a + else: + password = hashlib.sha256( + request.form["password"].encode("utf-8")).hexdigest() + try: + pyAesCrypt.decryptFile("users/"+json_array[request.remote_addr]+"/"+secure_filename(request.form["filename"]), "users/" + + json_array[request.remote_addr]+"/"+secure_filename(request.form["filename"])+".aes.tmp", passw=password, bufferSize=131072) + except ValueError: + return "" # * There is a script + os.remove("users/"+json_array[request.remote_addr] + + "/"+secure_filename(request.form["filename"])) + os.rename("users/"+json_array[request.remote_addr]+"/"+secure_filename(request.form["filename"]) + + ".aes.tmp", "users/"+json_array[request.remote_addr]+"/"+secure_filename(request.form["filename"])) + input_file_enced = open( + "users/"+json_array[request.remote_addr]+'/enced_files') + json_array_enced = json.load(input_file_enced) + del json_array_enced[request.form["filename"]] + enced_file_writer = open( + 'users/'+json_array[request.remote_addr]+"/enced_files", "w") + enced_file_writer.write(json.dumps(json_array_enced)) + enced_file_writer.close() + return "" # * There is a script + else: + return "You are not allowed to edit this file", 403 + +@app.route("/search/q/") +def search(query): + login_user_input_file = open('loggedin_users') + json_array = json.load(login_user_input_file) + if request.remote_addr in json_array and request.cookies["ckey"] == open("users/"+json_array[request.remote_addr]+"/ckey.cfg").read(): + username = json_array[request.remote_addr] + results = [] + for e in os.listdir("users/"+username+"/"): + if query in e: + results += [e] + html_code = "" + for r in results: + if not validate_access_permissions(r): + try: + mimet = r.split(".")[1] + except IndexError: + mimet = "mime_none.svg" + filetypel = { + # Images + "png": "Image file", + "jpg": "Image file", + "heic": "Image file", + "gif": "Image file", + "heif": "Image file", + "bmp": "Image file", + "ico": "Icon file", + # Text Document + "doc": "Word Document", + "docx": "Word Document", + "odt": "LibreOffice Writer Document", + "md": "Markdown", + "txt": "Plain Text", + # Presentation + "ppt": "PowerPoint Presentation", + "pptx": "PowerPoint Presentation", + "odp": "LibreOffice Impress Document", + "pptm": "PowerPoint Macro File", + # Spreadsheet + "xls": "Excel Spreadsheet", + "xlsx": "Excel Spreadsheet", + "ods": "LibreOffice Spreadsheet", + "csv": "CSV Table Text Document", + # PDF + "pdf": "PDF Document", + # Videos + "mp4": "Video", + "mov": "Video", + "avi": "Video", + "webm": "Video", + # Archive + "zip": "Archive", + "tar": "Archive", + "xz": "Archive", + "exe": "Archive / Windows Executable", + "iso": "Archive / Disk Image", + # Plain + "html": "HTML Code Document", + "js": "JavaScript Code Document", + "css": "CSS Code Document", + "py": "Python Code Document", + "pyw": "Python Code Document", + "c": "C Code Document", + "csharp": "C# Code Document", + "cpp": "C++ Code Document", + "sh": "Shell Code Document", + "bat": "Batch Code Document", + } + if not mimet in filetypel: + filetype = "mime_none.svg" + else: + filetype = filetypel[mimet] + filesize = str(os.stat("users/"+username+"/"+r).st_size) + filetype = str(os.stat("users/"+username+"/"+r).st_size) + filecday = str(dt.datetime.fromtimestamp(os.path.getctime("users/"+username+"/"+r)).strftime("%Y/%m/%d %H:%M")) + filemday = str(dt.datetime.fromtimestamp(os.path.getmtime("users/"+username+"/"+r)).strftime("%Y/%m/%d %H:%M")) + mime_icon_dict = { + # Images + "png": "mime_image.svg", + "jpg": "mime_image.svg", + "heic": "mime_image.svg", + "gif": "mime_image.svg", + "heif": "mime_image.svg", + "bmp": "mime_image.svg", + "ico": "mime_image.svg", + # Text Document + "doc": "mime_doc.svg", + "docx": "mime_doc.svg", + "odt": "mime_doc.svg", + "md": "mime_doc.svg", + "txt": "mime_doc.svg", + # Presentation + "ppt": "mime_presentation.svg", + "pptx": "mime_presentation.svg", + "odp": "mime_presentation.svg", + "pptm": "mime_presentation.svg", + # Spreadsheet + "xls": "mime_spreadsheet.svg", + "xlsx": "mime_spreadsheet.svg", + "ods": "mime_spreadsheet.svg", + "csv": "mime_spreadsheet.svg", + # PDF + "pdf": "mime_pdf.svg", + # Videos + "mp4": "mime_video.svg", + "mov": "mime_video.svg", + "avi": "mime_video.svg", + "webm": "mime_video.svg", + # Archive + "zip": "mime_archive.svg", + "tar": "mime_archive.svg", + "xz": "mime_archive.svg", + "exe": "mime_archive.svg", + "iso": "mime_archive.svg", + } + try: + mimet = r.split(".")[1] + except IndexError: + mimet = "mime_none.svg" + print(mimet) + if mimet in mime_icon_dict: + mime_icon = mime_icon_dict[mimet] + else: + mime_icon = "mime_none.svg" + html_code += "
"+r.replace("_", " ")+"
" + if html_code == "": + html_code = "
No results
" + return html_code + else: + return "You are not logged in" + +# * Lumos Chat + + +def remove_emojis(data): + emoji_smile_k_l = ["๐Ÿ˜€", "๐Ÿ˜", "๐Ÿ˜ƒ", "๐Ÿ™‚", "โ˜บ", ":smile:"] + for emoji_smile_k in emoji_smile_k_l: + data = data.replace(emoji_smile_k, ":smile:") + emoj = re.compile("[" + u"\U00002700-\U000027BF" + u"\U0001F600-\U0001F64F" + u"\U00002600-\U000026FF" + u"\U0001F300-\U0001F5FF" + u"\U0001F900-\U0001F9FF" + u"\U0001FA70-\U0001FAFF" + u"\U0001F680-\U0001F6FF" + "]+", re.UNICODE) + return re.sub(emoj, '', data) + +@app.route("/chat/web") +def chat_web(): + login_user_input_file = open('loggedin_users') + json_array = json.load(login_user_input_file) + if request.remote_addr in json_array and request.cookies["ckey"] == open("users/"+json_array[request.remote_addr]+"/ckey.cfg").read(): + users_dir_array = os.listdir("users/") + userlist_parsed_to_html = "" + for found_user in users_dir_array: + if found_user != json_array[request.remote_addr]: + userlist_parsed_to_html += "" + return render_template("chat_main.html", username = "").replace("[[ userlist ]]", userlist_parsed_to_html).replace("[[ messages ]]", "") + else: + return "You are not allowed to access this chat" + +@app.route("/chat/web/s", methods=["POST", "GET"]) +def chat_web_send(): + login_user_input_file = open('loggedin_users') + json_array = json.load(login_user_input_file) + if request.method == "POST": + if request.remote_addr in json_array and request.cookies["ckey"] == open("users/"+json_array[request.remote_addr]+"/ckey.cfg").read(): + reciver_name = secure_filename(request.form["username"]) + sender_name = decode_from_base64(json_array[request.remote_addr]) + reciver_log_file = "users/"+encode_as_base64(reciver_name)+"/chat_log_file_"+sender_name+".txt" + sender_log_file = "users/"+encode_as_base64(sender_name)+"/chat_log_file_"+reciver_name+".txt" + message = remove_emojis(request.form["message"].replace("&", "&")).replace("<", "<").replace(">", ">") + if os.path.exists(sender_log_file): + open(sender_log_file, "a").write("\ny:"+message) + else: + open(sender_log_file, "w").write("y:"+message) + if os.path.exists(reciver_log_file): + open(reciver_log_file, "a").write("\no:"+message) + else: + open(reciver_log_file, "w").write("o:"+message) + users_dir_array = os.listdir("users/") + userlist_parsed_to_html = "" + for found_user in users_dir_array: + if found_user != json_array[request.remote_addr]: + userlist_parsed_to_html += "" + msg_html = "" + if os.path.exists(sender_log_file): + message_array = open(sender_log_file).read().split("\n") + for message in message_array: + if message.startswith("y:"): + msg_html += "
"+message.removeprefix("y:")+"

" + if message.startswith("o:"): + msg_html += "
"+message.removeprefix("o:")+"

" + if request.files["file-upload"] != "": + fileformchat = request.files["file-upload"] + filecontents = fileformchat.read() + if not os.path.exists("users/"+encode_as_base64(secure_filename(reciver_name))+"/chat_inbox"): + os.mkdir("users/"+encode_as_base64(secure_filename(reciver_name))+"/chat_inbox") + if open("virus_scanner.cfg", "r").read() == "1": + if not hashlib.md5(filecontents).hexdigest() in open("hashes_main.txt", "r").read().split("\n") and not validate_access_permissions(filename=request.form["filename"]): + open("users/"+encode_as_base64(reciver_name)+"/chat_inbox/by_"+secure_filename(sender_name)+"_"+secure_filename(request.form["file-name"])) + else: + if not validate_access_permissions(filename=request.form["filename"]): + open("users/"+encode_as_base64(reciver_name)+"/chat_inbox/by_"+secure_filename(sender_name)+"_"+secure_filename(request.form["filename"]), "wb").write(filecontents) + return "'" + else: + return "You are not allowed to access this chat" + else: + return "'" + + +@app.route("/chat/web/l", methods=["GET", "POST"]) +def chat_web_load(): + login_user_input_file = open('loggedin_users') + json_array = json.load(login_user_input_file) + if request.method == "POST": + reciver_name = secure_filename(request.form["username"]) + sender_name = decode_from_base64(json_array[request.remote_addr]) + sender_log_file = "users/"+encode_as_base64(sender_name)+"/chat_log_file_"+reciver_name+".txt" + if request.remote_addr in json_array and request.cookies["ckey"] == open("users/"+json_array[request.remote_addr]+"/ckey.cfg").read(): + users_dir_array = os.listdir("users/") + userlist_parsed_to_html = "" + for found_user in users_dir_array: + if found_user != json_array[request.remote_addr]: + userlist_parsed_to_html += "" + msg_html = "" + if os.path.exists(sender_log_file): + message_array = open(sender_log_file).read().split("\n") + for message in message_array: + if message.startswith("y:"): + msg_html += "
"+message.removeprefix("y:")+"

" + if message.startswith("o:"): + msg_html += "
"+message.removeprefix("o:")+"

" + else: + msg_html = "" + return render_template("chat_main.html", username = reciver_name).replace("[[ userlist ]]", userlist_parsed_to_html).replace("[[ messages ]]", msg_html) + else: + return "You are not allowed to access this chat" + else: + users_dir_array = os.listdir("users/") + userlist_parsed_to_html = "" + for found_user in users_dir_array: + if found_user != json_array[request.remote_addr]: + userlist_parsed_to_html += "" + return render_template("chat_main.html", username = "").replace("[[ userlist ]]", userlist_parsed_to_html).replace("[[ messages ]]", "") + +@app.route("/chat/web/fb") +def filebox(): + login_user_input_file = open('loggedin_users') + json_array = json.load(login_user_input_file) + filelist_html = "" + if os.path.exists("users/"+json_array[request.remote_addr]+"/chat_inbox"): + if request.remote_addr in json_array and request.cookies["ckey"] == open("users/"+json_array[request.remote_addr]+"/ckey.cfg").read(): + for file in os.listdir("users/"+json_array[request.remote_addr]+"/chat_inbox"): + filelist_html += "
"+file.split("_")[1]+" "+file.split("_")[2]+"

" + else: + filelist_html = "Your filebox is empty" + return render_template("filebox.html").replace("[[ filelist ]]", filelist_html) + +@app.route("/chat/web/fb/l/") +def filebox_load(filename): + login_user_input_file = open('loggedin_users') + json_array = json.load(login_user_input_file) + if request.remote_addr in json_array and request.cookies["ckey"] == open("users/"+json_array[request.remote_addr]+"/ckey.cfg").read(): + return send_file( + "users/"+json_array[request.remote_addr]+"/chat_inbox/"+secure_filename(filename), + mimetype=str(mime.guess_type("users/"+json_array[request.remote_addr]+"/chat_inbox/"+secure_filename(filename))) + ) + else: + return "You're not allowed to access this location" + +# * Lumos Admin + +@app.route("/admin/update") +def admin_update(): + login_user_input_file = open('loggedin_users') + json_array = json.load(login_user_input_file) + if os.path.exists("users/"+json_array[request.remote_addr]+"/is_admin"): + return render_template("admin/update.html") + else: + return "You are not allowed to access this site", 403 + +@app.route("/admin/system") +def admin_system(): + login_user_input_file = open('loggedin_users') + json_array = json.load(login_user_input_file) + if os.path.exists("users/"+json_array[request.remote_addr]+"/is_admin"): + return render_template("admin/system.html") + else: + return "You are not allowed to access this site", 403 + +@app.route("/admin/vrscnr") +def admin_vrscnr(): + login_user_input_file = open('loggedin_users') + json_array = json.load(login_user_input_file) + if os.path.exists("users/"+json_array[request.remote_addr]+"/is_admin"): + if open("virus_scanner.cfg", "r").read() == "0": + enabled = "false" + else: + enabled = "true" + return render_template("admin/virusscanner.html", virus_scanner_enabled=enabled) + else: + return "You are not allowed to access this site", 403 + +@app.route("/admin_virus_definitions", methods=["POST"]) +def upload_virus_definitions(): + login_user_input_file = open('loggedin_users') + json_array = json.load(login_user_input_file) + if os.path.exists("users/"+json_array[request.remote_addr]+"/is_admin"): + main_file = request.files["main_upload"] + daily_file = request.files["daily_upload"] + main_file.save("main.cvd") + daily_file.save("daily.cvd") + if open("virus_scanner.cfg").read() == "1" and os.path.exists("main.cvd") and os.path.exists("daily.cvd"): + print("Updating virus definitions from local files\nPlease wait...") + t1 = threading.Thread(gethashes.get_hashes_names("main")) + t2 = threading.Thread(gethashes.get_hashes_names("daily")) + t1.start() + t2.start() + print("Virus Update Done") + return render_template("admin/upload_done.html") + else: + return "You are not allowed to access this site", 403 + +@app.route("/admin_virus_protection_settings", methods=["POST"]) +def apply_settings_av(): + login_user_input_file = open('loggedin_users') + json_array = json.load(login_user_input_file) + if os.path.exists("users/"+json_array[request.remote_addr]+"/is_admin"): + if len(request.form) == 1: + open("virus_scanner.cfg", "w").write("1") + if os.path.exists("main.cvd") and os.path.exists("daily.cvd"): + return "" + else: + return "" + else: + open("virus_scanner.cfg", "w").write("0") + return "" + else: + return "You are not allowed to access this site", 403 + +@app.route("/admin/binary-block", methods=["POST"]) +def binaryblock(): + login_user_input_file = open('loggedin_users') + json_array = json.load(login_user_input_file) + if os.path.exists("users/"+json_array[request.remote_addr]+"/is_admin"): + if "binary-block" in request.form: + if request.form["binary-block"] == "on": + open("no_binary.cfg", "w").write("1") + else: + open("no_binary.cfg", "w").write("0") + return "" + else: + return "You are not allowed to access this site", 403 + +@app.route("/admin/rmuser/") +def remover_user(username): + login_user_input_file = open('loggedin_users') + json_array = json.load(login_user_input_file) + if os.path.exists("users/"+json_array[request.remote_addr]+"/is_admin"): + if platform.system() == "Windows": + os.system("rmdir /q /s \"users/"+encode_as_base64(secure_filename(username))+"\"") + print("rmdir /q /s users/"+encode_as_base64(secure_filename(username))) + elif platform.system() == "Linux": + os.system("rm -r -f -d users/"+encode_as_base64(secure_filename(username))) + return "" + else: + return "You are not allowed to access this site", 403 + +@app.route("/admin/ciconupload", methods=["POST"]) +def ciupload(): + login_user_input_file = open('loggedin_users') + json_array = json.load(login_user_input_file) + if os.path.exists("users/"+json_array[request.remote_addr]+"/is_admin"): + request.files["icon_upload"].save("asset/company_icon.png") + return "" + +@app.route("/admin/themechange/") +def theme_change(theme): + login_user_input_file = open('loggedin_users') + json_array = json.load(login_user_input_file) + if os.path.exists("users/"+json_array[request.remote_addr]+"/is_admin"): + if os.path.exists("asset/themes/"+theme+".css"): + open("theme.cfg", "w").write(theme) + open("asset/themeoverride.css", "w").write(open("asset/themes/"+open("theme.cfg", "r").read()+".css").read()) + return "" + else: + return "doesnotexist" + + +@app.route("/favicon.ico") +def favicon(): + return send_file("asset/logo.png") + +@app.route("/info") +def info(): + return render_template("info.html", version=version, login_subtitle=login_subtitle) + +@app.route("/info/p") +def info_privacy(): + return render_template("privacy.html") + +@app.route("/rawedit/") +def rawedit(filename): + login_user_input_file = open('loggedin_users') + json_array = json.load(login_user_input_file) + if request.remote_addr in json_array and request.cookies["ckey"] == open("users/"+json_array[request.remote_addr]+"/ckey.cfg").read(): + try: + username = json_array[request.remote_addr] + load_filename = "users/"+username+"/"+secure_filename(filename) + file_content = open(load_filename, "r").read() + return render_template("rawedit.html", filename = filename).replace("[[ file_content ]]", file_content) + except UnicodeDecodeError: + return "" + else: + return "", 403 + +@app.route("/rawedits", methods=["POST"]) +def rawedit_s(): + login_user_input_file = open('loggedin_users') + json_array = json.load(login_user_input_file) + if request.remote_addr in json_array and request.cookies["ckey"] == open("users/"+json_array[request.remote_addr]+"/ckey.cfg").read(): + filename = secure_filename(request.form["filename"]) + username = json_array[request.remote_addr] + open("users/"+json_array[request.remote_addr]+"/"+secure_filename(filename), "w").write(request.form["file_content"]) + load_filename = "users/"+username+"/"+secure_filename(filename) + file_content = open(load_filename, "r").read() + return render_template("rawedit.html", filename = filename).replace("[[ file_content ]]", file_content) + else: + return "" + +@app.route("/security_advisor") +def security_advisor(): + login_user_input_file = open('loggedin_users') + json_array = json.load(login_user_input_file) + if request.remote_addr in json_array and request.cookies["ckey"] == open("users/"+json_array[request.remote_addr]+"/ckey.cfg").read(): + return render_template("security_advisor.html") + else: + return "You are not allowed to access this page", 403 + +@app.route("/security_advisor/start", methods=["POST"]) +def security_advisor_start(): + login_user_input_file = open('loggedin_users') + json_array = json.load(login_user_input_file) + if request.remote_addr in json_array and request.cookies["ckey"] == open("users/"+json_array[request.remote_addr]+"/ckey.cfg").read(): + password = request.form["password"] + p_score = 0 + if len(password) < 5: + p_score = 1 + elif len(password) < 10: + p_score = 40 + elif len(password) < 15: + p_score = 70 + elif len(password) < 20: + p_score = 100 + elif len(password) < 30: + p_score = 120 + else: + p_score = 180 + scs = 0 + special_chars = ["!", "\"", "ยง", "$", "%", "&", "/", "(", ")", "=", "?", "+", "*", "#", "'", "-", ".", ":", ",", ";", "[", "]", "{", "}", "\\", "^", "ยฐ", "1", "2", "3", "4", "5", "6", "7", "8", "9", "0"] + for c in password: + if c in special_chars: + scs = scs+1 + p_score = p_score - (10 - scs) + p_score = p_score / 2 + if p_score > 100: + p_score = 100 + if p_score < 20: + p_score = 20 + p_score = p_score * 4 + p_score = str(p_score)+"px" + user_encrypted_files = json.load(open("users/"+json_array[request.remote_addr]+"/enced_files")) + m_f_list_html = "" + for file in os.listdir("users/"+json_array[request.remote_addr]): + if not file in user_encrypted_files: + try: + if file.split(".")[1] in ["doc", "docx", "rtf", "pdf", "odt", "xls", "xlsx", "csv", "ods", "ppt", "pptx", "odp"]: + m_f_list_html += "
"+file+"
" + except IndexError: + pass + return render_template("security_advisor_overview.html", p_score = p_score).replace("[[ m_f_list_html ]]", m_f_list_html) + else: + return "You are not allowed to access this page", 403 + +@app.route("/share/link///") +def share_link(username, filename, code): + username = decode_from_base64(str(username)) + user_shared_list = open('users/'+encode_as_base64(secure_filename(username))+"/shared_files") + user_shared_list_parsed = json.load(user_shared_list) + if secure_filename(filename) in user_shared_list_parsed and user_shared_list_parsed[secure_filename(filename)] == code and not validate_access_permissions(filename): + return send_file( + "users/"+encode_as_base64(secure_filename(username))+"/"+secure_filename(filename), + mimetype=secure_filename(filename), + as_attachment=True, + download_name=filename + ) + else: + return render_template("share_wrong_code.html") + +@app.route("/share/info/") +def share_info(filename): + login_user_input_file = open('loggedin_users') + json_array = json.load(login_user_input_file) + if request.remote_addr in json_array: + username = json_array[request.remote_addr] + user_shared_list = open('users/'+username+"/shared_files") + user_shared_list_parsed = json.load(user_shared_list) + filename = decode_from_base64(str(filename)) + if filename in user_shared_list_parsed: + return "shared" + else: + return "not_shared" + else: + return "This part of the API is locked down for you" + +@app.route("/share/reglink/") +def share_reglink(filename): + login_user_input_file = open('loggedin_users') + json_array = json.load(login_user_input_file) + if request.remote_addr in json_array: + filename = secure_filename(decode_from_base64(str(filename))) + username = json_array[request.remote_addr] + user_shared_list = open('users/'+username+"/shared_files") + user_shared_list_parsed = json.load(user_shared_list) + share_code = str(hashlib.sha256(str(random.randint(1,1000000)).encode("utf-8")).hexdigest()) + user_shared_list_parsed[filename] = share_code + open('users/'+username+"/shared_files", "w").write(json.dumps(user_shared_list_parsed)) + return "/share/link/"+username+"/"+filename+"/"+share_code + else: + return "This part of the API is locked down for you" + +@app.route("/share/unreg/") +def share_unreg(filename): + login_user_input_file = open('loggedin_users') + json_array = json.load(login_user_input_file) + if request.remote_addr in json_array: + filename = secure_filename(decode_from_base64(str(filename))) + username = json_array[request.remote_addr] + user_shared_list = open('users/'+username+"/shared_files") + user_shared_list_parsed = json.load(user_shared_list) + del user_shared_list_parsed[filename] + open('users/'+username+"/shared_files", "w").write(json.dumps(user_shared_list_parsed)) + return "done" + else: + return "This part of the API is locked down for you" + + +app.run("0.0.0.0", 5000, ssl_context="adhoc") \ No newline at end of file diff --git a/libs/__pycache__/__main__.cpython-311.pyc b/libs/__pycache__/__main__.cpython-311.pyc new file mode 100644 index 0000000..d3823a6 Binary files /dev/null and b/libs/__pycache__/__main__.cpython-311.pyc differ diff --git a/libs/__pycache__/gethashes.cpython-310.pyc b/libs/__pycache__/gethashes.cpython-310.pyc new file mode 100644 index 0000000..59d453a Binary files /dev/null and b/libs/__pycache__/gethashes.cpython-310.pyc differ diff --git a/libs/__pycache__/gethashes.cpython-311.pyc b/libs/__pycache__/gethashes.cpython-311.pyc index c437cfb..b3e5129 100644 Binary files a/libs/__pycache__/gethashes.cpython-311.pyc and b/libs/__pycache__/gethashes.cpython-311.pyc differ diff --git a/libs/autotag.py b/libs/autotag.py new file mode 100644 index 0000000..a055ce3 --- /dev/null +++ b/libs/autotag.py @@ -0,0 +1,19 @@ +def find_repeating_strings(strings_list): + repeating_strings = [] + seen_strings = set() + + for string in strings_list: + string.split("-").split("_") + if string.startswith('-') or string.startswith('_'): + # Check if the string is already in the set of seen_strings + if string in seen_strings: + repeating_strings.append(string) + else: + seen_strings.add(string) + + return repeating_strings + +# Example usage: +strings_list = ["-apple", "_banana", "orange", "_banana", "pear", "-apple", "_kiwi"] +repeating_strings = find_repeating_strings(strings_list) +print("Repeating strings:", repeating_strings) \ No newline at end of file diff --git a/libs/gethashes.py b/libs/gethashes.py index fb2c4ff..5ab535c 100644 --- a/libs/gethashes.py +++ b/libs/gethashes.py @@ -1,101 +1,101 @@ -import gzip -import tarfile -import os -import platform -import time - -def init_processbar(name): -# print(name+" 0% ") -# return name - pass - -def set_proccessbar(name, value): -# time.sleep(0.1) -# if platform.system == "Windows": -# os.system("cls") -# elif platform.system == "Linux": -# os.system("clear") -# strc = "" -# for i in range(value): -# strc += "โ–ฎ" -# print(name+" "+str(value * 10)+"% "+strc) - pass - -def get_hashes_names(file): - bar = init_processbar("Virus Scanner") - if file == "main": - bin_data = open("main.cvd", "rb").read() - elif file == "daily": - bin_data = open("daily.cvd", "rb").read() - else: - print("This file can't be parsed") - exit() - i = 0 - bin_data_clean = bytes() - end_data = bytearray() # Changed from bytes() to bytearray() - val = bin_data[i] - set_proccessbar(bar, 1) - while val != 139 and bin_data[i + 1] != 8 and bin_data[i + 2] != 0: - i += 1 - val = bin_data[i] - i -= 1 - while i != len(bin_data): # Changed the condition from val != None to i >= 0 - end_data.append(bin_data[i]) # Changed += to append() - i += 1 - set_proccessbar(bar, 2) - open("clamav.tar.tmp", "wb").write(gzip.decompress(end_data)) - set_proccessbar(bar, 3) - tarfile_dat = tarfile.open("clamav.tar.tmp", "r") - tarfile_dat.extractall(".\\clamavdb\\") - tarfile_dat.close() - set_proccessbar(bar, 4) - if file == "main": - lines = open("clamavdb/main.hdb", "r").read().split("\n") - else: - lines = open("clamavdb/daily.hdb", "r").read().split("\n") - set_proccessbar(bar, 5) - hashes_hdb = [] - hashes_hdb_name = [] - i = 0 - for line in lines: - split_line = line.split(":") - if len(split_line) > 1: - hashes_hdb.append(split_line[0]) - hashes_hdb_name.append(split_line[2]) - set_proccessbar(bar, 6) - if file == "main": - lines = open("clamavdb/main.hsb", "r").read().split("\n") - else: - lines = open("clamavdb/daily.hdb", "r").read().split("\n") - hashes_hsb = [] - hashes_hsb_name = [] - set_proccessbar(bar, 7) - i = 0 - for line in lines: - split_line = line.split(":") - if len(split_line) > 1: - hashes_hsb.append(split_line[0]) - hashes_hsb_name.append(split_line[2]) - set_proccessbar(bar, 8) - hashes_final = [] - hashes_final.extend(hashes_hdb) - hashes_final.extend(hashes_hsb) - names_final = [] - names_final.extend(hashes_hdb_name) - names_final.extend(hashes_hsb_name) - set_proccessbar(bar, 9) - hashes_main_writer = open("hashes_main.txt", "a") - for hash in hashes_final: - hashes_main_writer.write(hash+"\n") - hashes_main_writer.close() - names_main_writer = open("names_main.txt", "a") - for name in names_final: - names_main_writer.write(name+"\n") - names_main_writer.close() - os.remove(os.getcwd()+"/clamav.tar.tmp") - if platform.system == "Windows": - os.system("rmdir /s "+os.getcwd()+"\clamavdb /q") - elif platform.system == "Linux": - os.system("rm -r -f -d "+os.getcwd()+"\clamavdb") - open("last_virus_update.txt", "w").write(time.strftime("%Y-%m-%d @ %H:%M")) +import gzip +import tarfile +import os +import platform +import time + +def init_processbar(name): +# print(name+" 0% ") +# return name + pass + +def set_proccessbar(name, value): +# time.sleep(0.1) +# if platform.system == "Windows": +# os.system("cls") +# elif platform.system == "Linux": +# os.system("clear") +# strc = "" +# for i in range(value): +# strc += "โ–ฎ" +# print(name+" "+str(value * 10)+"% "+strc) + pass + +def get_hashes_names(file): + bar = init_processbar("Virus Scanner") + if file == "main": + bin_data = open("main.cvd", "rb").read() + elif file == "daily": + bin_data = open("daily.cvd", "rb").read() + else: + print("This file can't be parsed") + exit() + i = 0 + bin_data_clean = bytes() + end_data = bytearray() # Changed from bytes() to bytearray() + val = bin_data[i] + set_proccessbar(bar, 1) + while val != 139 and bin_data[i + 1] != 8 and bin_data[i + 2] != 0: + i += 1 + val = bin_data[i] + i -= 1 + while i != len(bin_data): # Changed the condition from val != None to i >= 0 + end_data.append(bin_data[i]) # Changed += to append() + i += 1 + set_proccessbar(bar, 2) + open("clamav.tar.tmp", "wb").write(gzip.decompress(end_data)) + set_proccessbar(bar, 3) + tarfile_dat = tarfile.open("clamav.tar.tmp", "r") + tarfile_dat.extractall(".\\clamavdb\\") + tarfile_dat.close() + set_proccessbar(bar, 4) + if file == "main": + lines = open("clamavdb/main.hdb", "r").read().split("\n") + else: + lines = open("clamavdb/daily.hdb", "r").read().split("\n") + set_proccessbar(bar, 5) + hashes_hdb = [] + hashes_hdb_name = [] + i = 0 + for line in lines: + split_line = line.split(":") + if len(split_line) > 1: + hashes_hdb.append(split_line[0]) + hashes_hdb_name.append(split_line[2]) + set_proccessbar(bar, 6) + if file == "main": + lines = open("clamavdb/main.hsb", "r").read().split("\n") + else: + lines = open("clamavdb/daily.hdb", "r").read().split("\n") + hashes_hsb = [] + hashes_hsb_name = [] + set_proccessbar(bar, 7) + i = 0 + for line in lines: + split_line = line.split(":") + if len(split_line) > 1: + hashes_hsb.append(split_line[0]) + hashes_hsb_name.append(split_line[2]) + set_proccessbar(bar, 8) + hashes_final = [] + hashes_final.extend(hashes_hdb) + hashes_final.extend(hashes_hsb) + names_final = [] + names_final.extend(hashes_hdb_name) + names_final.extend(hashes_hsb_name) + set_proccessbar(bar, 9) + hashes_main_writer = open("hashes_main.txt", "a") + for hash in hashes_final: + hashes_main_writer.write(hash+"\n") + hashes_main_writer.close() + names_main_writer = open("names_main.txt", "a") + for name in names_final: + names_main_writer.write(name+"\n") + names_main_writer.close() + os.remove(os.getcwd()+"/clamav.tar.tmp") + if platform.system == "Windows": + os.system("rmdir /s "+os.getcwd()+"\clamavdb /q") + elif platform.system == "Linux": + os.system("rm -r -f -d "+os.getcwd()+"\clamavdb") + open("last_virus_update.txt", "w").write(time.strftime("%Y-%m-%d @ %H:%M")) set_proccessbar(bar, 10) \ No newline at end of file diff --git a/run.py b/run.py new file mode 100644 index 0000000..f1bde9a --- /dev/null +++ b/run.py @@ -0,0 +1,13 @@ +import ssl +import os +import subprocess +from gevent.pywsgi import WSGIServer +from libs.__main__ import app + +if os.path.exists("private_key.pem") and os.path.exists("certificate.pem"): + print("Certificate found") +else: + print("Please upload a certificate and key file in the main folder. Names: private_key.pem, certificate.pem") + +http_server = WSGIServer(('0.0.0.0', 5000), app, keyfile='private_key.pem', certfile='certificate.pem', ssl_version=ssl.PROTOCOL_TLS) +http_server.serve_forever() \ No newline at end of file