aktueller Stand

This commit is contained in:
Flummi 2021-03-03 05:34:57 +01:00
parent ce6e23b77e
commit d6c12b9311
20 changed files with 652 additions and 225 deletions

6
package-lock.json generated
View File

@ -15,9 +15,9 @@
"integrity": "sha512-g+f/qj/cNcqKkc3tFqlXOYjrmZA+jNBiDzbP3kH+B+otKFqAdPgVTGP1IeKRdMml/aE69as5S4FqtxAbl+LaMw=="
},
"cuffeo": {
"version": "1.0.7",
"resolved": "https://registry.npmjs.org/cuffeo/-/cuffeo-1.0.7.tgz",
"integrity": "sha512-9XpEUnN9jIfaiIMJwcfPW61PxTxBJUoa9VN/TjiWk7Z/jNStdrlPTdn6Y2cdclsWsHtAyabHdCNUAHscQ89WCQ==",
"version": "1.0.7-2",
"resolved": "https://registry.npmjs.org/cuffeo/-/cuffeo-1.0.7-2.tgz",
"integrity": "sha512-4ZrP6C5jpCu7+UtgB3rJl5wZJ48FSrdaTVgyx7bPtC0gMcEm0O5NcCjiZkJDvbLqsN92LAywFoGmdjt/rXG9EA==",
"requires": {
"flumm-fetch-cookies": "^1.3.5"
}

View File

@ -10,7 +10,7 @@
"author": "Flummi",
"license": "MIT",
"dependencies": {
"cuffeo": "^1.0.7",
"cuffeo": "^1.0.7-2",
"flumm-fetch-cookies": "^1.4.0",
"mariadb": "^2.5.2"
}

View File

@ -1,146 +1,161 @@
/* written by sirx for f0ck.me */
/* use whatever you like */
ul#posts {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
grid-gap: 1em;
list-style: none;
padding: 0;
margin-top: 10px;
display: grid;
grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
grid-gap: 1em;
list-style: none;
padding: 0;
margin-top: 10px;
}
.navbar {
background-color: #1b1b1b;
position: sticky;
top: 0;
z-index: 1;
font-family: monospace;
text-transform: uppercase;
text-shadow: 1px 1px black;
background-color: #1b1b1b;
position: sticky;
top: 0;
z-index: 1;
font-family: monospace;
text-transform: uppercase;
text-shadow: 1px 1px black;
}
body {
background-color: black;
color: white;
background-color: black;
color: white;
}
html {
background-color: black;
background-color: black;
}
.container.is-fluid {
padding-top: 10px;
padding-top: 10px;
}
li.post {
position: relative;
position: relative;
}
span.item-mime {
position: absolute;
right: 0;
top: 0;
color: #68da20;
text-shadow: 1px 1px black;
font-size: 11px;
text-transform: uppercase;
background: #000000b8;
visibility: hidden;
position: absolute;
right: 0;
top: 0;
color: #68da20;
text-shadow: 1px 1px black;
font-size: 11px;
text-transform: uppercase;
background: #000000b8;
visibility: hidden;
}
li.post:hover > span.item-mime {
visibility: visible;
visibility: visible;
}
a.navbar-item:focus, a.navbar-item:focus-within, a.navbar-item:hover, a.navbar-item.is-active, .navbar-link:focus, .navbar-link:focus-within, .navbar-link:hover, .navbar-link.is-active {
background-color: #000000;
color: #ffffff;
background-color: #000000;
color: #ffffff;
}
a#next, a#prev {
position: relative;
font-weight: normal;
top: 0px;
bottom: 932px;
margin: unset;
font-size: 30px;
color: #99ff00;
padding: 140px 40px 140px 40px;
cursor: pointer;
-webkit-transform: translateZ(0);
align-content: inherit;
align-self: center;
bottom: 0;
position: relative;
font-weight: normal;
top: 0px;
bottom: 932px;
margin: unset;
font-size: 30px;
color: #99ff00;
padding: 140px 40px 140px 40px;
cursor: pointer;
align-content: inherit;
align-self: center;
bottom: 0;
}
a#next, a#prev {
position: sticky;
top: 0;
position: sticky;
top: 0;
}
.content {
display: grid;
justify-content: space-around;
grid-template-columns: 0fr 1fr 0fr;
display: grid;
justify-content: space-around;
grid-template-columns: 0fr 1fr 0fr;
}
.previous-post, .next-post {
display: flex;
display: flex;
}
img#f0ck-image {
max-width: 100%;
max-height: 500px;
max-width: 100%;
max-height: 500px;
}
.metadata {
text-align: center;
position: sticky;
bottom: 0;
text-align: center;
position: sticky;
bottom: 0;
}
a:hover {
color: #99ff00;
opacity: 0.8;
color: #99ff00;
opacity: 0.8;
}
a {
color: #99ff00;
cursor: pointer;
text-decoration: none;
color: #99ff00;
cursor: pointer;
text-decoration: none;
}
.navbar-item, .navbar-link {
color: white;
text-shadow: 1px 1px black;
color: white;
text-shadow: 1px 1px black;
}
.media-object {
text-align: center;
align-self: center;
text-align: center;
align-self: center;
}
/*a.id-link {
padding-right: 5;
padding-right: 5;
}*/
div#my-video {
max-height: unset;
max-height: unset;
}
.box:not(:last-child), .content:not(:last-child), .notification:not(:last-child), .progress:not(:last-child), .table:not(:last-child), .table-container:not(:last-child), .title:not(:last-child), .subtitle:not(:last-child), .block:not(:last-child), .highlight:not(:last-child), .breadcrumb:not(:last-child), .level:not(:last-child), .list:not(:last-child), .message:not(:last-child), .pagination:not(:last-child), .tabs:not(:last-child) {
margin-bottom: 0;
margin-top: 0;
.box:not(:last-child),
.content:not(:last-child),
.notification:not(:last-child),
.progress:not(:last-child),
.table:not(:last-child),
.table-container:not(:last-child),
.title:not(:last-child),
.subtitle:not(:last-child),
.block:not(:last-child),
.highlight:not(:last-child),
.breadcrumb:not(:last-child),
.level:not(:last-child),
.list:not(:last-child),
.message:not(:last-child),
.pagination:not(:last-child),
.tabs:not(:last-child) {
margin-bottom: 0;
margin-top: 0;
}
.video-container {
position: relative;
padding-bottom: 56.25%; /*16:9*/
padding-top: 30px;
height: 0;
padding-bottom: 56.25%;
/*16:9*/
padding-top: 30px;
height: 0;
overflow: hidden;
}
.video-container video {
position: absolute;
top: 0;
@ -150,189 +165,516 @@ max-height: unset;
}
.irc {
padding: 10px;
color: white;
padding: 10px;
color: white;
}
a#next:hover {
box-shadow: -1px 0px #99ff001c;
transition: all .2s;
box-shadow: -1px 0px #99ff001c;
transition: all .2s;
}
a#prev:hover {
box-shadow: 1px 0px #99ff001c;
transition: all .2s;
box-shadow: 1px 0px #99ff001c;
transition: all .2s;
}
.navbar-brand a.navbar-item:focus, .navbar-brand a.navbar-item:hover {
background-color: black;
background-color: black;
}
.controls {
text-align: center;
text-align: center;
}
.content {
min-height: 517px;
min-height: 517px;
}
#themeselector {
color: #fff;
background-color: #343a40;
display: inline-block;
font-weight: 600;
line-height: 1;
text-align: center;
white-space: nowrap;
vertical-align: baseline;
border-radius: 0.25rem;
transition: color 0.15s ease-in-out, background-color 0.15s ease-in-out, border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
border: 0;
outline: 0;
color: #fff;
background-color: #343a40;
display: inline-block;
font-weight: 600;
line-height: 1;
text-align: center;
white-space: nowrap;
vertical-align: baseline;
border-radius: 0.25rem;
transition: color 0.15s ease-in-out, background-color 0.15s ease-in-out, border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
border: 0;
outline: 0;
}
select {
font-size: small;
font-size: small;
}
@media (max-width: 600px) {
a#next, a#prev {
padding: 0;
}
a#next, a#prev {
padding: 0;
}
.content {
min-height: 0;
}
.content {
min-height: 0;
}
}
img#biohaz {
width: 28px;
width: 28px;
}
.metadata {
background: #1b1b1b;
border-top: 1px solid #262626;
background: #1b1b1b;
border-top: 1px solid #262626;
}
.content {
border-left: 1px solid #1b1b1b;
border-right: 1px solid #1b1b1b;
border-left: 1px solid #1b1b1b;
border-right: 1px solid #1b1b1b;
}
.controls {
border-left: 1px solid #1b1b1b;
border-right: 1px solid #1b1b1b;
border-left: 1px solid #1b1b1b;
border-right: 1px solid #1b1b1b;
}
#themeselector {
padding: 0.04em 0.2em;
vertical-align: top;
font-weight: 560;
padding: 0.04em 0.2em;
vertical-align: top;
font-weight: 560;
}
span.badge.badge-dark {
margin-right: 5px;
margin-right: 5px;
}
.badge-dark, #themeselector {
color: #fff;
background-color: #000000;
border-radius: 0;
border-left: 1px solid #262626;
border-right: 1px solid #262626;
border-top: 1px solid #000;
border-bottom: 1px solid #262626;
color: #fff;
background-color: #000000;
border-radius: 0;
border-left: 1px solid #262626;
border-right: 1px solid #262626;
border-top: 1px solid #000;
border-bottom: 1px solid #262626;
}
.video-js .vjs-control-bar {
background-color: #1b1b1b !important;
background-color: #1b1b1b !important;
}
a#rndbtn {
color: #fff;
background-color: #1b1b1b;
border-radius: 0;
border-left: 1px solid #262626;
border-right: 1px solid #262626;
border-top: 1px solid #262626;
border-bottom: 1px solid #262626;
padding: 0px 5px 0px 5px;
text-decoration: none;
color: #fff;
background-color: #1b1b1b;
border-radius: 0;
border-left: 1px solid #262626;
border-right: 1px solid #262626;
border-top: 1px solid #262626;
border-bottom: 1px solid #262626;
padding: 0px 5px 0px 5px;
text-decoration: none;
}
.contact {
border-left: 1px solid #1b1b1b;
border-right: 1px solid #1b1b1b;
border-bottom: 1px solid #1b1b1b;
padding: 5px;
border-left: 1px solid #1b1b1b;
border-right: 1px solid #1b1b1b;
border-bottom: 1px solid #1b1b1b;
padding: 5px;
}
.irc {
border-left: 1px solid #1b1b1b;
border-right: 1px solid #1b1b1b;
border-bottom: 1px solid #1b1b1b;
padding: 5px;
border-left: 1px solid #1b1b1b;
border-right: 1px solid #1b1b1b;
border-bottom: 1px solid #1b1b1b;
padding: 5px;
}
/* Testing Area */
.content {
position: relative;
position: relative;
}
a#next {
top: 0;
position: absolute;
z-index: 1;
left: 0;
background: transparent;
width: 25%;
height: 95%;
top: 0;
position: absolute;
z-index: 1;
left: 0;
background: transparent;
width: 25%;
height: 95%;
}
a#prev {
position: absolute;
z-index: 1;
right: 0;
background: transparent;
width: 25%;
height: 95%;
position: absolute;
z-index: 1;
right: 0;
background: transparent;
width: 25%;
height: 95%;
}
.vjs-control-bar {
z-index: 2;
z-index: 2;
}
.arrow-prev {
height: 100%;
display: flex;
width: 100%;
align-items: center;
justify-content: end;
height: 100%;
display: flex;
width: 100%;
align-items: center;
justify-content: end;
}
.arrow-next {
height: 100%;
display: flex;
width: 100%;
align-items: center;
justify-content: start;
height: 100%;
display: flex;
width: 100%;
align-items: center;
justify-content: start;
}
a#next:hover {
opacity: 1;
box-shadow: none;
opacity: 1;
box-shadow: none;
}
a#next {
opacity: 0.2;
opacity: 0.2;
}
a#prev:hover {
opacity: 1;
box-shadow: none;
opacity: 1;
box-shadow: none;
}
a#prev {
opacity: 0.2;
opacity: 0.2;
}
/* pagination */
.pagination {
padding: 8px;
background-clip: padding-box;
border: 1px solid;
border-color: #070809 #0d0e0f #131517;
border-color: rgba(0, 0, 0, 0.8) rgba(0, 0, 0, 0.65) rgba(0, 0, 0, 0.5);
border-radius: 3px;
display: inline-block;
vertical-align: baseline;
zoom: 1; *display: inline;
*vertical-align: auto;
background-image: -webkit-linear-gradient(top, rgba(0, 0, 0, 0.12), rgba(0, 0, 0, 0));
background-image: -moz-linear-gradient(top, rgba(0, 0, 0, 0.12), rgba(0, 0, 0, 0));
background-image: -o-linear-gradient(top, rgba(0, 0, 0, 0.12), rgba(0, 0, 0, 0));
background-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.12), rgba(0, 0, 0, 0));
-webkit-box-shadow: 0 1px rgba(255, 255, 255, 0.05);
box-shadow: 0 1px rgba(255, 255, 255, 0.05);
}
.pagination > a, .pagination > span {
float: left;
margin-left: 5px;
padding: 0 6px;
min-width: 17px;
line-height: 27px;
font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
font-size: 12px;
font-weight: 500;
color: #68da20;
text-align: center;
text-decoration: none;
border: 1px solid black;
border-radius: 3px;
}
.pagination :first-child {
margin-left: 0;
}
.pagination > a {
text-decoration: none;
text-shadow: 0 1px black;
background-clip: padding-box;
border-color: rgba(0, 0, 0, 0.9);
background-image: -webkit-linear-gradient(top, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0));
background-image: -moz-linear-gradient(top, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0));
background-image: -o-linear-gradient(top, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0));
background-image: linear-gradient(to bottom, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0));
-webkit-box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.04), inset 0 1px rgba(255, 255, 255, 0.04), inset 0 -1px rgba(0, 0, 0, 0.15), 0 1px 1px rgba(0, 0, 0, 0.1);
box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.04), inset 0 1px rgba(255, 255, 255, 0.04), inset 0 -1px rgba(0, 0, 0, 0.15), 0 1px 1px rgba(0, 0, 0, 0.1);
-webkit-transition: 0.1s ease-out;
-moz-transition: 0.1s ease-out;
-o-transition: 0.1s ease-out;
transition: 0.1s ease-out;
}
.pagination > a:hover {
background-color: #333;
background-color: rgba(255, 255, 255, 0.05);
}
.pagination > span, .pagination > a:active {
color: #68da20;
text-shadow: 0 -1px black;
background: #1c1c1c;
background: rgba(255, 255, 255, 0.01);
border-color: black rgba(0, 0, 0, 0.65) rgba(0, 0, 0, 0.6);
-webkit-box-shadow: inset 0 1px rgba(0, 0, 0, 0.05), inset 0 2px 2px rgba(0, 0, 0, 0.3), 0 1px rgba(255, 255, 255, 0.06);
box-shadow: inset 0 1px rgba(0, 0, 0, 0.05), inset 0 2px 2px rgba(0, 0, 0, 0.3), 0 1px rgba(255, 255, 255, 0.06);
}
.pagination .prev, .pagination .next {
font-family: Noteworthy, Arial, sans-serif;
font-size: 14px;
}
@font-face {
font-family: 'VCR';
src: url('/s/vcr.ttf') format('truetype');
}
span#f0ck {
font-family: 'VCR';
font-size: xx-large;
text-shadow: 1px 1px 1px black, 0px 0px 0px #9f0, -1px -1px 0px black, 1px -1px 0px black, -1px 1px 0px black, 0px 0px 0px #9f0;
}
.navbar-brand {
padding-bottom: 0;
}
/* nav overhaul */
.nav-item {
width: 100%;
text-align: center
}
.navbar-brand {
padding-top: 0
}
.navbar-nav.mr-auto {
flex-flow: row;
justify-content: space-between
}
.navbar.navbar-expand-lg {
background: #242424
}
.navigation-links {
display: flex;
background: #232323;
background-image: none;
border-radius: 3px;
border: 1px solid #000;
background-image: linear-gradient(to bottom,rgba(0,0,0,.12),rgba(0,0,0,0));
-webkit-box-shadow: 0 1px rgba(255,255,255,.05);
box-shadow: 0 1px rgba(255,255,255,.05);
border: 1px solid;
border-top-color: currentcolor;
border-right-color: currentcolor;
border-bottom-color: currentcolor;
border-left-color: currentcolor;
border-top-color: currentcolor;
border-right-color: currentcolor;
border-bottom-color: currentcolor;
border-left-color: currentcolor;
border-color: #070809 #0d0e0f #131517;
border-color: rgba(0,0,0,.8) rgba(0,0,0,.65) rgba(0,0,0,.5);
border-radius: 3px
}
.nav-link {
padding: 0;
display: flex;
border: 1px solid #000;
border-radius: 3px;
transition: .1s ease-out
}
.nav-link {
min-width: 17px;
line-height: 27px;
background-image: -webkit-linear-gradient(top,rgba(255,255,255,.04),rgba(255,255,255,0));
background-image: -moz-linear-gradient(top,rgba(255,255,255,.04),rgba(255,255,255,0));
background-image: -o-linear-gradient(top,rgba(255,255,255,.04),rgba(255,255,255,0));
background-image: linear-gradient(to bottom,rgba(255,255,255,.04),rgba(255,255,255,0));
-webkit-box-shadow: inset 0 0 0 1px rgba(255,255,255,.04),inset 0 1px rgba(255,255,255,.04),inset 0 -1px rgba(0,0,0,.15),0 1px 1px rgba(0,0,0,.1)
}
.nav-item:hover>a:hover {
background-color: #333;
background-color: rgba(255,255,255,.05)
}
.navbar-nav {
padding: 5px
}
.nav-item {
width: 100%;
text-align: center
}
#navbarSupportedContent {
padding: 5px
}
.pagination-container-fluid {
display: flex;
margin-left: 15px
}
.navbar-expand-lg .navbar-nav .nav-link {
padding-right: .5rem;
padding-left: .5rem;
margin-right: 5px;
margin-left: 5px
}
.pagination {
padding: 5px;
background-clip: padding-box;
border: 1px solid;
border-color: #070809 #0d0e0f #131517;
border-color: rgba(0,0,0,.8) rgba(0,0,0,.65) rgba(0,0,0,.5);
border-radius: 3px;
display: inline-block;
vertical-align: baseline;
zoom:1;background-image: -webkit-linear-gradient(top,rgba(0,0,0,.12),rgba(0,0,0,0));
background-image: -moz-linear-gradient(top,rgba(0,0,0,.12),rgba(0,0,0,0));
background-image: -o-linear-gradient(top,rgba(0,0,0,.12),rgba(0,0,0,0));
background-image: linear-gradient(to bottom,rgba(0,0,0,.12),rgba(0,0,0,0));
-webkit-box-shadow: 0 1px rgba(255,255,255,.05);
box-shadow: 0 1px rgba(255,255,255,.05)
}
.pagination>a,.pagination>span {
float: left;
margin-left: 5px;
padding: 0 10px;
min-width: 17px;
line-height: 27px;
font-family: 'Helvetica Neue',Helvetica,Arial,sans-serif;
font-size: 12px;
font-weight: 500;
color: #68da20;
text-align: center;
text-decoration: none;
border: 1px solid #000;
border-radius: 3px
}
.pagination :first-child {
margin-left: 0
}
.pagination>a {
text-decoration: none;
text-shadow: 0 1px #000;
background-clip: padding-box;
border-color: rgba(0,0,0,.9);
background-image: -webkit-linear-gradient(top,rgba(255,255,255,.04),rgba(255,255,255,0));
background-image: -moz-linear-gradient(top,rgba(255,255,255,.04),rgba(255,255,255,0));
background-image: -o-linear-gradient(top,rgba(255,255,255,.04),rgba(255,255,255,0));
background-image: linear-gradient(to bottom,rgba(255,255,255,.04),rgba(255,255,255,0));
-webkit-box-shadow: inset 0 0 0 1px rgba(255,255,255,.04),inset 0 1px rgba(255,255,255,.04),inset 0 -1px rgba(0,0,0,.15),0 1px 1px rgba(0,0,0,.1);
box-shadow: inset 0 0 0 1px rgba(255,255,255,.04),inset 0 1px rgba(255,255,255,.04),inset 0 -1px rgba(0,0,0,.15),0 1px 1px rgba(0,0,0,.1);
-webkit-transition: .1s ease-out;
-moz-transition: .1s ease-out;
-o-transition: .1s ease-out;
transition: .1s ease-out
}
.pagination>a:hover {
background-color: #333;
background-color: rgba(255,255,255,.05)
}
.pagination>a:active,.pagination>span {
color: #68da20;
text-shadow: 0 -1px #000;
background: #1c1c1c;
background: rgba(255,255,255,.01);
border-color: #000 rgba(0,0,0,.65) rgba(0,0,0,.6);
-webkit-box-shadow: inset 0 1px rgba(0,0,0,.05),inset 0 2px 2px rgba(0,0,0,.3),0 1px rgba(255,255,255,.06);
box-shadow: inset 0 1px rgba(0,0,0,.05),inset 0 2px 2px rgba(0,0,0,.3),0 1px rgba(255,255,255,.06)
}
.pagination .next,.pagination .prev {
font-family: Noteworthy,Arial,sans-serif;
font-size: 14px
}
.navbar-nav {
width: 100%;
padding: 5px
}
.nav-link-identifier {
text-align: center;
width: 100%
}
@media (max-width: 768px) {
ul#posts {
grid-template-columns: repeat(auto-fill,minmax(120px,1fr));
text-align: center;
padding-top: 5px
}
}
@media (max-width: 422px) {
ul#posts {
grid-column-gap: 0;
grid-row-gap: 5px
}
.container-fluid,.container-lg,.container-md,.container-sm,.container-xl {
padding-right: 5px;
padding-left: 5px
}
}
@media (max-width: 410px) {
ul#posts {
grid-column-gap: 15px;
grid-row-gap: 10px
}
.container-fluid,.container-lg,.container-md,.container-sm,.container-xl {
padding-right: 15px;
padding-left: 15px
}
}
@media (max-width: 991px) {
.navbar-nav {
width: 100%;
padding: 0
}
.navbar-expand-lg .navbar-nav .nav-link {
margin: 0
}
.pagination-container-fluid {
display: flex;
justify-content: center;
padding-top: 5px;
margin-bottom: 0
}
.navbar {
padding: .5rem 1rem 0
}
.navigation-links {
border-color: transparent transparent transparent
}
.pagination-container-fluid {
margin-left: 0
}
}

View File

@ -320,4 +320,4 @@ video#player {
pre {
letter-spacing: 7px;
}
}

BIN
public/s/img/broken.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 KiB

2
public/s/js/bootstrap-native.min.js vendored Normal file

File diff suppressed because one or more lines are too long

View File

@ -6,7 +6,7 @@ let load = false;
if((((document.documentElement && document.documentElement.scrollTop) || document.body.scrollTop + window.innerHeight) + 310
>= ((document.documentElement && document.documentElement.scrollHeight) || document.body.scrollHeight)) && !load) {
load = true;
fetch(`./api/p/${posts.dataset.last}`)
fetch(`./api/v1/p/${posts.dataset.last}`)
.then(res => res.json())
.then((msg, html = "") => {
for(let i = 0; i < msg.items.length; i++)

BIN
public/s/vcr.ttf Normal file

Binary file not shown.

View File

@ -3,22 +3,22 @@ import sql from "../sql.mjs";
import { parse } from "url";
import cfg from "../../../config.json";
import { mimes, queries } from "./inc/api.mjs";
import { mimes, queries } from "./inc/apiv1.mjs";
router.get("/api", (req, res) => {
router.get("/api/v1", (req, res) => {
res.end("api lol");
});
router.get(/^\/api\/random(\/user\/.+|\/image|\/video|\/audio)?$/, async (req, res) => {
router.get(/^\/api\/v1\/random(\/user\/.+|\/image|\/video|\/audio)?$/, async (req, res) => {
const args = [];
let q = queries.random.main;
if(req.url.split[2] === "user") {
if(req.url.split[3] === "user") {
q += queries.random.where("username like ?");
args.push(req.url.split[3] || "flummi");
args.push(req.url.split[4] || "flummi");
}
else
q += queries.random.where(mimes[req.url.split[2]] ? mimes[req.url.split[2]].map(mime => `mime = "${mime}"`).join(" or ") : null);
q += queries.random.where(mimes[req.url.split[3]] ? mimes[req.url.split[3]].map(mime => `mime = "${mime}"`).join(" or ") : null);
try {
const rows = await sql.query(q, args);
@ -32,7 +32,7 @@ router.get(/^\/api\/random(\/user\/.+|\/image|\/video|\/audio)?$/, async (req, r
}
});
router.get("/api/p", async (req, res) => {
router.get("/api/v1/p", async (req, res) => {
let id = parseInt(req.url.qs.id) || 99999999;
const eps = Math.min(parseInt(req.url.qs.eps) || 100, 200);
let [ order, trend ] = req.url.qs.order === "asc" ? [ "asc", ">" ] : [ "desc", "<" ];
@ -67,9 +67,9 @@ router.get("/api/p", async (req, res) => {
}
});
router.get(/^\/api\/p\/([0-9]+)/, async (req, res) => { // legacy
router.get(/^\/api\/v1\/p\/([0-9]+)/, async (req, res) => { // legacy
let eps = 100;
let id = +req.url.split[2];
let id = +req.url.split[3];
const query = await sql.query("select * from items where id < ? order by id desc limit ?", [ id, eps ]);
const items = {
@ -81,9 +81,9 @@ router.get(/^\/api\/p\/([0-9]+)/, async (req, res) => { // legacy
res.end(JSON.stringify(items), "utf-8");
});
router.get(/^\/api\/item\/[0-9]+$/, async (req, res) => {
router.get(/^\/api\/v1\/item\/[0-9]+$/, async (req, res) => {
try {
const rows = await sql.query(queries.item, Array(3).fill(req.url.split[2]));
const rows = await sql.query(queries.item, Array(3).fill(req.url.split[3]));
res.reply({
type: "application/json",
body: JSON.stringify(rows?.shift() || [])
@ -96,9 +96,9 @@ router.get(/^\/api\/item\/[0-9]+$/, async (req, res) => {
}
});
router.get(/^\/api\/user\/.*(\/[0-9]+)?$/, async (req, res) => { // auf qs umstellen
const user = req.url.split[2];
const eps = Math.min(req.url.split[3] || 50, 50);
router.get(/^\/api\/v1\/user\/.*(\/[0-9]+)?$/, async (req, res) => { // auf qs umstellen
const user = req.url.split[3];
const eps = Math.min(req.url.split[4] || 50, 50);
try {
const rows = await sql.query(queries.user, [ user, eps ]);
res.reply({

View File

@ -1,6 +1,7 @@
import router from "../router.mjs";
import cfg from "../../../config.json";
import url from "url";
import fs from "fs";
import { queries } from "./inc/index.mjs";
import sql from "../sql.mjs";
import lib from "../lib.mjs";
@ -8,22 +9,55 @@ import tpl from "../tpl.mjs";
tpl.readdir("views");
router.get("/", async (req, res) => {
const query = await sql.query("select id, mime from items order by id desc limit 300");
const data = {
items: query,
last: query[query.length - 1].id
};
router.get(/\/(p\/\d+)?$/, async (req, res) => {
try {
const total = (await sql.query("select count(*) as total from items"))[0].total;
const limit = 299;
const pages = +Math.ceil(total / limit);
const page = Math.min(pages, +req.url.split[1] || 1);
const offset = (page - 1) * limit;
res.reply({ body: tpl.render("views/index", data) });
const query = await sql.query("select id, mime from items order by id desc limit ?, ?", [ offset, limit ]);
let cheat = [];
for(let i = Math.max(1, page - 3); i <= Math.min(page + 3, pages); i++)
cheat.push(i);
query.forEach(e => {
if(!fs.existsSync(`public/t/${e.id}.png`))
fs.copyFileSync("public/s/img/broken.png", `public/t/${e.id}.png`);
});
const data = {
items: query,
pagination: {
end: pages,
prev: (page > 1) ? page - 1 : null,
next: (page < pages) ? page + 1 : null,
page: page,
cheat: cheat,
link: "/p/"
},
last: query[query.length - 1].id
};
res.reply({ body: tpl.render("views/index", data) });
} catch(err) {
res.reply({ body: "error :(" });
}
});
router.get(/^\/([0-9]+)$/, async (req, res) => {
const query = (await sql.query(queries.item, Array(3).fill(req.url.split[0])))?.shift();
const qmax = (await sql.query("select id from items order by id desc limit 1"))[0].id;
if(!query?.id)
return res.redirect("/404");
let cheat = [];
for(let i = Math.min(query.id + 3, qmax); i >= Math.max(1, query.id - 3); i--)
cheat.push(i);
const data = {
user: {
name: query.username,
@ -44,7 +78,15 @@ router.get(/^\/([0-9]+)$/, async (req, res) => {
},
next: query.next ? query.next : null,
prev: query.prev ? query.prev : null,
title: `${query.id} - f0ck.me`
title: `${query.id} - f0ck.me`,
pagination: {
end: 1,
prev: query.id + 1,
next: Math.max(query.id - 1, 1),
page: query.id,
cheat: cheat,
link: "/"
}
};
res.reply({ body: tpl.render("views/item", data) });
});

View File

@ -3,7 +3,7 @@ import sql from "../sql.mjs";
import lib from "../lib.mjs";
const _query = "select id, mime, size, username, userchannel, usernetwork, stamp from items where ";
const regex = /https\:\/\/f0ck\.me\/(\d+|(?:b\/)(\w{8})\.(jpg|webm|gif|mp4|png|mov|mp3|ogg|flac))/gi;
const regex = /(https\:\/\/f0ck\.me|http\:\/\/fockmoonsb24iczs7odozzy5uktlzbcgp337nabrgffzxv5ihabgpvyd\.onion)\/(\d+|(?:b\/)(\w{8})\.(jpg|webm|gif|mp4|png|mov|mp3|ogg|flac))/gi;
export default async bot => {

View File

@ -132,9 +132,9 @@ export default async bot => {
speed = !Number.isFinite(speed) ? "yes" : `${speed.toFixed(2)} Mbit/s`;
e.reply([
`title: ${meta.fulltitle}`,
`size: ${lib.formatSize(size)} speed: ${speed}`,
`link: ${cfg.main.url}/${insertq.insertId}`
//`title: ${meta.fulltitle}`,
`link: ${cfg.main.url}/${insertq.insertId} | size: ${lib.formatSize(size)} | speed: ${speed}`
//`link: ${cfg.main.url}/${insertq.insertId}`
]);
});

View File

@ -1,10 +1,10 @@
{{include main/header}}
<div class="container-fluid">
<ul id="posts" data-last="{{=last}}">
<ul id="posts">
{{each items as item}}
<li class="post">
<a href="/{{=item.id}}" title="{{=item.mime}}">
<img class="thumb" src="/t/{{=item.id}}.png" onerror="this.onerror=null;this.src='/s/img/mp3.png';" />
<img class="thumb" src="/t/{{=item.id}}.png" />
<span class="item-mime">{{=item.mime}}</span>
</a>
</li>

View File

@ -1,8 +1,5 @@
{{include main/header}}
<div class="container">
<div class="controls">
<a id="rndbtn" href="/random">Random</a>
</div>
<div class="content">
<div class="next-post">
{{if next}}
@ -10,7 +7,9 @@
<div class="arrow-next">«</div>
</a>
{{else}}
<a id="next" href="#" style="color: #ccc !important;">«</a>
<a id="next" href="#" style="color: #ccc !important;">
<div class="arrow-next">«</div>
</a>
{{/if}}
</div>
<div class="media-object">
@ -37,7 +36,9 @@
<div class="arrow-prev">»</div>
</a>
{{else}}
<a id="prev" href="#" style="color: #ccc !important;">»</a>
<a id="prev" href="#" style="color: #ccc !important;">
<div class="arrow-prev">»</div>
</a>
{{/if}}
</div>
</div>

View File

@ -1,7 +1,7 @@
<script src="./s/js/video.min.js"></script>
<script src="./s/js/videojs.persistvolume.js"></script>
<script src="./s/js/item.js"></script>
<script src="./s/js/scroller.js"></script>
<script src="./s/js/theme.js"></script>
<script src="/s/js/video.min.js"></script>
<script src="/s/js/videojs.persistvolume.js"></script>
<script src="/s/js/item.js"></script>
<script src="/s/js/theme.js"></script>
<script src="/s/js/bootstrap-native.min.js"></script>
</body>
</html>

View File

@ -2,11 +2,11 @@
<html>
<head>
<title>{{if data.title}}{{=data.title}}{{else}}f0ck!{{/if}}</title>
<link rel="icon" type="image/png" href="./s/img/favicon.png" />
<link rel="stylesheet" type="text/css" href="./s/css/video-js.min.css" />
<link rel="stylesheet" type="text/css" href="./s/css/vsg-skin.css" />
<link rel="stylesheet" type="text/css" href="./s/css/bootstrap.css" />
<link rel="stylesheet" type="text/css" href="./s/css/f0ck-custom.css" />
<link rel="icon" type="image/gif" href="/s/img/favicon.gif" />
<link rel="stylesheet" type="text/css" href="/s/css/video-js.min.css" />
<link rel="stylesheet" type="text/css" href="/s/css/vsg-skin.css" />
<link rel="stylesheet" type="text/css" href="/s/css/bootstrap.css" />
<link rel="stylesheet" type="text/css" href="/s/css/f0ck-custom.css" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="description" content="f0ck.me is the place where internet purists gather to celebrate content of all kinds">
{{if data.item}}

View File

@ -0,0 +1,15 @@
{{if typeof pagination !== "undefined"}}
<nav class="pagination">
<a href="{{=pagination.link}}1" class="start{{if !pagination.prev}} disabled{{/if}}">&laquo;</a>
<a href="{{=pagination.link}}{{=pagination.prev}}" class="prev{{if !pagination.prev}} disabled{{/if}}">&lsaquo;</a>
{{each pagination.cheat as i}}
{{if i == pagination.page}}
<span>{{=i}}</span>
{{else}}
<a href="{{=pagination.link}}{{=i}}">{{=i}}</a>
{{/if}}
{{/each}}
<a href="{{=pagination.link}}{{=pagination.next}}" class="next{{if !pagination.next}} disabled{{/if}}">&rsaquo;</a>
<a href="{{=pagination.link}}{{=pagination.end}}" class="start{{if !pagination.next}} disabled{{/if}}">&raquo;</a>
</nav>
{{/if}}

View File

@ -1,18 +1,27 @@
<nav class="navbar navbar-expand-lg">
<a class="navbar-brand" href="/">
<img src="./s/img/f0ck_logo.png" width="112" height="28">
<span id="f0ck" width="" height="">F0CK</span>
</a>
<div class="collapse navbar-collapse" id="navbarNavDropdown">
<ul class="navbar-nav">
<li class="nav-item active">
<a class="nav-link" id="random" href="/random"><span class="rndtext">Random</span></a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse show" id="navbarSupportedContent">
<div class="navigation-links">
<ul class="navbar-nav ">
<li class="nav-item">
<a class="nav-link" href="/random"><span class="nav-link-identifier">Random</span></a>
</li>
<li class="nav-item">
<a class="nav-link" href="/how"><span class="hlptext">Help</span></a>
<a class="nav-link" href="/about"><span class="nav-link-identifier">About</span></a>
</li>
<li class="nav-item">
<a class="nav-link" href="/contact"><span class="cnttext">Contact</span></a>
<a class="nav-link" href="/contact"><span class="nav-link-identifier">Contact</span></a>
</li>
</ul>
</div>
<div class="pagination-container-fluid">
{{include partials/pagination}}
</div>
</div>
</nav>

16
views/test.html Normal file
View File

@ -0,0 +1,16 @@
{{include main/header}}
<div class="container-fluid">
{{include partials/pagination}}
<ul id="posts">
{{each items as item}}
<li class="post">
<a href="/{{=item.id}}" title="{{=item.mime}}">
<img class="thumb" src="/t/{{=item.id}}.png" />
<span class="item-mime">{{=item.mime}}</span>
</a>
</li>
{{/each}}
</ul>
{{include partials/pagination}}
</div>
{{include main/footer}}