Revamped the top navbar.
Really large numbers are now formatted properly on the Control Panel Dashboard.
This commit is contained in:
parent
3b5f48b5a2
commit
b841acef29
|
@ -0,0 +1 @@
|
||||||
|
0.1.0-dev
|
3
main.go
3
main.go
|
@ -25,6 +25,9 @@ const kilobyte int = 1024
|
||||||
const megabyte int = kilobyte * 1024
|
const megabyte int = kilobyte * 1024
|
||||||
const gigabyte int = megabyte * 1024
|
const gigabyte int = megabyte * 1024
|
||||||
const terabyte int = gigabyte * 1024
|
const terabyte int = gigabyte * 1024
|
||||||
|
//const thousand int = 1000
|
||||||
|
//const million int = 1_000_000
|
||||||
|
//const billion int = 1_000_000_000
|
||||||
const saltLength int = 32
|
const saltLength int = 32
|
||||||
const sessionLength int = 80
|
const sessionLength int = 80
|
||||||
var enable_websockets bool = false // Don't change this, the value is overwritten by an initialiser
|
var enable_websockets bool = false // Don't change this, the value is overwritten by an initialiser
|
||||||
|
|
|
@ -168,9 +168,13 @@ func route_panel(w http.ResponseWriter, r *http.Request){
|
||||||
onlineUsersColour = "stat_red"
|
onlineUsersColour = "stat_red"
|
||||||
}
|
}
|
||||||
|
|
||||||
gridElements = append(gridElements, GridElement{"dash-totonline",strconv.Itoa(totonline) + " online",3,"grid_stat " + onlineColour,"","","The number of people who are currently online"})
|
totonline, totunit := convert_friendly_unit(totonline)
|
||||||
gridElements = append(gridElements, GridElement{"dash-gonline",strconv.Itoa(gonline) + " guests online",4,"grid_stat " + onlineGuestsColour,"","","The number of guests who are currently online"})
|
uonline, uunit := convert_friendly_unit(uonline)
|
||||||
gridElements = append(gridElements, GridElement{"dash-uonline",strconv.Itoa(uonline) + " users online",5,"grid_stat " + onlineUsersColour,"","","The number of logged-in users who are currently online"})
|
gonline, gunit := convert_friendly_unit(gonline)
|
||||||
|
|
||||||
|
gridElements = append(gridElements, GridElement{"dash-totonline",strconv.Itoa(totonline) + totunit + " online",3,"grid_stat " + onlineColour,"","","The number of people who are currently online"})
|
||||||
|
gridElements = append(gridElements, GridElement{"dash-gonline",strconv.Itoa(gonline) + gunit + " guests online",4,"grid_stat " + onlineGuestsColour,"","","The number of guests who are currently online"})
|
||||||
|
gridElements = append(gridElements, GridElement{"dash-uonline",strconv.Itoa(uonline) + uunit + " users online",5,"grid_stat " + onlineUsersColour,"","","The number of logged-in users who are currently online"})
|
||||||
}
|
}
|
||||||
|
|
||||||
gridElements = append(gridElements, GridElement{"dash-postsperday",strconv.Itoa(postCount) + " posts / " + postInterval,6,"grid_stat " + postColour,"","","The number of new posts over the last 24 hours"})
|
gridElements = append(gridElements, GridElement{"dash-postsperday",strconv.Itoa(postCount) + " posts / " + postInterval,6,"grid_stat " + postColour,"","","The number of new posts over the last 24 hours"})
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
<div class="rowblock post_container">
|
<div class="rowblock post_container top_post">
|
||||||
<div class="rowitem passive editable_parent post_item" style="border-bottom: none;{{if .Topic.Avatar}}background-image:url({{.Topic.Avatar}}), url(/static/white-dot.jpg);background-position: 0px {{if le .Topic.ContentLines 5}}-1{{end}}0px;background-repeat:no-repeat, repeat-y;background-size:128px;padding-left:136px;{{.Topic.Css}}{{end}}">
|
<div class="rowitem passive editable_parent post_item" style="border-bottom: none;{{if .Topic.Avatar}}background-image:url({{.Topic.Avatar}}), url(/static/white-dot.jpg);background-position: 0px {{if le .Topic.ContentLines 5}}-1{{end}}0px;background-repeat:no-repeat, repeat-y;background-size:128px;padding-left:136px;{{.Topic.Css}}{{end}}">
|
||||||
<p class="hide_on_edit topic_content user_content" style="margin:0;padding:0;">{{.Topic.Content}}</p>
|
<p class="hide_on_edit topic_content user_content" style="margin:0;padding:0;">{{.Topic.Content}}</p>
|
||||||
<textarea name="topic_content" class="show_on_edit topic_content_input">{{.Topic.Content}}</textarea>
|
<textarea name="topic_content" class="show_on_edit topic_content_input">{{.Topic.Content}}</textarea>
|
||||||
|
@ -31,7 +31,7 @@
|
||||||
{{if .Topic.LikeCount}}<a class="username hide_on_micro" style="float: right;color:#505050;border-left:none;padding-left:5px;padding-right:5px;font-size:17px;">{{.Topic.LikeCount}}</a><a class="username hide_on_micro" style="color:#505050;float:right;opacity:0.85;margin-left:5px;" title="Like Count">😀</a>{{end}}
|
{{if .Topic.LikeCount}}<a class="username hide_on_micro" style="float: right;color:#505050;border-left:none;padding-left:5px;padding-right:5px;font-size:17px;">{{.Topic.LikeCount}}</a><a class="username hide_on_micro" style="color:#505050;float:right;opacity:0.85;margin-left:5px;" title="Like Count">😀</a>{{end}}
|
||||||
{{if .Topic.Tag}}<a class="username hide_on_micro" style="float:right;color:#505050;font-size:16px;">{{.Topic.Tag}}</a>{{else}}<a class="username hide_on_micro level">{{.Topic.Level}}</a><a class="username hide_on_micro" style="color:#505050;float:right;opacity:0.85;" title="Level">👑</a>{{end}}
|
{{if .Topic.Tag}}<a class="username hide_on_micro" style="float:right;color:#505050;font-size:16px;">{{.Topic.Tag}}</a>{{else}}<a class="username hide_on_micro level">{{.Topic.Level}}</a><a class="username hide_on_micro" style="color:#505050;float:right;opacity:0.85;" title="Level">👑</a>{{end}}
|
||||||
</div>
|
</div>
|
||||||
</div><br />
|
</div>
|
||||||
<div class="rowblock post_container" style="overflow: hidden;">{{range .ItemList}}{{if .ActionType}}
|
<div class="rowblock post_container" style="overflow: hidden;">{{range .ItemList}}{{if .ActionType}}
|
||||||
<div class="rowitem passive deletable_block editable_parent post_item" style="padding:14px;text-align:center;background-color:rgb(255,245,245);">
|
<div class="rowitem passive deletable_block editable_parent post_item" style="padding:14px;text-align:center;background-color:rgb(255,245,245);">
|
||||||
<span class="action_icon" style="font-size: 18px;padding-right: 5px;">{{.ActionIcon}}</span>
|
<span class="action_icon" style="font-size: 18px;padding-right: 5px;">{{.ActionIcon}}</span>
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/* AtomBB Cosmo Port. Copyright Azareal 2017 - 2018 */
|
/* AtomBB Cosmo Port. Copyright Azareal 2017 - 2018 */
|
||||||
/* I'm currently converting the CSS over. Don't use this yet! */
|
/* I'm currently converting the CSS over from one of my previous projects. Don't use this yet! */
|
||||||
|
|
||||||
* {
|
* {
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
|
@ -280,8 +280,7 @@ hr { color: silver; border: 1px solid silver; }
|
||||||
{
|
{
|
||||||
padding: 0px;
|
padding: 0px;
|
||||||
padding-top: 0px;
|
padding-top: 0px;
|
||||||
width: 100%;
|
margin-bottom: 16px;
|
||||||
margin-bottom: 8px;
|
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
word-wrap: break-word;
|
word-wrap: break-word;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/* AtomBB Cosmo Port. Copyright Azareal 2017 */
|
/* AtomBB Cosmo Port. Copyright Azareal 2017 */
|
||||||
/* I'm currently converting the CSS over. Don't use this yet! */
|
/* I'm currently converting the CSS over from one of my previous projects. Don't use this yet! */
|
||||||
|
|
||||||
* {
|
* {
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
|
@ -269,8 +269,7 @@ hr { color: silver; border: 1px solid silver; }
|
||||||
{
|
{
|
||||||
padding: 0px;
|
padding: 0px;
|
||||||
padding-top: 0px;
|
padding-top: 0px;
|
||||||
width: 100%;
|
margin-bottom: 16px;
|
||||||
margin-bottom: 8px;
|
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
word-wrap: break-word;
|
word-wrap: break-word;
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,7 +12,7 @@ body
|
||||||
background-size: cover;
|
background-size: cover;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Patch for Edge */
|
/* Patch for Edge, until they fix emojis in arial x.x */
|
||||||
@supports (-ms-ime-align:auto) {
|
@supports (-ms-ime-align:auto) {
|
||||||
.user_content { font-family: Segoe UI Emoji, arial; }
|
.user_content { font-family: Segoe UI Emoji, arial; }
|
||||||
}
|
}
|
||||||
|
@ -23,27 +23,27 @@ ul
|
||||||
{
|
{
|
||||||
padding-left: 0px;
|
padding-left: 0px;
|
||||||
padding-right: 0px;
|
padding-right: 0px;
|
||||||
height: 28px;
|
height: 36px;
|
||||||
list-style-type: none;
|
list-style-type: none;
|
||||||
border: 1px solid #ccc;
|
border: 1px solid #ccc;
|
||||||
background-color: white;
|
background-color: white;
|
||||||
|
margin-bottom: 12px;
|
||||||
}
|
}
|
||||||
li
|
li
|
||||||
{
|
{
|
||||||
height: 26px;
|
height: 35px;
|
||||||
padding-left: 10px;
|
padding-left: 10px;
|
||||||
padding-top: 5px;
|
padding-top: 8px;
|
||||||
padding-bottom: 5px;
|
padding-bottom: 8px;
|
||||||
font-weight: bold;
|
|
||||||
text-transform: uppercase;
|
|
||||||
}
|
}
|
||||||
li:hover { background: rgb(250,250,250); }
|
li:hover { background: rgb(250,250,250); }
|
||||||
li a
|
li a
|
||||||
{
|
{
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
color: #515151;
|
/*color: #515151;*/
|
||||||
|
color: black;
|
||||||
|
font-size: 17px;
|
||||||
}
|
}
|
||||||
/*li a:hover { color: #7a7a7a; }*/
|
|
||||||
.menu_left
|
.menu_left
|
||||||
{
|
{
|
||||||
float: left;
|
float: left;
|
||||||
|
@ -58,25 +58,24 @@ li a
|
||||||
}
|
}
|
||||||
|
|
||||||
.menu_alerts {
|
.menu_alerts {
|
||||||
padding-left: 7px;
|
/*padding-left: 7px;*/
|
||||||
|
font-size: 20px;
|
||||||
padding-top: 2px;
|
padding-top: 2px;
|
||||||
color: rgb(80,80,80);
|
color: rgb(80,80,80);
|
||||||
}
|
}
|
||||||
.menu_alerts .alert_counter {
|
.menu_alerts .alert_counter {
|
||||||
position:relative;
|
position: relative;
|
||||||
font-size: 9px;
|
font-size: 8px;
|
||||||
top: -24px;
|
top: -25px;
|
||||||
background-color: rgb(140,0,0);
|
background-color: rgb(190,0,0);
|
||||||
color: white;
|
color: white;
|
||||||
padding: 3px;
|
|
||||||
width: 14px;
|
width: 14px;
|
||||||
left: 10px;
|
left: 10px;
|
||||||
line-height: 8px;
|
line-height: 8px;
|
||||||
border-radius: 20px;
|
|
||||||
padding-top: 2.5px;
|
padding-top: 2.5px;
|
||||||
height: 14px;
|
height: 14px;
|
||||||
opacity: 0.8;
|
|
||||||
text-align: center;
|
text-align: center;
|
||||||
|
border: white solid 1px;
|
||||||
}
|
}
|
||||||
.menu_alerts .alert_counter:empty {
|
.menu_alerts .alert_counter:empty {
|
||||||
display: none;
|
display: none;
|
||||||
|
@ -100,7 +99,7 @@ li a
|
||||||
}
|
}
|
||||||
.selectedAlert .alertList {
|
.selectedAlert .alertList {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: 43px;
|
top: 51px;
|
||||||
display: block;
|
display: block;
|
||||||
background: white;
|
background: white;
|
||||||
font-size: 10px;
|
font-size: 10px;
|
||||||
|
@ -135,6 +134,8 @@ li a
|
||||||
height: 30px;
|
height: 30px;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
color: black;
|
color: black;
|
||||||
|
font-size: 10px;
|
||||||
|
font-weight: bold;
|
||||||
}
|
}
|
||||||
.alertItem .text.smaller {
|
.alertItem .text.smaller {
|
||||||
font-size: 9px;
|
font-size: 9px;
|
||||||
|
@ -197,7 +198,7 @@ li a
|
||||||
padding: 0px;
|
padding: 0px;
|
||||||
padding-top: 0px;
|
padding-top: 0px;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
margin-bottom: 8px;
|
margin-bottom: 12px;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
word-wrap: break-word;
|
word-wrap: break-word;
|
||||||
}
|
}
|
||||||
|
@ -208,7 +209,6 @@ li a
|
||||||
.colstack_grid {
|
.colstack_grid {
|
||||||
display: grid;
|
display: grid;
|
||||||
grid-template-columns: repeat(3, 1fr);
|
grid-template-columns: repeat(3, 1fr);
|
||||||
/*grid-gap: 15px;*/
|
|
||||||
grid-gap: 12px;
|
grid-gap: 12px;
|
||||||
margin-left: 5px;
|
margin-left: 5px;
|
||||||
}
|
}
|
||||||
|
@ -220,16 +220,12 @@ li a
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
}
|
}
|
||||||
.grid_stat, .grid_istat {
|
.grid_stat, .grid_istat {
|
||||||
/*padding-top: 15px;*/
|
|
||||||
text-align: center;
|
text-align: center;
|
||||||
/*padding-bottom: 15px;
|
|
||||||
font-size: 20px;*/
|
|
||||||
padding-top: 12px;
|
padding-top: 12px;
|
||||||
padding-bottom: 12px;
|
padding-bottom: 12px;
|
||||||
font-size: 16px;
|
font-size: 16px;
|
||||||
}
|
}
|
||||||
.grid_istat {
|
.grid_istat {
|
||||||
/*margin-bottom: 10px;*/
|
|
||||||
margin-bottom: 5px;
|
margin-bottom: 5px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -302,16 +298,14 @@ li a
|
||||||
width: 100%;
|
width: 100%;
|
||||||
background-color: white;
|
background-color: white;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Clearfix */
|
/* Clearfix */
|
||||||
.formrow:before, .formrow:after {
|
.formrow:before, .formrow:after {
|
||||||
content: " ";
|
content: " ";
|
||||||
display: table;
|
display: table;
|
||||||
}
|
}
|
||||||
.formrow:after { clear: both; }
|
.formrow:after { clear: both; }
|
||||||
.formrow:not(:last-child)
|
.formrow:not(:last-child) { border-bottom: 1px dotted #ccc; }
|
||||||
{
|
|
||||||
border-bottom: 1px dotted #ccc;
|
|
||||||
}
|
|
||||||
|
|
||||||
.formitem
|
.formitem
|
||||||
{
|
{
|
||||||
|
@ -322,18 +316,10 @@ li a
|
||||||
padding-bottom: 8px;
|
padding-bottom: 8px;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
}
|
}
|
||||||
.formitem:first-child
|
.formitem:first-child { font-weight: bold; }
|
||||||
{
|
.formitem:not(:last-child) { border-right: 1px dotted #ccc; }
|
||||||
font-weight: bold;
|
.formitem.invisible_border { border: none; }
|
||||||
}
|
|
||||||
.formitem:not(:last-child)
|
|
||||||
{
|
|
||||||
border-right: 1px dotted #ccc;
|
|
||||||
}
|
|
||||||
.formitem.invisible_border
|
|
||||||
{
|
|
||||||
border: none;
|
|
||||||
}
|
|
||||||
/* Mostly for textareas */
|
/* Mostly for textareas */
|
||||||
.formitem:only-child { width: 100%; }
|
.formitem:only-child { width: 100%; }
|
||||||
.formitem textarea
|
.formitem textarea
|
||||||
|
@ -414,10 +400,6 @@ button.username
|
||||||
border-width: 1px;
|
border-width: 1px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.mention {
|
|
||||||
font-weight: bold;
|
|
||||||
}
|
|
||||||
|
|
||||||
.tag-mini
|
.tag-mini
|
||||||
{
|
{
|
||||||
text-transform: none;
|
text-transform: none;
|
||||||
|
@ -434,10 +416,8 @@ button.username
|
||||||
font-size: 10px;
|
font-size: 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.show_on_edit
|
.mention { font-weight: bold; }
|
||||||
{
|
.show_on_edit { display: none; }
|
||||||
display: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
.alert
|
.alert
|
||||||
{
|
{
|
||||||
|
@ -589,37 +569,54 @@ button.username
|
||||||
|
|
||||||
/* Media Queries from Simple. Probably useless in Conflux */
|
/* Media Queries from Simple. Probably useless in Conflux */
|
||||||
@media (max-width: 880px) {
|
@media (max-width: 880px) {
|
||||||
li { height: 25px; font-size: 15px; padding-left: 7px; }
|
li {
|
||||||
ul { height: 26px; margin-top: 8px; }
|
height: 29px;
|
||||||
.menu_left { padding-right: 7px; }
|
font-size: 15px;
|
||||||
.menu_right { padding-right: 7px; }
|
padding-left: 9px;
|
||||||
|
padding-top: 6px;
|
||||||
|
padding-bottom: 6px;
|
||||||
|
}
|
||||||
|
ul {
|
||||||
|
height: 30px;
|
||||||
|
margin-top: 8px;
|
||||||
|
}
|
||||||
|
.menu_left { padding-right: 9px; }
|
||||||
|
.menu_right { padding-right: 9px; }
|
||||||
|
.menu_alerts {
|
||||||
|
padding-left: 7px;
|
||||||
|
padding-right: 7px;
|
||||||
|
font-size: 18px;
|
||||||
|
}
|
||||||
|
|
||||||
body { padding-left: 4px; padding-right: 4px; margin: 0px !important; width: 100% !important; height: 100% !important; overflow-x: hidden; }
|
body { padding-left: 4px; padding-right: 4px; margin: 0px !important; width: 100% !important; height: 100% !important; overflow-x: hidden; }
|
||||||
.container { width: auto; }
|
.container { width: auto; }
|
||||||
.selectedAlert .alertList { top: 33px; right: 4px; }
|
.selectedAlert .alertList { top: 37px; right: 4px; }
|
||||||
}
|
}
|
||||||
|
|
||||||
@media (max-width: 810px) {
|
@media (max-width: 810px) {
|
||||||
li
|
|
||||||
{
|
|
||||||
font-weight: normal;
|
|
||||||
text-transform: none;
|
|
||||||
}
|
|
||||||
.rowitem { text-transform: none; }
|
.rowitem { text-transform: none; }
|
||||||
}
|
}
|
||||||
|
|
||||||
@media (max-width: 620px) {
|
@media (max-width: 680px) {
|
||||||
li
|
li {
|
||||||
{
|
|
||||||
padding-left: 5px;
|
padding-left: 5px;
|
||||||
padding-top: 2px;
|
padding-top: 3px;
|
||||||
padding-bottom: 2px;
|
padding-bottom: 2px;
|
||||||
height: 23px;
|
height: 25px;
|
||||||
}
|
}
|
||||||
ul { height: 24px; }
|
li a { font-size: 14px; }
|
||||||
.menu_left { padding-right: 5px; }
|
ul { height: 26px; }
|
||||||
.menu_right { padding-right: 5px; }
|
.menu_left { padding-right: 7px; }
|
||||||
|
.menu_right { padding-right: 7px; }
|
||||||
.menu_create_topic { display: none; }
|
.menu_create_topic { display: none; }
|
||||||
.menu_alerts { padding-left: 4px; padding-right: 4px; }
|
|
||||||
|
.menu_alerts {
|
||||||
|
padding-left: 4px;
|
||||||
|
padding-right: 4px;
|
||||||
|
font-size: 16px;
|
||||||
|
padding-top: 1px;
|
||||||
|
}
|
||||||
|
.selectedAlert .alertList { top: 33px; }
|
||||||
|
|
||||||
.hide_on_mobile { display: none; }
|
.hide_on_mobile { display: none; }
|
||||||
.prev_button, .next_button { top: auto;bottom: 5px; }
|
.prev_button, .next_button { top: auto;bottom: 5px; }
|
||||||
|
@ -628,12 +625,9 @@ button.username
|
||||||
}
|
}
|
||||||
|
|
||||||
@media (max-width: 470px) {
|
@media (max-width: 470px) {
|
||||||
.menu_overview { display: none; }
|
.menu_overview, .menu_profile, .hide_on_micro { display: none; }
|
||||||
.menu_profile { display: none; }
|
.post_container { overflow: visible !important; }
|
||||||
.hide_on_micro { display: none; }
|
|
||||||
.post_container {
|
|
||||||
overflow: visible !important;
|
|
||||||
}
|
|
||||||
.post_item {
|
.post_item {
|
||||||
background-position: 0px 2px !important;
|
background-position: 0px 2px !important;
|
||||||
background-size: 64px 64px !important;
|
background-size: 64px 64px !important;
|
||||||
|
@ -661,9 +655,7 @@ button.username
|
||||||
width: 60px;
|
width: 60px;
|
||||||
font-size: 15px;
|
font-size: 15px;
|
||||||
}
|
}
|
||||||
.userinfo {
|
.userinfo { width: 70px; }
|
||||||
width: 70px;
|
|
||||||
}
|
|
||||||
.userinfo .avatar_item {
|
.userinfo .avatar_item {
|
||||||
background-size: 64px;
|
background-size: 64px;
|
||||||
width: 64px;
|
width: 64px;
|
||||||
|
@ -680,3 +672,8 @@ button.username
|
||||||
|
|
||||||
.container { width: 100% !important; }
|
.container { width: 100% !important; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@media (max-width: 330px) {
|
||||||
|
li { padding-left: 6px; }
|
||||||
|
.menu_left { padding-right: 6px; }
|
||||||
|
}
|
||||||
|
|
|
@ -10,7 +10,7 @@ body
|
||||||
padding-bottom: 8px;
|
padding-bottom: 8px;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Patch for Edge */
|
/* Patch for Edge, until they fix emojis in arial x.x */
|
||||||
@supports (-ms-ime-align:auto) {
|
@supports (-ms-ime-align:auto) {
|
||||||
.user_content { font-family: Segoe UI Emoji, arial; }
|
.user_content { font-family: Segoe UI Emoji, arial; }
|
||||||
}
|
}
|
||||||
|
@ -19,34 +19,34 @@ ul
|
||||||
{
|
{
|
||||||
padding-left: 0px;
|
padding-left: 0px;
|
||||||
padding-right: 0px;
|
padding-right: 0px;
|
||||||
height: 28px;
|
height: 36px;
|
||||||
list-style-type: none;
|
list-style-type: none;
|
||||||
border: 1px solid #ccc;
|
border: 1px solid #ccc;
|
||||||
background-color: white;
|
background-color: white;
|
||||||
|
margin-bottom: 12px;
|
||||||
}
|
}
|
||||||
li
|
li
|
||||||
{
|
{
|
||||||
height: 26px;
|
height: 35px;
|
||||||
padding-left: 10px;
|
padding-left: 10px;
|
||||||
padding-top: 5px;
|
padding-top: 8px;
|
||||||
padding-bottom: 5px;
|
padding-bottom: 8px;
|
||||||
font-weight: bold;
|
|
||||||
text-transform: uppercase;
|
|
||||||
}
|
}
|
||||||
li:hover { background: rgb(250,250,250); }
|
li:hover { background: rgb(250,250,250); }
|
||||||
li a
|
li a
|
||||||
{
|
{
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
color: #515151;
|
/*color: #515151;*/
|
||||||
|
color: black;
|
||||||
|
font-size: 17px;
|
||||||
}
|
}
|
||||||
/*li a:hover { color: #7a7a7a; }*/
|
|
||||||
.menu_left
|
.menu_left
|
||||||
{
|
{
|
||||||
float: left;
|
float: left;
|
||||||
border-right: 1px solid #ccc;
|
border-right: 1px solid #ccc;
|
||||||
padding-right: 10px;
|
padding-right: 10px;
|
||||||
font-family: cursive;
|
font-family: cursive;
|
||||||
padding-top: 2px;
|
padding-top: 4px;
|
||||||
}
|
}
|
||||||
.menu_right
|
.menu_right
|
||||||
{
|
{
|
||||||
|
@ -56,25 +56,26 @@ li a
|
||||||
}
|
}
|
||||||
|
|
||||||
.menu_alerts {
|
.menu_alerts {
|
||||||
padding-left: 7px;
|
/*padding-left: 7px;*/
|
||||||
|
font-size: 20px;
|
||||||
padding-top: 2px;
|
padding-top: 2px;
|
||||||
color: rgb(80,80,80);
|
color: rgb(80,80,80);
|
||||||
}
|
}
|
||||||
.menu_alerts .alert_counter {
|
.menu_alerts .alert_counter {
|
||||||
position:relative;
|
position: relative;
|
||||||
font-size: 9px;
|
font-family: arial;
|
||||||
top: -24px;
|
font-size: 8px;
|
||||||
background-color: rgb(140,0,0);
|
top: -25px;
|
||||||
|
background-color: rgb(190,0,0);
|
||||||
color: white;
|
color: white;
|
||||||
padding: 3px;
|
|
||||||
width: 14px;
|
width: 14px;
|
||||||
left: 10px;
|
left: 10px;
|
||||||
line-height: 8px;
|
line-height: 8px;
|
||||||
border-radius: 20px;
|
|
||||||
padding-top: 2.5px;
|
padding-top: 2.5px;
|
||||||
height: 14px;
|
height: 14px;
|
||||||
opacity: 0.8;
|
|
||||||
text-align: center;
|
text-align: center;
|
||||||
|
|
||||||
|
border: white solid 1px;
|
||||||
}
|
}
|
||||||
.menu_alerts .alert_counter:empty {
|
.menu_alerts .alert_counter:empty {
|
||||||
display: none;
|
display: none;
|
||||||
|
@ -94,7 +95,7 @@ li a
|
||||||
}
|
}
|
||||||
.selectedAlert .alertList {
|
.selectedAlert .alertList {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: 43px;
|
top: 51px;
|
||||||
display: block;
|
display: block;
|
||||||
background: white;
|
background: white;
|
||||||
font-size: 10px;
|
font-size: 10px;
|
||||||
|
@ -128,6 +129,10 @@ li a
|
||||||
width: calc(100% - 20px);
|
width: calc(100% - 20px);
|
||||||
height: 30px;
|
height: 30px;
|
||||||
}
|
}
|
||||||
|
.alertItem .text {
|
||||||
|
font-size: 10px;
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
|
||||||
.container
|
.container
|
||||||
{
|
{
|
||||||
|
@ -186,7 +191,7 @@ li a
|
||||||
padding: 0px;
|
padding: 0px;
|
||||||
padding-top: 0px;
|
padding-top: 0px;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
margin-bottom: 8px;
|
margin-bottom: 12px;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
word-wrap: break-word;
|
word-wrap: break-word;
|
||||||
}
|
}
|
||||||
|
@ -233,7 +238,7 @@ li a
|
||||||
width: 100%;
|
width: 100%;
|
||||||
padding-left: 8px;
|
padding-left: 8px;
|
||||||
padding-right: 8px;
|
padding-right: 8px;
|
||||||
padding-top: 17px;
|
padding-top: 12px;
|
||||||
padding-bottom: 12px;
|
padding-bottom: 12px;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
text-transform: uppercase;
|
text-transform: uppercase;
|
||||||
|
@ -254,6 +259,7 @@ li a
|
||||||
color: black;
|
color: black;
|
||||||
}
|
}
|
||||||
.rowitem a:hover { color: silver; }
|
.rowitem a:hover { color: silver; }
|
||||||
|
.top_post { margin-bottom: 16px; }
|
||||||
.opthead { display: none; }
|
.opthead { display: none; }
|
||||||
|
|
||||||
.col_left
|
.col_left
|
||||||
|
@ -484,17 +490,31 @@ button.username
|
||||||
.next_button { right: 14px; }
|
.next_button { right: 14px; }
|
||||||
|
|
||||||
@media (max-width: 880px) {
|
@media (max-width: 880px) {
|
||||||
li { height: 25px; font-size: 15px; padding-left: 7px; }
|
li {
|
||||||
ul { height: 26px; margin-top: 8px; }
|
height: 29px;
|
||||||
.menu_left { padding-right: 7px; }
|
font-size: 15px;
|
||||||
.menu_right { padding-right: 7px; }
|
padding-left: 9px;
|
||||||
|
padding-top: 2px;
|
||||||
|
padding-bottom: 6px;
|
||||||
|
}
|
||||||
|
ul {
|
||||||
|
height: 30px;
|
||||||
|
margin-top: 8px;
|
||||||
|
}
|
||||||
|
.menu_left { padding-right: 9px; padding-top: 2px; }
|
||||||
|
.menu_right { padding-right: 9px; }
|
||||||
|
.menu_alerts {
|
||||||
|
padding-left: 7px;
|
||||||
|
padding-right: 7px;
|
||||||
|
font-size: 18px;
|
||||||
|
}
|
||||||
|
|
||||||
body { padding-left: 4px; padding-right: 4px; margin: 0px !important; width: 100% !important; height: 100% !important; overflow-x: hidden; }
|
body { padding-left: 4px; padding-right: 4px; margin: 0px !important; width: 100% !important; height: 100% !important; overflow-x: hidden; }
|
||||||
.container { width: auto; }
|
.container { width: auto; }
|
||||||
.selectedAlert .alertList { top: 33px; right: 4px; }
|
.selectedAlert .alertList { top: 37px; right: 4px; }
|
||||||
}
|
}
|
||||||
|
|
||||||
@media (max-width: 810px) {
|
@media (max-width: 810px) {
|
||||||
li { font-weight: normal; text-transform: none; }
|
|
||||||
.rowitem { text-transform: none; }
|
.rowitem { text-transform: none; }
|
||||||
/*.rowhead { font-family: arial; }
|
/*.rowhead { font-family: arial; }
|
||||||
.menu_left { font-family: arial; }*/
|
.menu_left { font-family: arial; }*/
|
||||||
|
@ -502,19 +522,30 @@ button.username
|
||||||
.level { font-size: 17px; }
|
.level { font-size: 17px; }
|
||||||
}
|
}
|
||||||
|
|
||||||
@media (max-width: 620px) {
|
@media (max-width: 700px) {
|
||||||
li
|
li {
|
||||||
{
|
|
||||||
padding-left: 5px;
|
padding-left: 5px;
|
||||||
padding-top: 2px;
|
padding-top: 3px;
|
||||||
padding-bottom: 2px;
|
padding-bottom: 2px;
|
||||||
height: 23px;
|
height: 25px;
|
||||||
}
|
}
|
||||||
ul { height: 24px; }
|
li a { font-size: 14px; }
|
||||||
.menu_left { padding-right: 5px; }
|
ul { height: 26px; }
|
||||||
|
.menu_left { padding-right: 5px; padding-top: 1px; }
|
||||||
.menu_right { padding-right: 5px; }
|
.menu_right { padding-right: 5px; }
|
||||||
.menu_create_topic { display: none;}
|
.menu_create_topic { display: none;}
|
||||||
.menu_alerts { padding-left: 4px; padding-right: 4px; }
|
|
||||||
|
.menu_alerts {
|
||||||
|
padding-left: 4px;
|
||||||
|
padding-right: 4px;
|
||||||
|
font-size: 16px;
|
||||||
|
padding-top: 1px;
|
||||||
|
}
|
||||||
|
.menu_alerts .alert_counter {
|
||||||
|
top: -23px;
|
||||||
|
left: 8px;
|
||||||
|
}
|
||||||
|
.selectedAlert .alertList { top: 33px; }
|
||||||
|
|
||||||
.hide_on_mobile { display: none; }
|
.hide_on_mobile { display: none; }
|
||||||
.prev_button, .next_button { top: auto; bottom: 5px; }
|
.prev_button, .next_button { top: auto; bottom: 5px; }
|
||||||
|
@ -562,3 +593,9 @@ button.username
|
||||||
}
|
}
|
||||||
.container { width: 100% !important; }
|
.container { width: 100% !important; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@media (max-width: 330px) {
|
||||||
|
li { padding-left: 6px; }
|
||||||
|
.menu_left { padding-right: 6px; }
|
||||||
|
.menu_alerts { border-left: none; }
|
||||||
|
}
|
||||||
|
|
|
@ -10,7 +10,7 @@ body
|
||||||
padding-bottom: 8px;
|
padding-bottom: 8px;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Patch for Edge */
|
/* Patch for Edge, until they fix emojis in arial x.x */
|
||||||
@supports (-ms-ime-align:auto) {
|
@supports (-ms-ime-align:auto) {
|
||||||
.user_content { font-family: Segoe UI Emoji, arial; }
|
.user_content { font-family: Segoe UI Emoji, arial; }
|
||||||
}
|
}
|
||||||
|
@ -21,27 +21,27 @@ ul
|
||||||
{
|
{
|
||||||
padding-left: 0px;
|
padding-left: 0px;
|
||||||
padding-right: 0px;
|
padding-right: 0px;
|
||||||
height: 28px;
|
height: 36px;
|
||||||
list-style-type: none;
|
list-style-type: none;
|
||||||
border: 1px solid #ccc;
|
border: 1px solid #ccc;
|
||||||
background-color: white;
|
background-color: white;
|
||||||
|
margin-bottom: 12px;
|
||||||
}
|
}
|
||||||
li
|
li
|
||||||
{
|
{
|
||||||
height: 26px;
|
height: 35px;
|
||||||
padding-left: 10px;
|
padding-left: 10px;
|
||||||
padding-top: 5px;
|
padding-top: 8px;
|
||||||
padding-bottom: 5px;
|
padding-bottom: 8px;
|
||||||
font-weight: bold;
|
|
||||||
text-transform: uppercase;
|
|
||||||
}
|
}
|
||||||
li:hover { background: rgb(250,250,250); }
|
li:hover { background: rgb(250,250,250); }
|
||||||
li a
|
li a
|
||||||
{
|
{
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
color: #515151;
|
/*color: #515151;*/
|
||||||
|
color: black;
|
||||||
|
font-size: 17px;
|
||||||
}
|
}
|
||||||
/*li a:hover { color: #7a7a7a; }*/
|
|
||||||
.menu_left
|
.menu_left
|
||||||
{
|
{
|
||||||
float: left;
|
float: left;
|
||||||
|
@ -56,25 +56,24 @@ li a
|
||||||
}
|
}
|
||||||
|
|
||||||
.menu_alerts {
|
.menu_alerts {
|
||||||
padding-left: 7px;
|
/*padding-left: 7px;*/
|
||||||
|
font-size: 20px;
|
||||||
padding-top: 2px;
|
padding-top: 2px;
|
||||||
color: rgb(80,80,80);
|
color: rgb(80,80,80);
|
||||||
}
|
}
|
||||||
.menu_alerts .alert_counter {
|
.menu_alerts .alert_counter {
|
||||||
position:relative;
|
position: relative;
|
||||||
font-size: 9px;
|
font-size: 8px;
|
||||||
top: -24px;
|
top: -25px;
|
||||||
background-color: rgb(140,0,0);
|
background-color: rgb(190,0,0);
|
||||||
color: white;
|
color: white;
|
||||||
padding: 3px;
|
|
||||||
width: 14px;
|
width: 14px;
|
||||||
left: 10px;
|
left: 10px;
|
||||||
line-height: 8px;
|
line-height: 8px;
|
||||||
border-radius: 20px;
|
|
||||||
padding-top: 2.5px;
|
padding-top: 2.5px;
|
||||||
height: 14px;
|
height: 14px;
|
||||||
opacity: 0.8;
|
|
||||||
text-align: center;
|
text-align: center;
|
||||||
|
border: white solid 1px;
|
||||||
}
|
}
|
||||||
.menu_alerts .alert_counter:empty {
|
.menu_alerts .alert_counter:empty {
|
||||||
display: none;
|
display: none;
|
||||||
|
@ -94,7 +93,7 @@ li a
|
||||||
}
|
}
|
||||||
.selectedAlert .alertList {
|
.selectedAlert .alertList {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: 43px;
|
top: 51px;
|
||||||
display: block;
|
display: block;
|
||||||
background: white;
|
background: white;
|
||||||
font-size: 10px;
|
font-size: 10px;
|
||||||
|
@ -128,6 +127,10 @@ li a
|
||||||
width: calc(100% - 20px);
|
width: calc(100% - 20px);
|
||||||
height: 30px;
|
height: 30px;
|
||||||
}
|
}
|
||||||
|
.alertItem .text {
|
||||||
|
font-size: 10px;
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
|
||||||
.container
|
.container
|
||||||
{
|
{
|
||||||
|
@ -186,7 +189,7 @@ li a
|
||||||
padding: 0px;
|
padding: 0px;
|
||||||
padding-top: 0px;
|
padding-top: 0px;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
margin-bottom: 8px;
|
margin-bottom: 12px;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
word-wrap: break-word;
|
word-wrap: break-word;
|
||||||
}
|
}
|
||||||
|
@ -253,6 +256,7 @@ li a
|
||||||
color: black;
|
color: black;
|
||||||
}
|
}
|
||||||
.rowitem a:hover { color: silver; }
|
.rowitem a:hover { color: silver; }
|
||||||
|
.top_post { margin-bottom: 12px; }
|
||||||
.opthead { display: none; }
|
.opthead { display: none; }
|
||||||
|
|
||||||
.col_left
|
.col_left
|
||||||
|
@ -274,16 +278,8 @@ li a
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
text-transform: uppercase;
|
text-transform: uppercase;
|
||||||
}
|
}
|
||||||
.colitem.passive
|
.colitem.passive { font-weight: normal; text-transform: none; }
|
||||||
{
|
.colitem a { text-decoration: none; color: black; }
|
||||||
font-weight: normal;
|
|
||||||
text-transform: none;
|
|
||||||
}
|
|
||||||
.colitem a
|
|
||||||
{
|
|
||||||
text-decoration: none;
|
|
||||||
color: black;
|
|
||||||
}
|
|
||||||
.colitem a:hover { color: silver; }
|
.colitem a:hover { color: silver; }
|
||||||
|
|
||||||
.formrow
|
.formrow
|
||||||
|
@ -298,11 +294,7 @@ li a
|
||||||
display: table;
|
display: table;
|
||||||
}
|
}
|
||||||
.formrow:after { clear: both; }
|
.formrow:after { clear: both; }
|
||||||
|
.formrow:not(:last-child) { border-bottom: 1px dotted #ccc; }
|
||||||
.formrow:not(:last-child)
|
|
||||||
{
|
|
||||||
border-bottom: 1px dotted #ccc;
|
|
||||||
}
|
|
||||||
|
|
||||||
.formitem
|
.formitem
|
||||||
{
|
{
|
||||||
|
@ -368,11 +360,7 @@ button
|
||||||
border-width: 1px;
|
border-width: 1px;
|
||||||
font-size: 15px;
|
font-size: 15px;
|
||||||
}
|
}
|
||||||
button.username
|
button.username { position: relative; top: -0.25px; }
|
||||||
{
|
|
||||||
position: relative;
|
|
||||||
top: -0.25px;
|
|
||||||
}
|
|
||||||
.username.level { color: #303030; }
|
.username.level { color: #303030; }
|
||||||
.username.real_username { color: #404040; font-size: 17px; }
|
.username.real_username { color: #404040; font-size: 17px; }
|
||||||
.username.real_username:hover { color: black; }
|
.username.real_username:hover { color: black; }
|
||||||
|
@ -480,33 +468,61 @@ button.username
|
||||||
.next_button { right: 14px; }
|
.next_button { right: 14px; }
|
||||||
|
|
||||||
@media (max-width: 880px) {
|
@media (max-width: 880px) {
|
||||||
li { height: 25px; font-size: 15px; padding-left: 7px; }
|
li {
|
||||||
ul { height: 26px; margin-top: 8px; }
|
height: 29px;
|
||||||
.menu_left { padding-right: 7px; }
|
font-size: 15px;
|
||||||
.menu_right { padding-right: 7px; }
|
padding-left: 9px;
|
||||||
body { padding-left: 4px; padding-right: 4px; margin: 0px !important; width: 100% !important; height: 100% !important; overflow-x: hidden; }
|
padding-top: 6px;
|
||||||
|
padding-bottom: 6px;
|
||||||
|
}
|
||||||
|
ul {
|
||||||
|
height: 30px;
|
||||||
|
margin-top: 8px;
|
||||||
|
}
|
||||||
|
.menu_left { padding-right: 9px; }
|
||||||
|
.menu_right { padding-right: 9px; }
|
||||||
|
.menu_alerts {
|
||||||
|
padding-left: 7px;
|
||||||
|
padding-right: 7px;
|
||||||
|
font-size: 18px;
|
||||||
|
}
|
||||||
|
|
||||||
|
body {
|
||||||
|
padding-left: 4px;
|
||||||
|
padding-right: 4px;
|
||||||
|
margin: 0px !important;
|
||||||
|
width: 100% !important;
|
||||||
|
height: 100% !important;
|
||||||
|
overflow-x: hidden;
|
||||||
|
}
|
||||||
.container { width: auto; }
|
.container { width: auto; }
|
||||||
.selectedAlert .alertList { top: 33px; right: 4px; }
|
.selectedAlert .alertList { top: 37px; right: 4px; }
|
||||||
}
|
}
|
||||||
|
|
||||||
@media (max-width: 810px) {
|
@media (max-width: 810px) {
|
||||||
li { font-weight: normal; text-transform: none; }
|
|
||||||
.rowitem { text-transform: none; }
|
.rowitem { text-transform: none; }
|
||||||
}
|
}
|
||||||
|
|
||||||
@media (max-width: 620px) {
|
@media (max-width: 680px) {
|
||||||
li
|
li {
|
||||||
{
|
|
||||||
padding-left: 5px;
|
padding-left: 5px;
|
||||||
padding-top: 2px;
|
padding-top: 3px;
|
||||||
padding-bottom: 2px;
|
padding-bottom: 2px;
|
||||||
height: 23px;
|
height: 25px;
|
||||||
}
|
}
|
||||||
ul { height: 24px; }
|
li a { font-size: 14px; }
|
||||||
.menu_left { padding-right: 5px; }
|
ul { height: 26px; }
|
||||||
.menu_right { padding-right: 5px; }
|
.menu_left { padding-right: 7px; }
|
||||||
|
.menu_right { padding-right: 7px; }
|
||||||
.menu_create_topic { display: none;}
|
.menu_create_topic { display: none;}
|
||||||
.menu_alerts { padding-left: 4px; padding-right: 4px; }
|
|
||||||
|
.menu_alerts {
|
||||||
|
padding-left: 4px;
|
||||||
|
padding-right: 4px;
|
||||||
|
font-size: 16px;
|
||||||
|
padding-top: 1px;
|
||||||
|
}
|
||||||
|
.selectedAlert .alertList { top: 33px; }
|
||||||
|
|
||||||
.hide_on_mobile { display: none !important; }
|
.hide_on_mobile { display: none !important; }
|
||||||
.prev_button, .next_button { top: auto; bottom: 5px; }
|
.prev_button, .next_button { top: auto; bottom: 5px; }
|
||||||
|
@ -515,12 +531,9 @@ button.username
|
||||||
}
|
}
|
||||||
|
|
||||||
@media (max-width: 470px) {
|
@media (max-width: 470px) {
|
||||||
.menu_overview { display: none; }
|
.menu_overview, .menu_profile { display: none; }
|
||||||
.menu_profile { display: none; }
|
|
||||||
.hide_on_micro { display: none !important; }
|
.hide_on_micro { display: none !important; }
|
||||||
.post_container {
|
.post_container { overflow: visible !important; }
|
||||||
overflow: visible !important;
|
|
||||||
}
|
|
||||||
.post_item {
|
.post_item {
|
||||||
background-position: 0px 2px !important;
|
background-position: 0px 2px !important;
|
||||||
background-size: 64px 64px !important;
|
background-size: 64px 64px !important;
|
||||||
|
@ -551,3 +564,8 @@ button.username
|
||||||
}
|
}
|
||||||
.container { width: 100% !important; }
|
.container { width: 100% !important; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@media (max-width: 330px) {
|
||||||
|
li { padding-left: 6px; }
|
||||||
|
.menu_left { padding-right: 6px; }
|
||||||
|
}
|
||||||
|
|
81
utils.go
81
utils.go
|
@ -1,15 +1,17 @@
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import "fmt"
|
import (
|
||||||
import "time"
|
"fmt"
|
||||||
import "os"
|
"time"
|
||||||
import "math"
|
"os"
|
||||||
import "strings"
|
"math"
|
||||||
import "unicode"
|
"strings"
|
||||||
import "strconv"
|
"unicode"
|
||||||
import "encoding/base64"
|
"strconv"
|
||||||
import "crypto/rand"
|
"encoding/base64"
|
||||||
import "net/smtp"
|
"crypto/rand"
|
||||||
|
"net/smtp"
|
||||||
|
)
|
||||||
|
|
||||||
type Version struct
|
type Version struct
|
||||||
{
|
{
|
||||||
|
@ -60,36 +62,23 @@ func relative_time(in string) (string, error) {
|
||||||
case months > 11:
|
case months > 11:
|
||||||
//return t.Format("Mon Jan 2 2006"), err
|
//return t.Format("Mon Jan 2 2006"), err
|
||||||
return t.Format("Jan 2 2006"), err
|
return t.Format("Jan 2 2006"), err
|
||||||
case months > 1:
|
case months > 1: return fmt.Sprintf("%d months ago", months), err
|
||||||
return fmt.Sprintf("%d months ago", months), err
|
case months == 1: return "a month ago", err
|
||||||
case months == 1:
|
case weeks > 1: return fmt.Sprintf("%d weeks ago", weeks), err
|
||||||
return "a month ago", err
|
case int(hours / 24) == 7: return "a week ago", err
|
||||||
case weeks > 1:
|
case int(hours / 24) == 1: return "1 day ago", err
|
||||||
return fmt.Sprintf("%d weeks ago", weeks), err
|
case int(hours / 24) > 1: return fmt.Sprintf("%d days ago", int(hours / 24)), err
|
||||||
case int(hours / 24) == 7:
|
case seconds <= 1: return "a moment ago", err
|
||||||
return "a week ago", err
|
case seconds < 60: return fmt.Sprintf("%d seconds ago", int(seconds)), err
|
||||||
case int(hours / 24) == 1:
|
case seconds < 120: return "a minute ago", err
|
||||||
return "1 day ago", err
|
case seconds < 3600: return fmt.Sprintf("%d minutes ago", int(seconds / 60)), err
|
||||||
case int(hours / 24) > 1:
|
case seconds < 7200: return "an hour ago", err
|
||||||
return fmt.Sprintf("%d days ago", int(hours / 24)), err
|
default: return fmt.Sprintf("%d hours ago", int(seconds / 60 / 60)), err
|
||||||
case seconds <= 1:
|
|
||||||
return "a moment ago", err
|
|
||||||
case seconds < 60:
|
|
||||||
return fmt.Sprintf("%d seconds ago", int(seconds)), err
|
|
||||||
case seconds < 120:
|
|
||||||
return "a minute ago", err
|
|
||||||
case seconds < 3600:
|
|
||||||
return fmt.Sprintf("%d minutes ago", int(seconds / 60)), err
|
|
||||||
case seconds < 7200:
|
|
||||||
return "an hour ago", err
|
|
||||||
default:
|
|
||||||
return fmt.Sprintf("%d hours ago", int(seconds / 60 / 60)), err
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func convert_byte_unit(bytes float64) (float64,string) {
|
func convert_byte_unit(bytes float64) (float64,string) {
|
||||||
switch
|
switch {
|
||||||
{
|
|
||||||
case bytes >= float64(terabyte): return bytes / float64(terabyte), "TB"
|
case bytes >= float64(terabyte): return bytes / float64(terabyte), "TB"
|
||||||
case bytes >= float64(gigabyte): return bytes / float64(gigabyte), "GB"
|
case bytes >= float64(gigabyte): return bytes / float64(gigabyte), "GB"
|
||||||
case bytes >= float64(megabyte): return bytes / float64(megabyte), "MB"
|
case bytes >= float64(megabyte): return bytes / float64(megabyte), "MB"
|
||||||
|
@ -113,6 +102,26 @@ func convert_byte_in_unit(bytes float64,unit string) (count float64) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func convert_unit(num int) (int,string) {
|
||||||
|
switch {
|
||||||
|
case num >= 1000000000000: return 0, "∞"
|
||||||
|
case num >= 1000000000: return num / 1000000000, "B"
|
||||||
|
case num >= 1000000: return num / 1000000, "M"
|
||||||
|
case num >= 1000: return num / 1000, "K"
|
||||||
|
default: return num, ""
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func convert_friendly_unit(num int) (int,string) {
|
||||||
|
switch {
|
||||||
|
case num >= 1000000000000: return 0, " zillion"
|
||||||
|
case num >= 1000000000: return num / 1000000000, " billion"
|
||||||
|
case num >= 1000000: return num / 1000000, " million"
|
||||||
|
case num >= 1000: return num / 1000, " thousand"
|
||||||
|
default: return num, ""
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func SendEmail(email string, subject string, msg string) (res bool) {
|
func SendEmail(email string, subject string, msg string) (res bool) {
|
||||||
// This hook is useful for plugin_sendmail or for testing tools. Possibly to hook it into some sort of mail server?
|
// This hook is useful for plugin_sendmail or for testing tools. Possibly to hook it into some sort of mail server?
|
||||||
if vhooks["email_send_intercept"] != nil {
|
if vhooks["email_send_intercept"] != nil {
|
||||||
|
|
|
@ -129,7 +129,7 @@ func ws_page_responses(ws_user *WS_User, page []byte) {
|
||||||
switch(string(page)) {
|
switch(string(page)) {
|
||||||
case "/panel/":
|
case "/panel/":
|
||||||
//fmt.Println("/panel/ WS Route")
|
//fmt.Println("/panel/ WS Route")
|
||||||
w, err := ws_user.conn.NextWriter(websocket.TextMessage)
|
/*w, err := ws_user.conn.NextWriter(websocket.TextMessage)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
//fmt.Println(err.Error())
|
//fmt.Println(err.Error())
|
||||||
return
|
return
|
||||||
|
@ -143,7 +143,7 @@ func ws_page_responses(ws_user *WS_User, page []byte) {
|
||||||
w.Write([]byte("set #dash-totonline " + strconv.Itoa(totonline) + " online\r"))
|
w.Write([]byte("set #dash-totonline " + strconv.Itoa(totonline) + " online\r"))
|
||||||
w.Write([]byte("set #dash-gonline " + strconv.Itoa(gonline) + " guests online\r"))
|
w.Write([]byte("set #dash-gonline " + strconv.Itoa(gonline) + " guests online\r"))
|
||||||
w.Write([]byte("set #dash-uonline " + strconv.Itoa(uonline) + " users online\r"))
|
w.Write([]byte("set #dash-uonline " + strconv.Itoa(uonline) + " users online\r"))
|
||||||
w.Close()
|
w.Close()*/
|
||||||
|
|
||||||
// Listen for changes and inform the admins...
|
// Listen for changes and inform the admins...
|
||||||
admin_stats_mutex.Lock()
|
admin_stats_mutex.Lock()
|
||||||
|
@ -176,12 +176,15 @@ func admin_stats_ticker() {
|
||||||
var last_cpu_perc int = -1
|
var last_cpu_perc int = -1
|
||||||
var last_available_ram int64 = -1
|
var last_available_ram int64 = -1
|
||||||
var no_stat_updates bool = false
|
var no_stat_updates bool = false
|
||||||
|
var no_ram_updates bool = false
|
||||||
|
|
||||||
var onlineColour, onlineGuestsColour, onlineUsersColour, cpustr, cpuColour, ramstr, ramColour string
|
var onlineColour, onlineGuestsColour, onlineUsersColour, cpustr, cpuColour, ramstr, ramColour string
|
||||||
var cpuerr, ramerr error
|
var cpuerr, ramerr error
|
||||||
var memres *mem.VirtualMemoryStat
|
var memres *mem.VirtualMemoryStat
|
||||||
var cpu_perc []float64
|
var cpu_perc []float64
|
||||||
|
|
||||||
|
var totunit, uunit, gunit string
|
||||||
|
|
||||||
AdminStatLoop:
|
AdminStatLoop:
|
||||||
for {
|
for {
|
||||||
//fmt.Println("tick tock")
|
//fmt.Println("tick tock")
|
||||||
|
@ -200,7 +203,8 @@ AdminStatLoop:
|
||||||
|
|
||||||
// It's far more likely that the CPU Usage will change than the other stats, so we'll optimise them seperately...
|
// It's far more likely that the CPU Usage will change than the other stats, so we'll optimise them seperately...
|
||||||
no_stat_updates = (uonline == last_uonline && gonline == last_gonline && totonline == last_totonline)
|
no_stat_updates = (uonline == last_uonline && gonline == last_gonline && totonline == last_totonline)
|
||||||
if no_stat_updates && int(cpu_perc[0]) == last_cpu_perc && last_available_ram == int64(memres.Available) {
|
no_ram_updates = (last_available_ram == int64(memres.Available))
|
||||||
|
if int(cpu_perc[0]) == last_cpu_perc && no_stat_updates && no_ram_updates {
|
||||||
time.Sleep(time.Second)
|
time.Sleep(time.Second)
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
@ -229,6 +233,10 @@ AdminStatLoop:
|
||||||
} else {
|
} else {
|
||||||
onlineUsersColour = "stat_red"
|
onlineUsersColour = "stat_red"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
totonline, totunit = convert_friendly_unit(totonline)
|
||||||
|
uonline, uunit = convert_friendly_unit(uonline)
|
||||||
|
gonline, gunit = convert_friendly_unit(gonline)
|
||||||
}
|
}
|
||||||
|
|
||||||
if cpuerr != nil {
|
if cpuerr != nil {
|
||||||
|
@ -245,6 +253,7 @@ AdminStatLoop:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if !no_ram_updates {
|
||||||
if ramerr != nil {
|
if ramerr != nil {
|
||||||
ramstr = "Unknown"
|
ramstr = "Unknown"
|
||||||
} else {
|
} else {
|
||||||
|
@ -274,6 +283,7 @@ AdminStatLoop:
|
||||||
ramColour = "stat_red"
|
ramColour = "stat_red"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
admin_stats_mutex.RLock()
|
admin_stats_mutex.RLock()
|
||||||
watchers := admin_stats_watchers
|
watchers := admin_stats_watchers
|
||||||
|
@ -290,20 +300,22 @@ AdminStatLoop:
|
||||||
}
|
}
|
||||||
|
|
||||||
if !no_stat_updates {
|
if !no_stat_updates {
|
||||||
w.Write([]byte("set #dash-totonline " + strconv.Itoa(totonline) + " online\r"))
|
w.Write([]byte("set #dash-totonline " + strconv.Itoa(totonline) + totunit + " online\r"))
|
||||||
w.Write([]byte("set #dash-gonline " + strconv.Itoa(gonline) + " guests online\r"))
|
w.Write([]byte("set #dash-gonline " + strconv.Itoa(gonline) + gunit + " guests online\r"))
|
||||||
w.Write([]byte("set #dash-uonline " + strconv.Itoa(uonline) + " users online\r"))
|
w.Write([]byte("set #dash-uonline " + strconv.Itoa(uonline) + uunit + " users online\r"))
|
||||||
|
|
||||||
w.Write([]byte("set-class #dash-totonline grid_stat " + onlineColour + "\r"))
|
w.Write([]byte("set-class #dash-totonline grid_item grid_stat " + onlineColour + "\r"))
|
||||||
w.Write([]byte("set-class #dash-gonline grid_stat " + onlineGuestsColour + "\r"))
|
w.Write([]byte("set-class #dash-gonline grid_item grid_stat " + onlineGuestsColour + "\r"))
|
||||||
w.Write([]byte("set-class #dash-uonline grid_stat " + onlineUsersColour + "\r"))
|
w.Write([]byte("set-class #dash-uonline grid_item grid_stat " + onlineUsersColour + "\r"))
|
||||||
}
|
}
|
||||||
|
|
||||||
w.Write([]byte("set #dash-cpu CPU: " + cpustr + "%\r"))
|
w.Write([]byte("set #dash-cpu CPU: " + cpustr + "%\r"))
|
||||||
w.Write([]byte("set-class #dash-cpu grid_istat " + cpuColour + "\r"))
|
w.Write([]byte("set-class #dash-cpu grid_item grid_istat " + cpuColour + "\r"))
|
||||||
|
|
||||||
|
if !no_ram_updates {
|
||||||
w.Write([]byte("set #dash-ram RAM: " + ramstr + "\r"))
|
w.Write([]byte("set #dash-ram RAM: " + ramstr + "\r"))
|
||||||
w.Write([]byte("set-class #dash-ram grid_istat " + ramColour + "\r"))
|
w.Write([]byte("set-class #dash-ram grid_item grid_istat " + ramColour + "\r"))
|
||||||
|
}
|
||||||
|
|
||||||
w.Close()
|
w.Close()
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue