diff --git a/files/assets/css/coffee.css b/files/assets/css/coffee.css index 5f47fb2c3..583ff39a7 100644 --- a/files/assets/css/coffee.css +++ b/files/assets/css/coffee.css @@ -1,37 +1,18 @@ @charset "UTF-8"; -/* latin-ext */ @font-face { font-family: 'Lato'; font-style: normal; font-weight: 400; - src: url(../fonts/S6uyw4BMUTPHjxAwXjeu.woff2) format('woff2'); - unicode-range: U+0100-024F, U+0259, U+1E00-1EFF, U+2020, U+20A0-20AB, U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF; - } - /* latin */ - @font-face { - font-family: 'Lato'; - font-style: normal; - font-weight: 400; - src: url(../fonts/S6uyw4BMUTPHjx4wXg.woff2) format('woff2'); - unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; - } - /* latin-ext */ - @font-face { + src: url('/assets/fonts/Lato-Regular.woff2') format('woff2'); +} + +@font-face { font-family: 'Lato'; font-style: normal; font-weight: 700; - src: url(../fonts/S6u9w4BMUTPHh6UVSwaPGR_p.woff2) format('woff2'); - unicode-range: U+0100-024F, U+0259, U+1E00-1EFF, U+2020, U+20A0-20AB, U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF; - } - /* latin */ - @font-face { - font-family: 'Lato'; - font-style: normal; - font-weight: 700; - src: url(../fonts/S6u9w4BMUTPHh6UVSwiPGQ.woff2) format('woff2'); - unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; - } + src: url('/assets/fonts/Lato-Bold.woff2') format('woff2'); +} :root { --primary: #433434; diff --git a/files/assets/css/tron.css b/files/assets/css/tron.css index 88730169e..7254a103e 100644 --- a/files/assets/css/tron.css +++ b/files/assets/css/tron.css @@ -1,149 +1,25 @@ @charset "UTF-8"; -/* cyrillic-ext */ @font-face { font-family: 'Roboto Mono'; font-style: normal; font-weight: 400; - src: url(../fonts/L0xTDF4xlVMF-BfR8bXMIhJHg45mwgGEFl0_3vrtSM1J-gEPT5Ese6hmHSV0mf0h.woff2) format('woff2'); - unicode-range: U+0460-052F, U+1C80-1C88, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F; - } - /* cyrillic */ - @font-face { - font-family: 'Roboto Mono'; - font-style: normal; - font-weight: 400; - src: url(../fonts/L0xTDF4xlVMF-BfR8bXMIhJHg45mwgGEFl0_3vrtSM1J-gEPT5Ese6hmHSx0mf0h.woff2) format('woff2'); - unicode-range: U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; - } - /* greek */ - @font-face { - font-family: 'Roboto Mono'; - font-style: normal; - font-weight: 400; - src: url(../fonts/L0xTDF4xlVMF-BfR8bXMIhJHg45mwgGEFl0_3vrtSM1J-gEPT5Ese6hmHSt0mf0h.woff2) format('woff2'); - unicode-range: U+0370-03FF; - } - /* vietnamese */ - @font-face { - font-family: 'Roboto Mono'; - font-style: normal; - font-weight: 400; - src: url(../fonts/L0xTDF4xlVMF-BfR8bXMIhJHg45mwgGEFl0_3vrtSM1J-gEPT5Ese6hmHSd0mf0h.woff2) format('woff2'); - unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+1EA0-1EF9, U+20AB; - } - /* latin-ext */ - @font-face { - font-family: 'Roboto Mono'; - font-style: normal; - font-weight: 400; - src: url(../fonts/L0xTDF4xlVMF-BfR8bXMIhJHg45mwgGEFl0_3vrtSM1J-gEPT5Ese6hmHSZ0mf0h.woff2) format('woff2'); - unicode-range: U+0100-024F, U+0259, U+1E00-1EFF, U+2020, U+20A0-20AB, U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF; - } - /* latin */ - @font-face { - font-family: 'Roboto Mono'; - font-style: normal; - font-weight: 400; - src: url(../fonts/L0xTDF4xlVMF-BfR8bXMIhJHg45mwgGEFl0_3vrtSM1J-gEPT5Ese6hmHSh0mQ.woff2) format('woff2'); - unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; - } - /* cyrillic-ext */ - @font-face { + src: url('/assets/fonts/RobotoMono-Regular.woff2') format('woff2'); +} + +@font-face { font-family: 'Roboto Mono'; font-style: normal; font-weight: 600; - src: url(../fonts/L0xTDF4xlVMF-BfR8bXMIhJHg45mwgGEFl0_3vrtSM1J-gEPT5Ese6hmHSV0mf0h.woff2) format('woff2'); - unicode-range: U+0460-052F, U+1C80-1C88, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F; - } - /* cyrillic */ - @font-face { - font-family: 'Roboto Mono'; - font-style: normal; - font-weight: 600; - src: url(../fonts/L0xTDF4xlVMF-BfR8bXMIhJHg45mwgGEFl0_3vrtSM1J-gEPT5Ese6hmHSx0mf0h.woff2) format('woff2'); - unicode-range: U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; - } - /* greek */ - @font-face { - font-family: 'Roboto Mono'; - font-style: normal; - font-weight: 600; - src: url(../fonts/L0xTDF4xlVMF-BfR8bXMIhJHg45mwgGEFl0_3vrtSM1J-gEPT5Ese6hmHSt0mf0h.woff2) format('woff2'); - unicode-range: U+0370-03FF; - } - /* vietnamese */ - @font-face { - font-family: 'Roboto Mono'; - font-style: normal; - font-weight: 600; - src: url(../fonts/L0xTDF4xlVMF-BfR8bXMIhJHg45mwgGEFl0_3vrtSM1J-gEPT5Ese6hmHSd0mf0h.woff2) format('woff2'); - unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+1EA0-1EF9, U+20AB; - } - /* latin-ext */ - @font-face { - font-family: 'Roboto Mono'; - font-style: normal; - font-weight: 600; - src: url(../fonts/L0xTDF4xlVMF-BfR8bXMIhJHg45mwgGEFl0_3vrtSM1J-gEPT5Ese6hmHSZ0mf0h.woff2) format('woff2'); - unicode-range: U+0100-024F, U+0259, U+1E00-1EFF, U+2020, U+20A0-20AB, U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF; - } - /* latin */ - @font-face { - font-family: 'Roboto Mono'; - font-style: normal; - font-weight: 600; - src: url(../fonts/L0xTDF4xlVMF-BfR8bXMIhJHg45mwgGEFl0_3vrtSM1J-gEPT5Ese6hmHSh0mQ.woff2) format('woff2'); - unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; - } - /* cyrillic-ext */ - @font-face { + src: url('/assets/fonts/RobotoMono-SemiBold.woff2') format('woff2'); +} + +@font-face { font-family: 'Roboto Mono'; font-style: normal; font-weight: 700; - src: url(../fonts/L0xTDF4xlVMF-BfR8bXMIhJHg45mwgGEFl0_3vrtSM1J-gEPT5Ese6hmHSV0mf0h.woff2) format('woff2'); - unicode-range: U+0460-052F, U+1C80-1C88, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F; - } - /* cyrillic */ - @font-face { - font-family: 'Roboto Mono'; - font-style: normal; - font-weight: 700; - src: url(../fonts/L0xTDF4xlVMF-BfR8bXMIhJHg45mwgGEFl0_3vrtSM1J-gEPT5Ese6hmHSx0mf0h.woff2) format('woff2'); - unicode-range: U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; - } - /* greek */ - @font-face { - font-family: 'Roboto Mono'; - font-style: normal; - font-weight: 700; - src: url(../fonts/L0xTDF4xlVMF-BfR8bXMIhJHg45mwgGEFl0_3vrtSM1J-gEPT5Ese6hmHSt0mf0h.woff2) format('woff2'); - unicode-range: U+0370-03FF; - } - /* vietnamese */ - @font-face { - font-family: 'Roboto Mono'; - font-style: normal; - font-weight: 700; - src: url(../fonts/L0xTDF4xlVMF-BfR8bXMIhJHg45mwgGEFl0_3vrtSM1J-gEPT5Ese6hmHSd0mf0h.woff2) format('woff2'); - unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+1EA0-1EF9, U+20AB; - } - /* latin-ext */ - @font-face { - font-family: 'Roboto Mono'; - font-style: normal; - font-weight: 700; - src: url(../fonts/L0xTDF4xlVMF-BfR8bXMIhJHg45mwgGEFl0_3vrtSM1J-gEPT5Ese6hmHSZ0mf0h.woff2) format('woff2'); - unicode-range: U+0100-024F, U+0259, U+1E00-1EFF, U+2020, U+20A0-20AB, U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF; - } - /* latin */ - @font-face { - font-family: 'Roboto Mono'; - font-style: normal; - font-weight: 700; - src: url(../fonts/L0xTDF4xlVMF-BfR8bXMIhJHg45mwgGEFl0_3vrtSM1J-gEPT5Ese6hmHSh0mQ.woff2) format('woff2'); - unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; - } + src: url('/assets/fonts/RobotoMono-Bold.woff2') format('woff2'); +} :root { --dark: #00001f; diff --git a/files/assets/fonts/KFOlCnqEu92Fr1MmEU9fABc4EsA.woff2 b/files/assets/fonts/KFOlCnqEu92Fr1MmEU9fABc4EsA.woff2 deleted file mode 100644 index f1bfb055d..000000000 Binary files a/files/assets/fonts/KFOlCnqEu92Fr1MmEU9fABc4EsA.woff2 and /dev/null differ diff --git a/files/assets/fonts/KFOlCnqEu92Fr1MmEU9fBBc4.woff2 b/files/assets/fonts/KFOlCnqEu92Fr1MmEU9fBBc4.woff2 deleted file mode 100644 index ce795fa8b..000000000 Binary files a/files/assets/fonts/KFOlCnqEu92Fr1MmEU9fBBc4.woff2 and /dev/null differ diff --git a/files/assets/fonts/KFOlCnqEu92Fr1MmEU9fBxc4EsA.woff2 b/files/assets/fonts/KFOlCnqEu92Fr1MmEU9fBxc4EsA.woff2 deleted file mode 100644 index ccd963354..000000000 Binary files a/files/assets/fonts/KFOlCnqEu92Fr1MmEU9fBxc4EsA.woff2 and /dev/null differ diff --git a/files/assets/fonts/KFOlCnqEu92Fr1MmEU9fCBc4EsA.woff2 b/files/assets/fonts/KFOlCnqEu92Fr1MmEU9fCBc4EsA.woff2 deleted file mode 100644 index 3f093dd9c..000000000 Binary files a/files/assets/fonts/KFOlCnqEu92Fr1MmEU9fCBc4EsA.woff2 and /dev/null differ diff --git a/files/assets/fonts/KFOlCnqEu92Fr1MmEU9fCRc4EsA.woff2 b/files/assets/fonts/KFOlCnqEu92Fr1MmEU9fCRc4EsA.woff2 deleted file mode 100644 index e6f942703..000000000 Binary files a/files/assets/fonts/KFOlCnqEu92Fr1MmEU9fCRc4EsA.woff2 and /dev/null differ diff --git a/files/assets/fonts/KFOlCnqEu92Fr1MmEU9fChc4EsA.woff2 b/files/assets/fonts/KFOlCnqEu92Fr1MmEU9fChc4EsA.woff2 deleted file mode 100644 index 7ef9a9261..000000000 Binary files a/files/assets/fonts/KFOlCnqEu92Fr1MmEU9fChc4EsA.woff2 and /dev/null differ diff --git a/files/assets/fonts/KFOlCnqEu92Fr1MmEU9fCxc4EsA.woff2 b/files/assets/fonts/KFOlCnqEu92Fr1MmEU9fCxc4EsA.woff2 deleted file mode 100644 index 01c0cc84d..000000000 Binary files a/files/assets/fonts/KFOlCnqEu92Fr1MmEU9fCxc4EsA.woff2 and /dev/null differ diff --git a/files/assets/fonts/KFOmCnqEu92Fr1Mu4WxKOzY.woff2 b/files/assets/fonts/KFOmCnqEu92Fr1Mu4WxKOzY.woff2 deleted file mode 100644 index fa0d664fe..000000000 Binary files a/files/assets/fonts/KFOmCnqEu92Fr1Mu4WxKOzY.woff2 and /dev/null differ diff --git a/files/assets/fonts/KFOmCnqEu92Fr1Mu4mxK.woff2 b/files/assets/fonts/KFOmCnqEu92Fr1Mu4mxK.woff2 deleted file mode 100644 index ebe1795f8..000000000 Binary files a/files/assets/fonts/KFOmCnqEu92Fr1Mu4mxK.woff2 and /dev/null differ diff --git a/files/assets/fonts/KFOmCnqEu92Fr1Mu5mxKOzY.woff2 b/files/assets/fonts/KFOmCnqEu92Fr1Mu5mxKOzY.woff2 deleted file mode 100644 index f1b8ed7ca..000000000 Binary files a/files/assets/fonts/KFOmCnqEu92Fr1Mu5mxKOzY.woff2 and /dev/null differ diff --git a/files/assets/fonts/KFOmCnqEu92Fr1Mu72xKOzY.woff2 b/files/assets/fonts/KFOmCnqEu92Fr1Mu72xKOzY.woff2 deleted file mode 100644 index c6d7d0619..000000000 Binary files a/files/assets/fonts/KFOmCnqEu92Fr1Mu72xKOzY.woff2 and /dev/null differ diff --git a/files/assets/fonts/KFOmCnqEu92Fr1Mu7GxKOzY.woff2 b/files/assets/fonts/KFOmCnqEu92Fr1Mu7GxKOzY.woff2 deleted file mode 100644 index e2f7d2751..000000000 Binary files a/files/assets/fonts/KFOmCnqEu92Fr1Mu7GxKOzY.woff2 and /dev/null differ diff --git a/files/assets/fonts/KFOmCnqEu92Fr1Mu7WxKOzY.woff2 b/files/assets/fonts/KFOmCnqEu92Fr1Mu7WxKOzY.woff2 deleted file mode 100644 index d5ca3ce24..000000000 Binary files a/files/assets/fonts/KFOmCnqEu92Fr1Mu7WxKOzY.woff2 and /dev/null differ diff --git a/files/assets/fonts/KFOmCnqEu92Fr1Mu7mxKOzY.woff2 b/files/assets/fonts/KFOmCnqEu92Fr1Mu7mxKOzY.woff2 deleted file mode 100644 index f8b68e3ac..000000000 Binary files a/files/assets/fonts/KFOmCnqEu92Fr1Mu7mxKOzY.woff2 and /dev/null differ diff --git a/files/assets/fonts/L0xTDF4xlVMF-BfR8bXMIhJHg45mwgGEFl0_3vrtSM1J-gEPT5Ese6hmHSV0mf0h.woff2 b/files/assets/fonts/L0xTDF4xlVMF-BfR8bXMIhJHg45mwgGEFl0_3vrtSM1J-gEPT5Ese6hmHSV0mf0h.woff2 deleted file mode 100644 index 6915f2550..000000000 Binary files a/files/assets/fonts/L0xTDF4xlVMF-BfR8bXMIhJHg45mwgGEFl0_3vrtSM1J-gEPT5Ese6hmHSV0mf0h.woff2 and /dev/null differ diff --git a/files/assets/fonts/L0xTDF4xlVMF-BfR8bXMIhJHg45mwgGEFl0_3vrtSM1J-gEPT5Ese6hmHSZ0mf0h.woff2 b/files/assets/fonts/L0xTDF4xlVMF-BfR8bXMIhJHg45mwgGEFl0_3vrtSM1J-gEPT5Ese6hmHSZ0mf0h.woff2 deleted file mode 100644 index 3fd3d351a..000000000 Binary files a/files/assets/fonts/L0xTDF4xlVMF-BfR8bXMIhJHg45mwgGEFl0_3vrtSM1J-gEPT5Ese6hmHSZ0mf0h.woff2 and /dev/null differ diff --git a/files/assets/fonts/L0xTDF4xlVMF-BfR8bXMIhJHg45mwgGEFl0_3vrtSM1J-gEPT5Ese6hmHSd0mf0h.woff2 b/files/assets/fonts/L0xTDF4xlVMF-BfR8bXMIhJHg45mwgGEFl0_3vrtSM1J-gEPT5Ese6hmHSd0mf0h.woff2 deleted file mode 100644 index a3a84c7a3..000000000 Binary files a/files/assets/fonts/L0xTDF4xlVMF-BfR8bXMIhJHg45mwgGEFl0_3vrtSM1J-gEPT5Ese6hmHSd0mf0h.woff2 and /dev/null differ diff --git a/files/assets/fonts/L0xTDF4xlVMF-BfR8bXMIhJHg45mwgGEFl0_3vrtSM1J-gEPT5Ese6hmHSh0mQ.woff2 b/files/assets/fonts/L0xTDF4xlVMF-BfR8bXMIhJHg45mwgGEFl0_3vrtSM1J-gEPT5Ese6hmHSh0mQ.woff2 deleted file mode 100644 index b562906c1..000000000 Binary files a/files/assets/fonts/L0xTDF4xlVMF-BfR8bXMIhJHg45mwgGEFl0_3vrtSM1J-gEPT5Ese6hmHSh0mQ.woff2 and /dev/null differ diff --git a/files/assets/fonts/L0xTDF4xlVMF-BfR8bXMIhJHg45mwgGEFl0_3vrtSM1J-gEPT5Ese6hmHSt0mf0h.woff2 b/files/assets/fonts/L0xTDF4xlVMF-BfR8bXMIhJHg45mwgGEFl0_3vrtSM1J-gEPT5Ese6hmHSt0mf0h.woff2 deleted file mode 100644 index 33d62376a..000000000 Binary files a/files/assets/fonts/L0xTDF4xlVMF-BfR8bXMIhJHg45mwgGEFl0_3vrtSM1J-gEPT5Ese6hmHSt0mf0h.woff2 and /dev/null differ diff --git a/files/assets/fonts/L0xTDF4xlVMF-BfR8bXMIhJHg45mwgGEFl0_3vrtSM1J-gEPT5Ese6hmHSx0mf0h.woff2 b/files/assets/fonts/L0xTDF4xlVMF-BfR8bXMIhJHg45mwgGEFl0_3vrtSM1J-gEPT5Ese6hmHSx0mf0h.woff2 deleted file mode 100644 index c55acbc7c..000000000 Binary files a/files/assets/fonts/L0xTDF4xlVMF-BfR8bXMIhJHg45mwgGEFl0_3vrtSM1J-gEPT5Ese6hmHSx0mf0h.woff2 and /dev/null differ diff --git a/files/assets/fonts/Lato-Bold.woff2 b/files/assets/fonts/Lato-Bold.woff2 new file mode 100644 index 000000000..2cc580d6f Binary files /dev/null and b/files/assets/fonts/Lato-Bold.woff2 differ diff --git a/files/assets/fonts/Lato-OFL.txt b/files/assets/fonts/Lato-OFL.txt new file mode 100644 index 000000000..98383e3d8 --- /dev/null +++ b/files/assets/fonts/Lato-OFL.txt @@ -0,0 +1,93 @@ +Copyright (c) 2010-2014 by tyPoland Lukasz Dziedzic (team@latofonts.com) with Reserved Font Name "Lato" + +This Font Software is licensed under the SIL Open Font License, Version 1.1. +This license is copied below, and is also available with a FAQ at: +http://scripts.sil.org/OFL + + +----------------------------------------------------------- +SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007 +----------------------------------------------------------- + +PREAMBLE +The goals of the Open Font License (OFL) are to stimulate worldwide +development of collaborative font projects, to support the font creation +efforts of academic and linguistic communities, and to provide a free and +open framework in which fonts may be shared and improved in partnership +with others. + +The OFL allows the licensed fonts to be used, studied, modified and +redistributed freely as long as they are not sold by themselves. The +fonts, including any derivative works, can be bundled, embedded, +redistributed and/or sold with any software provided that any reserved +names are not used by derivative works. The fonts and derivatives, +however, cannot be released under any other type of license. The +requirement for fonts to remain under this license does not apply +to any document created using the fonts or their derivatives. + +DEFINITIONS +"Font Software" refers to the set of files released by the Copyright +Holder(s) under this license and clearly marked as such. This may +include source files, build scripts and documentation. + +"Reserved Font Name" refers to any names specified as such after the +copyright statement(s). + +"Original Version" refers to the collection of Font Software components as +distributed by the Copyright Holder(s). + +"Modified Version" refers to any derivative made by adding to, deleting, +or substituting -- in part or in whole -- any of the components of the +Original Version, by changing formats or by porting the Font Software to a +new environment. + +"Author" refers to any designer, engineer, programmer, technical +writer or other person who contributed to the Font Software. + +PERMISSION & CONDITIONS +Permission is hereby granted, free of charge, to any person obtaining +a copy of the Font Software, to use, study, copy, merge, embed, modify, +redistribute, and sell modified and unmodified copies of the Font +Software, subject to the following conditions: + +1) Neither the Font Software nor any of its individual components, +in Original or Modified Versions, may be sold by itself. + +2) Original or Modified Versions of the Font Software may be bundled, +redistributed and/or sold with any software, provided that each copy +contains the above copyright notice and this license. These can be +included either as stand-alone text files, human-readable headers or +in the appropriate machine-readable metadata fields within text or +binary files as long as those fields can be easily viewed by the user. + +3) No Modified Version of the Font Software may use the Reserved Font +Name(s) unless explicit written permission is granted by the corresponding +Copyright Holder. This restriction only applies to the primary font name as +presented to the users. + +4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font +Software shall not be used to promote, endorse or advertise any +Modified Version, except to acknowledge the contribution(s) of the +Copyright Holder(s) and the Author(s) or with their explicit written +permission. + +5) The Font Software, modified or unmodified, in part or in whole, +must be distributed entirely under this license, and must not be +distributed under any other license. The requirement for fonts to +remain under this license does not apply to any document created +using the Font Software. + +TERMINATION +This license becomes null and void if any of the above conditions are +not met. + +DISCLAIMER +THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT +OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE +COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL +DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM +OTHER DEALINGS IN THE FONT SOFTWARE. diff --git a/files/assets/fonts/Lato-Regular.woff2 b/files/assets/fonts/Lato-Regular.woff2 new file mode 100644 index 000000000..c9c4a6779 Binary files /dev/null and b/files/assets/fonts/Lato-Regular.woff2 differ diff --git a/files/assets/fonts/RobotoMono-Bold.woff2 b/files/assets/fonts/RobotoMono-Bold.woff2 new file mode 100644 index 000000000..a4149a29e Binary files /dev/null and b/files/assets/fonts/RobotoMono-Bold.woff2 differ diff --git a/files/assets/fonts/RobotoMono-LICENSE.txt b/files/assets/fonts/RobotoMono-LICENSE.txt new file mode 100644 index 000000000..d64569567 --- /dev/null +++ b/files/assets/fonts/RobotoMono-LICENSE.txt @@ -0,0 +1,202 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/files/assets/fonts/RobotoMono-Regular.woff2 b/files/assets/fonts/RobotoMono-Regular.woff2 new file mode 100644 index 000000000..7b3c7ec49 Binary files /dev/null and b/files/assets/fonts/RobotoMono-Regular.woff2 differ diff --git a/files/assets/fonts/RobotoMono-SemiBold.woff2 b/files/assets/fonts/RobotoMono-SemiBold.woff2 new file mode 100644 index 000000000..60d46bb33 Binary files /dev/null and b/files/assets/fonts/RobotoMono-SemiBold.woff2 differ diff --git a/files/assets/fonts/S6u9w4BMUTPHh6UVSwaPGR_p.woff2 b/files/assets/fonts/S6u9w4BMUTPHh6UVSwaPGR_p.woff2 deleted file mode 100644 index c5d944d29..000000000 Binary files a/files/assets/fonts/S6u9w4BMUTPHh6UVSwaPGR_p.woff2 and /dev/null differ diff --git a/files/assets/fonts/S6u9w4BMUTPHh6UVSwiPGQ.woff2 b/files/assets/fonts/S6u9w4BMUTPHh6UVSwiPGQ.woff2 deleted file mode 100644 index f8c37ecde..000000000 Binary files a/files/assets/fonts/S6u9w4BMUTPHh6UVSwiPGQ.woff2 and /dev/null differ diff --git a/files/assets/fonts/S6uyw4BMUTPHjx4wXg.woff2 b/files/assets/fonts/S6uyw4BMUTPHjx4wXg.woff2 deleted file mode 100644 index 6904b6649..000000000 Binary files a/files/assets/fonts/S6uyw4BMUTPHjx4wXg.woff2 and /dev/null differ diff --git a/files/assets/fonts/S6uyw4BMUTPHjxAwXjeu.woff2 b/files/assets/fonts/S6uyw4BMUTPHjxAwXjeu.woff2 deleted file mode 100644 index 0a0ee5eae..000000000 Binary files a/files/assets/fonts/S6uyw4BMUTPHjxAwXjeu.woff2 and /dev/null differ diff --git a/files/assets/fonts/memvYaGs126MiZpBA-UvWbX2vVnXBbObj2OVTS-muw.woff2 b/files/assets/fonts/memvYaGs126MiZpBA-UvWbX2vVnXBbObj2OVTS-muw.woff2 deleted file mode 100644 index 851d828eb..000000000 Binary files a/files/assets/fonts/memvYaGs126MiZpBA-UvWbX2vVnXBbObj2OVTS-muw.woff2 and /dev/null differ diff --git a/files/assets/fonts/memvYaGs126MiZpBA-UvWbX2vVnXBbObj2OVTS2mu1aB.woff2 b/files/assets/fonts/memvYaGs126MiZpBA-UvWbX2vVnXBbObj2OVTS2mu1aB.woff2 deleted file mode 100644 index 2768263d6..000000000 Binary files a/files/assets/fonts/memvYaGs126MiZpBA-UvWbX2vVnXBbObj2OVTS2mu1aB.woff2 and /dev/null differ diff --git a/files/assets/fonts/memvYaGs126MiZpBA-UvWbX2vVnXBbObj2OVTSCmu1aB.woff2 b/files/assets/fonts/memvYaGs126MiZpBA-UvWbX2vVnXBbObj2OVTSCmu1aB.woff2 deleted file mode 100644 index d095304c2..000000000 Binary files a/files/assets/fonts/memvYaGs126MiZpBA-UvWbX2vVnXBbObj2OVTSCmu1aB.woff2 and /dev/null differ diff --git a/files/assets/fonts/memvYaGs126MiZpBA-UvWbX2vVnXBbObj2OVTSGmu1aB.woff2 b/files/assets/fonts/memvYaGs126MiZpBA-UvWbX2vVnXBbObj2OVTSGmu1aB.woff2 deleted file mode 100644 index 31bfbe367..000000000 Binary files a/files/assets/fonts/memvYaGs126MiZpBA-UvWbX2vVnXBbObj2OVTSGmu1aB.woff2 and /dev/null differ diff --git a/files/assets/fonts/memvYaGs126MiZpBA-UvWbX2vVnXBbObj2OVTSKmu1aB.woff2 b/files/assets/fonts/memvYaGs126MiZpBA-UvWbX2vVnXBbObj2OVTSKmu1aB.woff2 deleted file mode 100644 index 8f3dd2964..000000000 Binary files a/files/assets/fonts/memvYaGs126MiZpBA-UvWbX2vVnXBbObj2OVTSKmu1aB.woff2 and /dev/null differ diff --git a/files/assets/fonts/memvYaGs126MiZpBA-UvWbX2vVnXBbObj2OVTSOmu1aB.woff2 b/files/assets/fonts/memvYaGs126MiZpBA-UvWbX2vVnXBbObj2OVTSOmu1aB.woff2 deleted file mode 100644 index 81d6c4d7c..000000000 Binary files a/files/assets/fonts/memvYaGs126MiZpBA-UvWbX2vVnXBbObj2OVTSOmu1aB.woff2 and /dev/null differ diff --git a/files/assets/fonts/memvYaGs126MiZpBA-UvWbX2vVnXBbObj2OVTSumu1aB.woff2 b/files/assets/fonts/memvYaGs126MiZpBA-UvWbX2vVnXBbObj2OVTSumu1aB.woff2 deleted file mode 100644 index bae23a0b4..000000000 Binary files a/files/assets/fonts/memvYaGs126MiZpBA-UvWbX2vVnXBbObj2OVTSumu1aB.woff2 and /dev/null differ diff --git a/files/assets/fonts/memvYaGs126MiZpBA-UvWbX2vVnXBbObj2OVTSymu1aB.woff2 b/files/assets/fonts/memvYaGs126MiZpBA-UvWbX2vVnXBbObj2OVTSymu1aB.woff2 deleted file mode 100644 index 6a3435290..000000000 Binary files a/files/assets/fonts/memvYaGs126MiZpBA-UvWbX2vVnXBbObj2OVTSymu1aB.woff2 and /dev/null differ diff --git a/files/assets/images/classic1.webp b/files/assets/images/classic1.webp deleted file mode 100644 index 5c3ab2525..000000000 Binary files a/files/assets/images/classic1.webp and /dev/null differ diff --git a/files/assets/images/classic2.webp b/files/assets/images/classic2.webp deleted file mode 100644 index d778b76ba..000000000 Binary files a/files/assets/images/classic2.webp and /dev/null differ diff --git a/files/assets/images/fireflies.webp b/files/assets/images/fireflies.webp deleted file mode 100644 index 3f9ce4381..000000000 Binary files a/files/assets/images/fireflies.webp and /dev/null differ diff --git a/files/assets/images/fly-sprite.webp b/files/assets/images/fly-sprite.webp deleted file mode 100644 index d7c0b8691..000000000 Binary files a/files/assets/images/fly-sprite.webp and /dev/null differ diff --git a/files/assets/images/spider-sprite.webp b/files/assets/images/spider-sprite.webp deleted file mode 100644 index 19e08ee82..000000000 Binary files a/files/assets/images/spider-sprite.webp and /dev/null differ diff --git a/files/assets/js/award_modal.js b/files/assets/js/award_modal.js index dbe168cf8..cf6a6dfc7 100644 --- a/files/assets/js/award_modal.js +++ b/files/assets/js/award_modal.js @@ -27,41 +27,10 @@ function pick(kind, canbuy1, canbuy2) { } function buy(mb) { - const kind = document.getElementById('kind').value; - const xhr = new XMLHttpRequest(); - url = `/buy/${kind}` - if (mb) url += "?mb=true" - xhr.open("POST", url); - xhr.setRequestHeader('xhr', 'xhr'); - var form = new FormData() - form.append("formkey", formkey()); - - if(typeof data === 'object' && data !== null) { - for(let k of Object.keys(data)) { - form.append(k, data[k]); - } - } - - - form.append("formkey", formkey()); - xhr.onload = function() { - let data - try {data = JSON.parse(xhr.response)} - catch(e) {console.log(e)} - if (xhr.status >= 200 && xhr.status < 300 && data && data["message"]) { - document.getElementById('toast-post-success-text2').innerText = data["message"]; - bootstrap.Toast.getOrCreateInstance(document.getElementById('toast-post-success2')).show(); - document.getElementById('giveaward').disabled=false; - let owned = document.getElementById(`${kind}-owned`) - let ownednum = Number(owned.textContent); - owned.textContent = ownednum + 1 - } else { - document.getElementById('toast-post-error-text').innerText = "Error, please try again later." - if (data && data["error"]) document.getElementById('toast-post-error-text2').innerText = data["error"]; - bootstrap.Toast.getOrCreateInstance(document.getElementById('toast-post-error2')).show(); - } - }; - - xhr.send(form); - + postToast(null, `/buy/${kind}${mb ? '?mb=true' : ''}`, 'POST', null, (xhr) => { + document.getElementById('giveaward').disabled = false; + let owned = document.getElementById(`${kind}-owned`); + const ownednum = Number(owned.textContent); + owned.textContent = ownednum + 1; + }); } diff --git a/files/assets/js/comments.js b/files/assets/js/comments.js index 4e7c0a903..a03a8035b 100644 --- a/files/assets/js/comments.js +++ b/files/assets/js/comments.js @@ -67,7 +67,12 @@ function commentsAddUnreadIndicator(commentIds) { } if (commentOnly.classList.contains("unread")) return; commentOnly.classList.add("unread"); - const commentUserInfo = document.getElementById(`comment-${element}`)?.querySelector(".comment-user-info"); + const commentElement = document.getElementById(`comment-${element}`); + if (!commentElement) { + console.warn(`Couldn't find comment (ID ${element}) in page while attempting to add an unread indicator.`); + return; + } + const commentUserInfo = commentElement.querySelector(".comment-user-info"); if (!commentUserInfo) { console.warn(`Couldn't find comment user info (comment ID ${element}) in page while attempting to add an unread indicator.`); return; diff --git a/files/assets/js/comments_v.js b/files/assets/js/comments_v.js index 5e11bdcbe..935d7f46a 100644 --- a/files/assets/js/comments_v.js +++ b/files/assets/js/comments_v.js @@ -1,44 +1,3 @@ -function post_toast3(t, url, button1, button2) { - t.disabled=true; - t.classList.add("disabled"); - const xhr = new XMLHttpRequest(); - xhr.open("POST", url); - xhr.setRequestHeader('xhr', 'xhr'); - var form = new FormData() - form.append("formkey", formkey()); - - if(typeof data === 'object' && data !== null) { - for(let k of Object.keys(data)) { - form.append(k, data[k]); - } - } - - xhr.onload = function() { - let data - try {data = JSON.parse(xhr.response)} - catch(e) {console.log(e)} - if (xhr.status >= 200 && xhr.status < 300 && data && data["message"]) { - document.getElementById('toast-post-success-text').innerText = data["message"]; - bootstrap.Toast.getOrCreateInstance(document.getElementById('toast-post-success')).show(); - - document.getElementById(button1).classList.toggle("d-md-inline-block"); - document.getElementById(button2).classList.toggle("d-md-inline-block"); - - } else { - document.getElementById('toast-post-error-text').innerText = "Error, please try again later." - if (data && data["error"]) document.getElementById('toast-post-error-text').innerText = data["error"]; - if (data && data["details"]) document.getElementById('toast-post-error-text').innerText = data["details"]; - bootstrap.Toast.getOrCreateInstance(document.getElementById('toast-post-error')).show(); - } - setTimeout(() => { - t.disabled = false; - t.classList.remove("disabled"); - }, 2000); - }; - - xhr.send(form); -} - function report_commentModal(id, author) { document.getElementById("comment-author").textContent = author; @@ -128,33 +87,15 @@ function toggleEdit(id){ function delete_commentModal(id) { - document.getElementById("deleteCommentButton").onclick = function() { - const xhr = new XMLHttpRequest(); - xhr.open("POST", `/delete/comment/${id}`); - xhr.setRequestHeader('xhr', 'xhr'); - var form = new FormData() - form.append("formkey", formkey()); - xhr.onload = function() { - let data - try {data = JSON.parse(xhr.response)} - catch(e) {console.log(e)} - if (xhr.status >= 200 && xhr.status < 300 && data && data['message']) { - document.getElementsByClassName(`comment-${id}-only`)[0].classList.add('deleted'); - document.getElementById(`delete-${id}`).classList.add('d-none'); - document.getElementById(`undelete-${id}`).classList.remove('d-none'); - document.getElementById(`delete2-${id}`).classList.add('d-none'); - document.getElementById(`undelete2-${id}`).classList.remove('d-none'); - document.getElementById('toast-post-success-text').innerText = data["message"]; - bootstrap.Toast.getOrCreateInstance(document.getElementById('toast-post-success')).show(); - } else { - document.getElementById('toast-post-error-text').innerText = "Error, please try again later." - if (data && data["error"]) document.getElementById('toast-post-error-text').innerText = data["error"]; - if (data && data["details"]) document.getElementById('toast-post-error-text').innerText = data["details"]; - bootstrap.Toast.getOrCreateInstance(document.getElementById('toast-post-error')).show(); - } - }; - xhr.send(form); - }; + document.getElementById("deleteCommentButton").onclick = () => postToast(null, `/delete/comment/${id}`, 'POST', null, (xhr) => { + if (xhr.status >= 200 && xhr.status < 300) { + document.getElementsByClassName(`comment-${id}-only`)[0].classList.add('deleted'); + document.getElementById(`delete-${id}`).classList.add('d-none'); + document.getElementById(`undelete-${id}`).classList.remove('d-none'); + document.getElementById(`delete2-${id}`).classList.add('d-none'); + document.getElementById(`undelete2-${id}`).classList.remove('d-none'); + } + }); } function post_reply(id){ @@ -275,7 +216,7 @@ function post_comment(fullname,id,level = 1){ catch(e) {} const xhr = new XMLHttpRequest(); - xhr.open("post", "/comment"); + xhr.open("post", "/comment"); // TODO: use postToast for this? xhr.setRequestHeader('xhr', 'xhr'); xhr.onload=function(){ let data diff --git a/files/assets/js/delete_post_modal.js b/files/assets/js/delete_post_modal.js index 8f1af1bb4..863866cd6 100644 --- a/files/assets/js/delete_post_modal.js +++ b/files/assets/js/delete_post_modal.js @@ -1,29 +1,11 @@ function delete_postModal(id) { - document.getElementById("deletePostButton").onclick = function() { - const xhr = new XMLHttpRequest(); - xhr.open("POST", `/delete_post/${id}`); - xhr.setRequestHeader('xhr', 'xhr'); - var form = new FormData() - form.append("formkey", formkey()); - xhr.onload = function() { - let data - try {data = JSON.parse(xhr.response)} - catch(e) {console.log(e)} - if (xhr.status >= 200 && xhr.status < 300 && data && data['message']) { - document.getElementById(`post-${id}`).classList.add('deleted'); - document.getElementById(`delete-${id}`).classList.add('d-none'); - document.getElementById(`undelete-${id}`).classList.remove('d-none'); - document.getElementById(`delete2-${id}`).classList.add('d-none'); - document.getElementById(`undelete2-${id}`).classList.remove('d-none'); - document.getElementById('toast-post-success-text').innerText = data["message"]; - bootstrap.Toast.getOrCreateInstance(document.getElementById('toast-post-success')).show(); - } else { - document.getElementById('toast-post-error-text').innerText = "Error, please try again later." - if (data && data["error"]) document.getElementById('toast-post-error-text').innerText = data["error"]; - if (data && data["details"]) document.getElementById('toast-post-error-text').innerText = data["details"]; - bootstrap.Toast.getOrCreateInstance(document.getElementById('toast-post-error')).show(); - } - }; - xhr.send(form); - }; + document.getElementById("deletePostButton").onclick = () => postToast(null, `/delete_post/${id}`, 'POST', null, (xhr) => { + if (xhr.status >= 200 && xhr.status < 300) { + document.getElementById(`post-${id}`).classList.add('deleted'); + document.getElementById(`delete-${id}`).classList.add('d-none'); + document.getElementById(`undelete-${id}`).classList.remove('d-none'); + document.getElementById(`delete2-${id}`).classList.add('d-none'); + document.getElementById(`undelete2-${id}`).classList.remove('d-none'); + } + }); } diff --git a/files/assets/js/followers.js b/files/assets/js/followers.js index 1f633abef..0d3ccb387 100644 --- a/files/assets/js/followers.js +++ b/files/assets/js/followers.js @@ -1,5 +1,5 @@ function removeFollower(event, username) { - post_toast(event.target,'/remove_follow/' + username); + postToastSimple(event.target,'/remove_follow/' + username); let table = document.getElementById("followers-table"); table.removeChild(event.target.parentElement.parentElement); } diff --git a/files/assets/js/following.js b/files/assets/js/following.js index 151ca7f8b..9fcb4c770 100644 --- a/files/assets/js/following.js +++ b/files/assets/js/following.js @@ -1,5 +1,5 @@ function removeFollowing(event, username) { - post_toast(event.target,'/unfollow/' + username); + postToastSimple(event.target,'/unfollow/' + username); let table = document.getElementById("followers-table"); table.removeChild(event.target.parentElement.parentElement); } diff --git a/files/assets/js/header.js b/files/assets/js/header.js index 975620308..f0842ee2f 100644 --- a/files/assets/js/header.js +++ b/files/assets/js/header.js @@ -81,45 +81,99 @@ function expandDesktopImage(image) { document.getElementById("desktop-expanded-image-wrap-link").href = image; }; -function post_toast(t, url, reload, data) { - if (t) { - t.disabled = true; - t.classList.add("disabled"); +function postToast(targetElement, url, method, data, callbackFn) { + if (targetElement) { // disable element to avoid repeated requests + targetElement.disabled = true; + targetElement.classList.add("disabled"); } - const xhr = new XMLHttpRequest(); - xhr.open("POST", url); - xhr.setRequestHeader('xhr', 'xhr'); - var form = new FormData() + const xhr = new XMLHttpRequest(); // set up the request now + xhr.open(method, url); + xhr.setRequestHeader("xhr", "xhr"); + + var formData = null; + if (data instanceof HTMLFormElement) { + formData = data; + } + var form = new FormData(formData ?? undefined); form.append("formkey", formkey()); - if(typeof data === 'object' && data !== null) { - for(let k of Object.keys(data)) { + if (typeof data === 'object' && data !== null) { + for (let k of Object.keys(data)) { form.append(k, data[k]); } } xhr.onload = function() { - let data - try {data = JSON.parse(xhr.response)} - catch(e) {console.log(e)} + let data; + try { + data = JSON.parse(xhr.response); + } catch (e) { + console.error("Failed to parse response as JSON", e); + } + + var message = null; + + if (callbackFn !== null) { + try { + const result = callbackFn(xhr); + if (typeof result === 'string' && result !== null) { + message = result; + } + } catch (e) { + console.error("Failed to run callback function for postToast", e, xhr); + } + } + if (xhr.status >= 200 && xhr.status < 300 && data && data['message']) { - document.getElementById('toast-post-success-text').innerText = data["message"]; + const toastPostSuccessTextElement = document.getElementById("toast-post-success-text"); + if (message === null) { + message = data["message"]; + } + if (message === null) { + message = "Success!"; + } + toastPostSuccessTextElement.innerText = message; bootstrap.Toast.getOrCreateInstance(document.getElementById('toast-post-success')).show(); - if (reload == 1) {location.reload()} } else { - document.getElementById('toast-post-error-text').innerText = "Error, please try again later." - if (data && data["error"]) document.getElementById('toast-post-error-text').innerText = data["error"]; - if (data && data["details"]) document.getElementById('toast-post-error-text').innerText = data["details"]; + const toastPostErrorTextElement = document.getElementById('toast-post-error-text'); + if (message === null && data) { + if (data["details"]) { + message = data["details"]; + } else if (data["error"]) { + message = data["error"]; + } + } + if (message === null) { + message = "Error, please try again later."; + } + toastPostErrorTextElement.innerText = message; bootstrap.Toast.getOrCreateInstance(document.getElementById('toast-post-error')).show(); } - setTimeout(() => { - t.disabled = false; - t.classList.remove("disabled"); - }, 2000); - }; + } + + setTimeout(() => { + if (targetElement !== null) { + targetElement.disabled = false; + targetElement.classList.remove("disabled"); + } + }, 1500); xhr.send(form); +} +function postToastSimple(t, url, method="POST", data=null) { + postToast(t, url, method, data, null); +} + +function postToastReload(t, url, method, data) { + postToast(t, url, method, data, (xhr) => location.reload()); +} + +function postToastSwitch(t, url, method, button1, button2, cssClass="d-none") { + postToast(t, url, method, null, (xhr) => { + document.getElementById(button1).classList.toggle(cssClass); + document.getElementById(button2).classList.toggle(cssClass); + }) } function escapeHTML(unsafe) { diff --git a/files/assets/js/post_toast2.js b/files/assets/js/post_toast2.js deleted file mode 100644 index 1772709ff..000000000 --- a/files/assets/js/post_toast2.js +++ /dev/null @@ -1,43 +0,0 @@ -function post_toast2(t, url, button1, button2) { - t.disabled=true; - t.classList.add("disabled"); - const xhr = new XMLHttpRequest(); - xhr.open("POST", url); - xhr.setRequestHeader('xhr', 'xhr'); - var form = new FormData() - form.append("formkey", formkey()); - - if(typeof data === 'object' && data !== null) { - for(let k of Object.keys(data)) { - form.append(k, data[k]); - } - } - - - form.append("formkey", formkey()); - - xhr.onload = function() { - let data - try {data = JSON.parse(xhr.response)} - catch(e) {console.log(e)} - if (xhr.status >= 200 && xhr.status < 300 && data && data["message"]) { - document.getElementById('toast-post-success-text').innerText = data["message"]; - bootstrap.Toast.getOrCreateInstance(document.getElementById('toast-post-success')).show(); - - document.getElementById(button1).classList.toggle("d-none"); - document.getElementById(button2).classList.toggle("d-none"); - - } else { - document.getElementById('toast-post-error-text').innerText = "Error, please try again later." - if (data && data["error"]) document.getElementById('toast-post-error-text').innerText = data["error"]; - if (data && data["details"]) document.getElementById('toast-post-error-text').innerText = data["details"]; - bootstrap.Toast.getOrCreateInstance(document.getElementById('toast-post-error')).show(); - } - setTimeout(() => { - t.disabled = false; - t.classList.remove("disabled"); - }, 2000); - }; - - xhr.send(form); -} diff --git a/files/assets/js/userpage_v.js b/files/assets/js/userpage_v.js index de59fb909..2c0260863 100644 --- a/files/assets/js/userpage_v.js +++ b/files/assets/js/userpage_v.js @@ -1,60 +1,3 @@ -function post_toast_callback(url, data, callback) { - const xhr = new XMLHttpRequest(); - xhr.open("POST", url); - xhr.setRequestHeader('xhr', 'xhr'); - var form = new FormData() - form.append("formkey", formkey()); - - if(typeof data === 'object' && data !== null) { - for(let k of Object.keys(data)) { - form.append(k, data[k]); - } - } - - form.append("formkey", formkey()); - xhr.onload = function() { - let result = callback(xhr); - if (xhr.status >= 200 && xhr.status < 300) { - var myToast = bootstrap.Toast.getOrCreateInstance(document.getElementById('toast-post-error')); - myToast.hide(); - - var myToast = bootstrap.Toast.getOrCreateInstance(document.getElementById('toast-post-success')); - myToast.show(); - - try { - if(typeof result == "string") { - document.getElementById('toast-post-success-text').innerText = result; - } else { - document.getElementById('toast-post-success-text').innerText = JSON.parse(xhr.response)["message"]; - } - } catch(e) { - } - - return true; - } else { - var myToast = bootstrap.Toast.getOrCreateInstance(document.getElementById('toast-post-success')); - myToast.hide(); - - var myToast = bootstrap.Toast.getOrCreateInstance(document.getElementById('toast-post-error')); - myToast.show(); - - try { - if(typeof result == "string") { - document.getElementById('toast-post-error-text').innerText = result; - } else { - document.getElementById('toast-post-error-text').innerText = JSON.parse(xhr.response)["error"]; - } - return false - } catch(e) {console.log(e)} - - return false; - } - }; - - xhr.send(form); - -} - function toggleElement(id, id2) { for(let el of document.getElementsByClassName('toggleable')) { if(el.id != id) { @@ -91,8 +34,10 @@ function transferCoins(mobile=false) { let transferred = amount - Math.ceil(amount*TRANSFER_TAX); let username = document.getElementById('username').innerHTML - post_toast_callback(`/@${username}/transfer_coins`, - {"amount": document.getElementById(mobile ? "coin-transfer-amount-mobile" : "coin-transfer-amount").value}, + postToast(null, `/@${username}/transfer_coins`, "POST", + { + "amount": document.getElementById(mobile ? "coin-transfer-amount-mobile" : "coin-transfer-amount").value + }, (xhr) => { if(xhr.status == 200) { document.getElementById("user-coins-amount").innerText = parseInt(document.getElementById("user-coins-amount").innerText) - amount; @@ -115,7 +60,7 @@ function transferBux(mobile=false) { let amount = parseInt(document.getElementById("bux-transfer-amount").value); let username = document.getElementById('username').innerHTML - post_toast_callback(`/@${username}/transfer_bux`, + postToast(null, `/@${username}/transfer_bux`, "POST", {"amount": document.getElementById(mobile ? "bux-transfer-amount-mobile" : "bux-transfer-amount").value}, (xhr) => { if(xhr.status == 200) { @@ -130,57 +75,11 @@ function transferBux(mobile=false) { } function submitFormAjax(e) { - document.getElementById('message').classList.add('d-none'); - document.getElementById('message-mobile').classList.add('d-none'); - document.getElementById('message-preview').classList.add('d-none'); - document.getElementById('message-preview-mobile').classList.add('d-none'); + for (elementId in ['message', 'message-mobile', 'message-preview', 'message-preview-mobile']) { + document.getElementById(elementId).classList.add("d-none"); + } const form = e.target; - const xhr = new XMLHttpRequest(); - e.preventDefault(); - - formData = new FormData(form); - - formData.append("formkey", formkey()); - if(typeof data === 'object' && data !== null) { - for(let k of Object.keys(data)) { - form.append(k, data[k]); - } - } - actionPath = form.getAttribute("action"); - - xhr.open("POST", actionPath); - xhr.setRequestHeader('xhr', 'xhr'); - - xhr.onload = function() { - if (xhr.status >= 200 && xhr.status < 300) { - let data = JSON.parse(xhr.response); - try { - document.getElementById('toast-post-success-text').innerText = data["message"]; - } catch(e) { - document.getElementById('toast-post-success-text').innerText = "Action successful!"; - } - var myToast = bootstrap.Toast.getOrCreateInstance(document.getElementById('toast-post-success')); - myToast.show(); - return true - } else { - document.getElementById('toast-post-error-text').innerText = "Error, please try again later." - try { - let data=JSON.parse(xhr.response); - var myToast = bootstrap.Toast.getOrCreateInstance(document.getElementById('toast-post-error')); - myToast.show(); - if (data && data["error"]) document.getElementById('toast-post-error-text').innerText = data["error"]; - if (data && data["details"]) document.getElementById('toast-post-error-text').innerText = data["details"]; - } catch(e) { - var myToast = bootstrap.Toast.getOrCreateInstance(document.getElementById('toast-post-success')); - myToast.hide(); - var myToast = bootstrap.Toast.getOrCreateInstance(document.getElementById('toast-post-error')); - myToast.show(); - } - } - }; - - xhr.send(formData); - - return false + postToast(null, form.getAttribute("action"), "POST", form, null); + return false; } diff --git a/files/classes/user.py b/files/classes/user.py index e92cf54a0..47f36f169 100644 --- a/files/classes/user.py +++ b/files/classes/user.py @@ -1,6 +1,7 @@ from __future__ import annotations import time +from datetime import datetime from typing import TYPE_CHECKING, Union import pyotp @@ -98,7 +99,7 @@ class User(CreatedBase): login_nonce = Column(Integer, default=0, nullable=False) reserved = deferred(Column(String)) coins = Column(Integer, default=0, nullable=False) - truecoins = Column(Integer, default=0, nullable=False) + truescore = Column(Integer, default=0, nullable=False) procoins = Column(Integer, default=0, nullable=False) mfa_secret = deferred(Column(String)) is_private = Column(Boolean, default=False, nullable=False) @@ -158,18 +159,43 @@ class User(CreatedBase): def can_manage_reports(self): return self.admin_level > 1 + + @property + def age_days(self): + return (datetime.now() - datetime.fromtimestamp(self.created_utc)).days + @property def should_comments_be_filtered(self): from files.__main__ import app # avoiding import loop if self.admin_level > 0: return False # TODO: move settings out of app.config site_settings = app.config['SETTINGS'] - minComments = site_settings.get('FilterCommentsMinComments', 0) - minKarma = site_settings.get('FilterCommentsMinKarma', 0) - minAge = site_settings.get('FilterCommentsMinAgeDays', 0) - accountAgeDays = self.age_timedelta.days - return self.comment_count < minComments or accountAgeDays < minAge or self.truecoins < minKarma + min_comments = site_settings.get('FilterCommentsMinComments', 0) + min_karma = site_settings.get('FilterCommentsMinKarma', 0) + min_age = site_settings.get('FilterCommentsMinAgeDays', 0) + return self.comment_count < min_comments \ + or self.age_days < min_age \ + or self.truescore < min_karma + + + def can_change_user_privacy(self, v: "User") -> bool: + from files.__main__ import app # avoiding import loop + if v.admin_level >= PERMS['USER_SET_PROFILE_PRIVACY']: return True + if self.id != v.id: return False # non-admin changing someone else's things, hmm... + + # TODO: move settings out of app.config + site_settings = app.config['SETTINGS'] + min_comments: int = site_settings.get('min_comments_private_profile', 0) + min_truescore: int = site_settings.get('min_truescore_private_profile', 0) + min_age_days: int = site_settings.get('min_age_days_private_profile', 0) + user_age_days: int = self.age_timedelta.days + + return ( + self.comment_count >= min_comments + and self.truescore >= min_truescore + and user_age_days >= min_age_days) + @property @lazy @@ -195,7 +221,7 @@ class User(CreatedBase): @property @lazy def paid_dues(self): - return not self.shadowbanned and not (self.is_banned and not self.unban_utc) and (self.admin_level or self.club_allowed or (self.club_allowed != False and self.truecoins > CLUB_TRUESCORE_MINIMUM)) + return not self.shadowbanned and not (self.is_banned and not self.unban_utc) and (self.admin_level or self.club_allowed or (self.club_allowed != False and self.truescore > CLUB_TRUESCORE_MINIMUM)) @lazy def any_block_exists(self, other): diff --git a/files/helpers/config/const.py b/files/helpers/config/const.py index a3a4aa553..16f1de03d 100644 --- a/files/helpers/config/const.py +++ b/files/helpers/config/const.py @@ -92,7 +92,8 @@ SUBMISSION_FLAIR_LENGTH_MAXIMUM: Final[int] = 350 SUBMISSION_TITLE_LENGTH_MAXIMUM: Final[int] = 500 SUBMISSION_URL_LENGTH_MAXIMUM: Final[int] = 2048 SUBMISSION_BODY_LENGTH_MAXIMUM: Final[int] = 20000 -COMMENT_BODY_LENGTH_MAXIMUM: Final[int] = 10000 +COMMENT_BODY_LENGTH_MAXIMUM: Final[int] = 500000 +COMMENT_BODY_LENGTH_MAXIMUM_UNFILTERED: Final[int] = 50000 MESSAGE_BODY_LENGTH_MAXIMUM: Final[int] = 10000 CSS_LENGTH_MAXIMUM: Final[int] = 4000 @@ -152,6 +153,7 @@ PERMS = { "SCHEDULER_POSTS": 2, "SCHEDULER_TASK_TRACEBACK": 3, "USER_SHADOWBAN": 2, + 'USER_SET_PROFILE_PRIVACY': 2, } AWARDS = {} diff --git a/files/routes/admin/admin.py b/files/routes/admin/admin.py index 866892053..8fc7d3074 100644 --- a/files/routes/admin/admin.py +++ b/files/routes/admin/admin.py @@ -631,7 +631,7 @@ def loggedin_list(v): ids = [x for x, val in cache.get(f'{SITE}_loggedin').items() \ if (time.time() - val) < LOGGEDIN_ACTIVE_TIME] users = g.db.query(User).filter(User.id.in_(ids)) \ - .order_by(User.admin_level.desc(), User.truecoins.desc()).all() + .order_by(User.admin_level.desc(), User.truescore.desc()).all() return render_template("admin/loggedin.html", v=v, users=users) diff --git a/files/routes/allroutes.py b/files/routes/allroutes.py index bf6cb63e3..e2c3283ac 100644 --- a/files/routes/allroutes.py +++ b/files/routes/allroutes.py @@ -1,11 +1,16 @@ +from __future__ import annotations + import json import sys import time +from typing import TYPE_CHECKING from flask import abort, g, request from files.__main__ import app, db_session, limiter +if TYPE_CHECKING: + from flask.wrappers import Response @app.before_request def before_request(): @@ -45,7 +50,13 @@ def teardown_request(error): sys.stdout.flush() @app.after_request -def after_request(response): +def after_request(response: Response): + response.headers.add("Content-Security-Policy", ( + "script-src 'self' 'unsafe-inline';" + " connect-src 'self' *.google-analytics.com *.analytics.google.com;" + " object-src 'none';" + " img-src 'self' *.google-analytics.com *.analytics.google.com" + )) response.headers.add("Strict-Transport-Security", "max-age=31536000") response.headers.add("X-Frame-Options", "deny") return response diff --git a/files/routes/comments.py b/files/routes/comments.py index 82a8f0b88..83a57ca3a 100644 --- a/files/routes/comments.py +++ b/files/routes/comments.py @@ -201,7 +201,11 @@ def api_comment(v): abort(403, "Too much spam!") - is_filtered = v.should_comments_be_filtered() + is_filtered = v.should_comments_be_filtered + + if (v.admin_level <= PERMS['POST_COMMENT_MODERATION'] + and len(body) > COMMENT_BODY_LENGTH_MAXIMUM_UNFILTERED): + is_filtered = True c = Comment(author_id=v.id, parent_submission=parent_post.id, @@ -241,6 +245,9 @@ def api_comment(v): if replying_to_blocked: message = "This user has blocked you. You are still welcome to reply " \ "but you will be held to a higher standard of civility than you would be otherwise" + elif (v.admin_level <= PERMS['POST_COMMENT_MODERATION'] + and len(body) > COMMENT_BODY_LENGTH_MAXIMUM_UNFILTERED): + message = "Your comment has been submitted but is a bit long, so it's pending approval." else: message = None return {"comment": render_template("comments.html", v=v, comments=[c], ajax=True, parent_level=level), "message": message} diff --git a/files/routes/settings.py b/files/routes/settings.py index 866e0d621..effb407fb 100644 --- a/files/routes/settings.py +++ b/files/routes/settings.py @@ -64,10 +64,6 @@ def settings_profile_post(v): elif request.values.get("over18", v.over_18) != v.over_18: updated = True v.over_18 = request.values.get("over18") == 'true' - - elif request.values.get("private", v.is_private) != v.is_private: - updated = True - v.is_private = request.values.get("private") == 'true' elif request.values.get("nofollow", v.is_nofollow) != v.is_nofollow: updated = True @@ -640,3 +636,16 @@ def settings_profile(v): if v.flairchanged: ti = datetime.utcfromtimestamp(v.flairchanged).strftime('%Y-%m-%d %H:%M:%S') else: ti = '' return render_template("settings_profile.html", v=v, ti=ti) + + +# other settings i guess + +@app.post("/id//private/") +@auth_required +def post_set_user_profile_privacy(v: User, id: int, enabled: int): + if enabled != 0 and enabled != 1: abort(400, "'enabled' must be '0' or '1'") + user: User = get_account(id) + if not user.can_change_user_privacy(v): abort(403) + user.is_private = bool(enabled) + g.db.commit() + return {"message": f"{'Enabled' if user.is_private else 'Disabled'} private mode successfully!"} diff --git a/files/routes/static.py b/files/routes/static.py index d14a127e1..200db217e 100644 --- a/files/routes/static.py +++ b/files/routes/static.py @@ -199,9 +199,9 @@ def patrons(v): @auth_desired def admins(v): if v and v.admin_level >= 3: - admins = g.db.query(User).filter(User.admin_level>1).order_by(User.truecoins.desc()).all() - admins += g.db.query(User).filter(User.admin_level==1).order_by(User.truecoins.desc()).all() - else: admins = g.db.query(User).filter(User.admin_level>0).order_by(User.truecoins.desc()).all() + admins = g.db.query(User).filter(User.admin_level>1).order_by(User.truescore.desc()).all() + admins += g.db.query(User).filter(User.admin_level==1).order_by(User.truescore.desc()).all() + else: admins = g.db.query(User).filter(User.admin_level>0).order_by(User.truescore.desc()).all() return render_template("admins.html", v=v, admins=admins) diff --git a/files/routes/users.py b/files/routes/users.py index 25809fb07..88d1b3624 100644 --- a/files/routes/users.py +++ b/files/routes/users.py @@ -377,7 +377,7 @@ def leaderboard(v:User): comments = SimpleLeaderboard(v, LeaderboardMeta("Comments", "comment count", "comments", "Comments", "comments"), g.db, users, User.comment_count) received_awards = SimpleLeaderboard(v, LeaderboardMeta("Awards", "received awards", "awards", "Awards", None), g.db, users, User.received_award_count) coins_spent = SimpleLeaderboard(v, LeaderboardMeta("Spent in shop", "coins spent in shop", "spent", "Coins", None), g.db, users, User.coins_spent) - truescore = SimpleLeaderboard(v, LeaderboardMeta("Truescore", "truescore", "truescore", "Truescore", None), g.db, users, User.truecoins) + truescore = SimpleLeaderboard(v, LeaderboardMeta("Truescore", "truescore", "truescore", "Truescore", None), g.db, users, User.truescore) badges = BadgeMarseyLeaderboard(v, LeaderboardMeta("Badges", "badges", "badges", "Badges", None), g.db, Badge.user_id) blocks = UserBlockLeaderboard(v, LeaderboardMeta("Blocked", "most blocked", "blocked", "Blocked By", "blockers"), g.db, UserBlock.target_id) @@ -619,7 +619,7 @@ def api_is_available(name): def user_id(id:int): user = get_account(id) return redirect(user.url) - + @app.get("/u/") def redditor_moment_redirect(username:str): return redirect(f"/@{username}") @@ -803,6 +803,7 @@ def u_user_id_info(id, v=None): return user.json + @app.post("/follow/") @limiter.limit("1/second;30/minute;200/hour;1000/day") @auth_required diff --git a/files/routes/votes.py b/files/routes/votes.py index bbc949867..ffcdac96e 100644 --- a/files/routes/votes.py +++ b/files/routes/votes.py @@ -83,7 +83,7 @@ def api_vote_post(post_id, new, v): # remove the old score data if points_matter: post.author.coins -= vote.vote_type - post.author.truecoins -= vote.vote_type + post.author.truescore -= vote.vote_type # we'll be saving later anyway, so don't bother doing so here else: # create new vote data @@ -105,7 +105,7 @@ def api_vote_post(post_id, new, v): # add relevant points if points_matter: post.author.coins += vote.vote_type - post.author.truecoins += vote.vote_type + post.author.truescore += vote.vote_type # database it up g.db.add(post.author) @@ -151,7 +151,7 @@ def api_vote_comment(comment_id, new, v): # remove the old score data if points_matter: comment.author.coins -= vote.vote_type - comment.author.truecoins -= vote.vote_type + comment.author.truescore -= vote.vote_type # we'll be saving later anyway, so don't bother doing so here else: # create new vote data @@ -173,7 +173,7 @@ def api_vote_comment(comment_id, new, v): # add relevant points if points_matter: comment.author.coins += vote.vote_type - comment.author.truecoins += vote.vote_type + comment.author.truescore += vote.vote_type # database it up g.db.add(comment.author) diff --git a/files/templates/admin/admin_home.html b/files/templates/admin/admin_home.html index 08a549dfd..bf853bba3 100644 --- a/files/templates/admin/admin_home.html +++ b/files/templates/admin/admin_home.html @@ -78,14 +78,14 @@

Site Settings

{%- macro site_setting_bool(name, label) -%}
- +
{%- endmacro -%} {%- macro site_setting_int(name, label) -%}
+ onblur="postToastSimple(null, '/admin/site_settings/{{name}}', 'POST', { new_value: this.value })"/>
{%- endmacro -%} @@ -94,7 +94,7 @@ {{site_setting_bool('FilterNewPosts', 'Filter New Posts')}} {{site_setting_bool('Read-only mode', 'Read-Only Mode')}}
- +
@@ -103,8 +103,13 @@ {{site_setting_int('FilterCommentsMinKarma', 'Minimum Karma')}} {{site_setting_int('FilterCommentsMinAgeDays', 'Minimum Account Age (Days)')}} - - +

Private Mode Requirements

+ {{site_setting_int('min_comments_private_profile', 'Minimum Comments')}} + {{site_setting_int('min_truescore_private_profile', 'Minimum Karma')}} + {{site_setting_int('min_age_days_private_profile', 'Minimum Account Age (Days)')}} + + + {% endif %} {% if g.debug %}
diff --git a/files/templates/admin/app.html b/files/templates/admin/app.html index c425f3e76..f20e216c2 100644 --- a/files/templates/admin/app.html +++ b/files/templates/admin/app.html @@ -34,12 +34,12 @@
{% if not app.client_id%} - Approve - Reject + Approve + Reject {% else %} - Revoke + Revoke {% endif %}
@@ -56,12 +56,12 @@ - + {% block scripts %}{% endblock %} diff --git a/files/templates/login/sign_up.html b/files/templates/login/sign_up.html index fbd272d41..fc270b856 100644 --- a/files/templates/login/sign_up.html +++ b/files/templates/login/sign_up.html @@ -53,9 +53,9 @@ {%- endblock -%} - +{%- block scripts -%} - {% if hcaptcha %} {% endif %} +{%- endblock -%} diff --git a/files/templates/notifications.html b/files/templates/notifications.html index 2ea5df8cf..b8520890e 100644 --- a/files/templates/notifications.html +++ b/files/templates/notifications.html @@ -40,7 +40,7 @@ -Mark All Read +Mark All Read
diff --git a/files/templates/settings.html b/files/templates/settings.html index 357463651..3db71bd8d 100644 --- a/files/templates/settings.html +++ b/files/templates/settings.html @@ -2,18 +2,14 @@ + {% include "analytics.html" %} - {% include "csp.html" %} - - - - {% block pagetitle %}Settings - {{SITE_TITLE}}{% endblock %} @@ -224,12 +220,12 @@ {% endblock %} - diff --git a/files/templates/settings_filters.html b/files/templates/settings_filters.html index 13caa3348..a09b2cc2c 100644 --- a/files/templates/settings_filters.html +++ b/files/templates/settings_filters.html @@ -13,7 +13,7 @@

Change how many posts appear on every page.

- {% for entry in [15, 25, 50, 100] %} {% endfor %} @@ -36,7 +36,7 @@

Change the default sorting for comments.

- {% for entry in SORTS_COMMENTS %} {% endfor %} @@ -53,7 +53,7 @@

Change the default sorting for posts.

- {% for entry in SORTS_POSTS %} {% endfor %} @@ -68,7 +68,7 @@

Change the default time filter for posts.

- {% for entry in ["hour", "day", "week", "month", "year", "all"] %} {% endfor %} @@ -87,7 +87,7 @@
- +
Enable if you would like to automatically open links to other pages in the site in new tabs. @@ -104,7 +104,7 @@
- +
@@ -123,7 +123,7 @@
- +
Enable if you would like to automatically convert twitter.com links to nitter.net links. @@ -140,7 +140,7 @@

Change the domain you would like to view reddit posts in.

- {% for entry in ['old.reddit.com', 'reddit.com', 'i.reddit.com', 'unddit.com', 'teddit.net', 'libredd.it'] %} {% endfor %} @@ -156,7 +156,7 @@
- +
Enable if you would like to automatically sort reddit.com links by controversial. @@ -177,7 +177,7 @@
- +
@@ -196,7 +196,7 @@
- +
diff --git a/files/templates/settings_profile.html b/files/templates/settings_profile.html index 0ccbdc142..7dbcbfb7f 100644 --- a/files/templates/settings_profile.html +++ b/files/templates/settings_profile.html @@ -13,7 +13,7 @@
- +
Enable if you would like to display images and videos in full size on the frontpage. @@ -27,7 +27,7 @@
- +
Enable if you would like to highlight comments made after the last time you visited a thread. @@ -41,7 +41,7 @@

Change the theme for the website.

- {% for entry in THEMES %}
+ {%- set can_change_profile_privacy = v.can_change_user_privacy(v) -%}
- +
- This will hide your post and comment history from others. We will also ask search engines to not index your profile page. (Your content will still be accessible via direct link.) + + {%- if can_change_profile_privacy -%} + This will hide your post and comment history from others. We will also ask search engines to not index your profile page. (Your content will still be accessible via direct link.) + {%- else -%} + If you want to hide your post and comment history from others, please contact us and we'll review your request. (Your content will still be accessible via direct link.) + {%- endif -%} +
@@ -292,7 +299,7 @@
- +
Prevent other users from following you. diff --git a/files/templates/settings_security.html b/files/templates/settings_security.html index 4da3475ec..826a41e26 100644 --- a/files/templates/settings_security.html +++ b/files/templates/settings_security.html @@ -25,7 +25,7 @@ {% if v.email and not v.is_activated %} -
Email not verified. You will not be able to recover your account with this email until you verify it. Verify now.
+
Email not verified. You will not be able to recover your account with this email until you verify it. Verify now.
{% elif not v.email %}
Add an email to secure your account in case you forget your password.
{% endif %} diff --git a/files/templates/shop.html b/files/templates/shop.html index dc4dc262f..48cc0d71c 100644 --- a/files/templates/shop.html +++ b/files/templates/shop.html @@ -72,8 +72,8 @@ {{a['owned']}} {% set kind = a['kind'] %} - {% if a['kind'] != "benefactor" %}Buy with coins{% endif %} - {% if a['kind'] != "grass" %}Buy with marseybux{% endif %} + {% if a['kind'] != "benefactor" %}Buy with coins{% endif %} + {% if a['kind'] != "grass" %}Buy with marseybux{% endif %} {{a['description']}} diff --git a/files/templates/submission.html b/files/templates/submission.html index fac5b94a6..5e4a997bc 100644 --- a/files/templates/submission.html +++ b/files/templates/submission.html @@ -504,6 +504,7 @@ if (lastCount) commentsAddUnreadIndicator(commentsToCheck); collapsedCommentStorageApply(); + MicroModal.init(); } btn.disabled = false; } diff --git a/files/templates/submit.html b/files/templates/submit.html index 9613798bd..59286d84d 100644 --- a/files/templates/submit.html +++ b/files/templates/submit.html @@ -2,19 +2,13 @@ + {% include "analytics.html" %} - - {% include "csp.html" %} - - - - - {% block title %} Create a post - {{SITE_TITLE}} {% endblock %} diff --git a/files/templates/user_listing.html b/files/templates/user_listing.html index b38463693..59dad68f3 100644 --- a/files/templates/user_listing.html +++ b/files/templates/user_listing.html @@ -13,9 +13,9 @@ {% if v %} {% if v.id!=u.id and not u.is_private and not u.is_nofollow %} - + - + {% endif %} {% else %} diff --git a/files/templates/userpage.html b/files/templates/userpage.html index 70375492b..fc0ed84eb 100644 --- a/files/templates/userpage.html +++ b/files/templates/userpage.html @@ -145,16 +145,16 @@
{% if v and v.id != u.id %} - Unfollow + Unfollow - Follow + Follow Message {% if v and v.admin_level >= 3 %} - Make admin - Remove admin + Make admin + Remove admin {% if u.admin_level > 1 %} - Revert admin actions + Revert admin actions {% endif %} {% endif %} @@ -222,16 +222,16 @@

 						

 
-						Shadowban
+						Shadowban
 
-						Unshadowban
+						Unshadowban
 
 
 						

 						
 						{% if v and v.admin_level >= 3 %}
-							Verify
-							Unverify
+							Verify
+							Unverify
 						{% endif %}
 
 						

@@ -247,9 +247,13 @@
 							
 						
 						

-						
-						
+						
+						
 						{% endif %}
+					{% if v and v.admin_level >= PERMS['USER_SET_PROFILE_PRIVACY'] %}
+						Set Private Mode
+						Unset Private Mode
+					{% endif %}
 					

 					

User ID: {{u.id}}

@@ -391,16 +395,16 @@ {% endif %} {% if v and v.id != u.id %} - Unfollow + Unfollow - Follow + Follow Message {% if v and v.admin_level >= 3 %} - Make admin - Remove admin + Make admin + Remove admin {% if u.admin_level > 1 %} - Revert admin actions + Revert admin actions {% endif %} {% endif %} @@ -422,8 +426,8 @@ {% if v and v.admin_level >= 2 %} - - + +

@@ -470,16 +474,16 @@

 						

 
-						Shadowban
+						Shadowban
 
-						Unshadowban
+						Unshadowban
 
 
 						

 
 						{% if v and v.admin_level >= 3 %}
-							Verify
-							Unverify
+							Verify
+							Unverify
 						{% endif %}
 
 						

@@ -496,6 +500,10 @@
 						
 					{% endif %}
 				{% endif %}
+				{% if v and v.admin_level >= PERMS['USER_SET_PROFILE_PRIVACY'] %}
+					Set Private Mode
+					Unset Private Mode
+				{% endif %}
 				

 				

User ID: {{u.id}}

@@ -513,6 +521,7 @@ {% if u.is_suspended %}

Banned by: @{{u.banned_by.username}}

{% endif %} +
diff --git a/files/templates/votes.html b/files/templates/votes.html index 31843c9d3..001118f57 100644 --- a/files/templates/votes.html +++ b/files/templates/votes.html @@ -15,7 +15,7 @@

{{thing.permalink}}

Author: @{{thing.author.username}}

Author Created At: {{thing.author.created_datetime}}

-

Author Truescore: {{thing.author.truecoins}}

+

Author Truescore: {{thing.author.truescore}}

Upvotes: {{ups | length}}

Downvotes: {{downs | length}}

@@ -29,7 +29,7 @@ {% for vote in ups %} {{vote.user.username}} - {{vote.user.truecoins}} + {{vote.user.truescore}} {% endfor %} @@ -44,14 +44,9 @@ {% for vote in downs %} {{vote.user.username}} - {{vote.user.truecoins}} + {{vote.user.truescore}} {% endfor %} - - - {% endif %} - - {% endblock %} diff --git a/migrations/versions/2023_07_25_03_27_11_5195118d6a51_change_created_utc_to_datetimez_for_.py b/migrations/versions/2023_07_25_03_27_11_5195118d6a51_change_created_utc_to_datetimez_for_.py index 84dc4e71f..8bc23a58d 100644 --- a/migrations/versions/2023_07_25_03_27_11_5195118d6a51_change_created_utc_to_datetimez_for_.py +++ b/migrations/versions/2023_07_25_03_27_11_5195118d6a51_change_created_utc_to_datetimez_for_.py @@ -1,7 +1,7 @@ """Change created_utc to datetimez for commentvotes Revision ID: 5195118d6a51 -Revises: 55488ee27b00 +Revises: 7ae4658467d7 Create Date: 2023-07-11 03:27:11.520264+00:00 """ @@ -12,7 +12,7 @@ from sqlalchemy.sql.functions import now # revision identifiers, used by Alembic. revision = '5195118d6a51' -down_revision = '55488ee27b00' +down_revision = 'a23fe2f1515c' branch_labels = None depends_on = None diff --git a/migrations/versions/2023_07_28_03_45_12_55488ee27b00_rename_truecoins_to_truescore.py b/migrations/versions/2023_07_28_03_45_12_55488ee27b00_rename_truecoins_to_truescore.py new file mode 100644 index 000000000..b3fad165c --- /dev/null +++ b/migrations/versions/2023_07_28_03_45_12_55488ee27b00_rename_truecoins_to_truescore.py @@ -0,0 +1,24 @@ +"""rename truecoins to truescore + +Revision ID: 55488ee27b00 +Revises: 5195118d6a51 +Create Date: 2023-07-28 03:45:12.251007+00:00 + +""" +from alembic import op +import sqlalchemy as sa + + +# revision identifiers, used by Alembic. +revision = '55488ee27b00' +down_revision = '5195118d6a51' +branch_labels = None +depends_on = None + + +def upgrade(): + op.alter_column('users', 'truecoins', new_column_name='truescore') + + +def downgrade(): + op.alter_column('users', 'truescore', new_column_name='truecoins') diff --git a/site_settings.json b/site_settings.json index d0b75d448..52ae2dcd7 100644 --- a/site_settings.json +++ b/site_settings.json @@ -1 +1,12 @@ -{"Bots": true, "Read-only mode": false, "Signups": true, "FilterNewPosts": false, "FilterCommentsMinComments": 0, "FilterCommentsMinKarma": 0, "FilterCommentsMinAgeDays": 0} +{ + "Bots": true, + "Read-only mode": false, + "Signups": true, + "FilterNewPosts": false, + "FilterCommentsMinComments": 0, + "FilterCommentsMinKarma": 0, + "FilterCommentsMinAgeDays": 0, + "min_comments_private_profile": 0, + "min_truescore_private_profile": 0, + "min_age_days_private_profile": 0 +}