yes
This commit is contained in:
		| @@ -170,21 +170,27 @@ html[theme="paper"] { | |||||||
|   --pagination-border-color: rgba(0,0,0,.8) rgba(0,0,0,.65) rgba(0,0,0,.5); |   --pagination-border-color: rgba(0,0,0,.8) rgba(0,0,0,.65) rgba(0,0,0,.5); | ||||||
|   --metadata-bg: #fff; |   --metadata-bg: #fff; | ||||||
|   --badge-bg: #fff; |   --badge-bg: #fff; | ||||||
|   --posts-meta-bg: #000000b8; |   --posts-meta-bg: #000000db; | ||||||
|   --badge-sfw: #68a728; |   --badge-sfw: #68a728; | ||||||
|   --badge-nsfw: #a72828; |   --badge-nsfw: #a72828; | ||||||
|   --badge-tag: #6c6c6c; |   --badge-tag: #6c6c6c; | ||||||
|   --scrollbar-color: #6c6c6c; |   --scrollbar-color: #6c6c6c; | ||||||
| } | } | ||||||
|  |  | ||||||
|  | html[theme="paper"] body { | ||||||
|  |   color: var(--black); | ||||||
|  | } | ||||||
|  |  | ||||||
| html[theme="paper"] a#next { | html[theme="paper"] a#next { | ||||||
|   color: var(--white) !important; |   color: var(--white) !important; | ||||||
|   -webkit-text-stroke: 1px var(--black); |   -webkit-text-stroke: 1px var(--black); | ||||||
|  |   font-size: 40; | ||||||
| } | } | ||||||
|  |  | ||||||
| html[theme="paper"] a#prev { | html[theme="paper"] a#prev { | ||||||
|   color: var(--white) !important; |   color: var(--white) !important; | ||||||
|   -webkit-text-stroke: 1px var(--black); |   -webkit-text-stroke: 1px var(--black); | ||||||
|  |   font-size: 40; | ||||||
| } | } | ||||||
|  |  | ||||||
| html[theme="paper"] .about { | html[theme="paper"] .about { | ||||||
| @@ -197,6 +203,23 @@ html[theme="paper"] .about a:hover { | |||||||
|  |  | ||||||
| html[theme="paper"] div#posts > a::after { | html[theme="paper"] div#posts > a::after { | ||||||
|   color: var(--white); |   color: var(--white); | ||||||
|  |   border-top-left-radius: 5px; | ||||||
|  |   border-top-right-radius: 5px; | ||||||
|  | } | ||||||
|  |  | ||||||
|  | html[theme="paper"] .v0ck_player_controls > input[type="range"][name="volume"]::-webkit-slider-thumb { | ||||||
|  |   background: var(--white); | ||||||
|  |   box-shadow: -100vw 0 0 100vw var(--white); | ||||||
|  | } | ||||||
|  |  | ||||||
|  | html[theme="paper"] .v0ck_player_controls > input[type="range"][name="volume"]::-moz-range-thumb { | ||||||
|  |   background: var(--white); | ||||||
|  |   box-shadow: -100vw 0 0 100vw var(--white); | ||||||
|  | } | ||||||
|  |  | ||||||
|  | html[theme="paper"] div#posts > a { | ||||||
|  |   box-shadow: 1px 1px 1px black; | ||||||
|  |   border-radius: 5px; | ||||||
| } | } | ||||||
|  |  | ||||||
| html[theme="paper"] .v0ck_progress_filled { | html[theme="paper"] .v0ck_progress_filled { | ||||||
| @@ -220,6 +243,11 @@ html[theme="paper"] .embed-responsive-image { | |||||||
|   background: var(--white); |   background: var(--white); | ||||||
| } | } | ||||||
|  |  | ||||||
|  | html[theme="paper"] .v0ck_player_button svg:hover { | ||||||
|  |   fill: var(--black); | ||||||
|  |   stroke: var(--white); | ||||||
|  | } | ||||||
|  |  | ||||||
| html[theme="atmos"] { | html[theme="atmos"] { | ||||||
|   --accent: #1fb2b0; |   --accent: #1fb2b0; | ||||||
|   --bg: #161618; |   --bg: #161618; | ||||||
| @@ -334,7 +362,7 @@ div#posts { | |||||||
|   margin: 0; |   margin: 0; | ||||||
|   padding: 0; |   padding: 0; | ||||||
|   margin-top: 15px; |   margin-top: 15px; | ||||||
|   margin-bottom: 15px; |   margin-bottom: 35px; | ||||||
| } | } | ||||||
|  |  | ||||||
| @media (max-width: 376px) { | @media (max-width: 376px) { | ||||||
| @@ -489,9 +517,12 @@ span.f0ck { | |||||||
|   background-color: var(--nav-link-hover-bg); |   background-color: var(--nav-link-hover-bg); | ||||||
| } | } | ||||||
|  |  | ||||||
| .nav-link[data-toggle="dropdown"]::after { | .nav-link[data-toggle="dropdown"].ddcontent::after { | ||||||
|   content: "\00a0(" attr(content) ")\00a0\25bc"; |   content: "\00a0(" attr(content) ")\00a0\25bc"; | ||||||
| } | } | ||||||
|  | .nav-link[data-toggle="dropdown"]:not(.ddcontent)::after { | ||||||
|  |   content: "\00a0\25bc"; | ||||||
|  | } | ||||||
|  |  | ||||||
| @media (max-width: 768px) { | @media (max-width: 768px) { | ||||||
|   .nav-link[data-toggle="dropdown"]::after { |   .nav-link[data-toggle="dropdown"]::after { | ||||||
| @@ -866,6 +897,10 @@ span#tags { | |||||||
|   grid-column: 1/4; |   grid-column: 1/4; | ||||||
| } | } | ||||||
|  |  | ||||||
|  | span#tags:empty { | ||||||
|  |     display: none; | ||||||
|  | } | ||||||
|  |  | ||||||
| .badge-success { | .badge-success { | ||||||
|   color: var(--white); |   color: var(--white); | ||||||
|   background-color: var(--badge-sfw); |   background-color: var(--badge-sfw); | ||||||
| @@ -1129,3 +1164,26 @@ div#flash.warn { | |||||||
|   border-bottom: 2px solid #dad55e; |   border-bottom: 2px solid #dad55e; | ||||||
|   color: #777620; |   color: #777620; | ||||||
| } | } | ||||||
|  |  | ||||||
|  | /* sfw/nsfw indexpage */ | ||||||
|  | div#posts > a > p { | ||||||
|  |   height: 100%; | ||||||
|  |   width: 100%; | ||||||
|  | } | ||||||
|  | div#posts > a > p:before { | ||||||
|  |   content: ""; | ||||||
|  |   position: absolute; | ||||||
|  |   right: 0; | ||||||
|  |   bottom: 0; | ||||||
|  |   height: 10px; | ||||||
|  |   width: 10px; | ||||||
|  | } | ||||||
|  | div#posts > a[data-mode="sfw"] > p:before { | ||||||
|  |   background-color: #5cb85c; | ||||||
|  | } | ||||||
|  | div#posts > a[data-mode="nsfw"] > p:before { | ||||||
|  |   background-color: #a72828; | ||||||
|  | } | ||||||
|  | div#posts > a[data-mode="null"] > p:before { | ||||||
|  |   background-color: #dcd512; | ||||||
|  | } | ||||||
|   | |||||||
| @@ -22,13 +22,13 @@ const flash = ({ type, msg }) => { | |||||||
|   flashActive = true; |   flashActive = true; | ||||||
|   flashContainer.animate( |   flashContainer.animate( | ||||||
|     [ { bottom: "-28px" }, { bottom: 0 } ], { |     [ { bottom: "-28px" }, { bottom: 0 } ], { | ||||||
|       duration: 400, |       duration: 500, | ||||||
|       fill: "both" |       fill: "both" | ||||||
|     } |     } | ||||||
|   ).onfinish = () => setTimeout(() => { |   ).onfinish = () => setTimeout(() => { | ||||||
|     flashContainer.animate( |     flashContainer.animate( | ||||||
|       [ { bottom: 0 }, { bottom: "-28px" } ], { |       [ { bottom: 0 }, { bottom: "-28px" } ], { | ||||||
|         duration: 400, |         duration: 500, | ||||||
|         fill: "both" |         fill: "both" | ||||||
|       } |       } | ||||||
|     ).onfinish = () => flashActive = false; |     ).onfinish = () => flashActive = false; | ||||||
|   | |||||||
| @@ -13,10 +13,12 @@ const allowedMimes = [ "audio", "image", "video", "%" ]; | |||||||
| router.get(/^\/(audio\/?|image\/?|video\/?)?(p\/\d+)?$/, async (req, res) => { | router.get(/^\/(audio\/?|image\/?|video\/?)?(p\/\d+)?$/, async (req, res) => { | ||||||
|   const tmpmime = (allowedMimes.filter(n => req.url.split[0].startsWith(n))[0] ? req.url.split[0] : ""); |   const tmpmime = (allowedMimes.filter(n => req.url.split[0].startsWith(n))[0] ? req.url.split[0] : ""); | ||||||
|   const mime = tmpmime + "%"; |   const mime = tmpmime + "%"; | ||||||
|  |   const tmp = req.cookies.session ? "" : "id in (select item_id from tags_assign where tag_id = 1 group by item_id)"; | ||||||
|  |  | ||||||
|   const total = ( |   const total = ( | ||||||
|     await sql("items") |     await sql("items") | ||||||
|       .where("mime", "like", mime) |       .whereRaw(tmp) | ||||||
|  |       .andWhere("items.mime", "like", mime) | ||||||
|       .count("* as total") |       .count("* as total") | ||||||
|   )[0].total; |   )[0].total; | ||||||
|  |  | ||||||
| @@ -25,9 +27,10 @@ router.get(/^\/(audio\/?|image\/?|video\/?)?(p\/\d+)?$/, async (req, res) => { | |||||||
|   const offset = (page - 1) * cfg.websrv.eps; |   const offset = (page - 1) * cfg.websrv.eps; | ||||||
|  |  | ||||||
|   const rows = await sql("items") |   const rows = await sql("items") | ||||||
|     .select("id", "mime") |     .select("items.id", "items.mime") | ||||||
|     .where("mime", "like", mime) |     .whereRaw(tmp) | ||||||
|     .orderBy("id", "desc") |     .andWhere("items.mime", "like", mime) | ||||||
|  |     .orderBy("items.id", "desc") | ||||||
|     .offset(offset) |     .offset(offset) | ||||||
|     .limit(cfg.websrv.eps); |     .limit(cfg.websrv.eps); | ||||||
|  |  | ||||||
| @@ -62,6 +65,7 @@ router.get(/^\/((audio\/|video\/|image\/)?[0-9]+)$/, async (req, res) => { | |||||||
|   let id = false; |   let id = false; | ||||||
|   let mime = ""; |   let mime = ""; | ||||||
|   let tmpmime = false; |   let tmpmime = false; | ||||||
|  |   const tmp = req.cookies.session ? "" : "id in (select item_id from tags_assign where tag_id = 1 group by item_id)"; | ||||||
|    |    | ||||||
|   if(allowedMimes.filter(n => req.url.split[0].startsWith(n))[0] ? req.url.split[0] : "") { |   if(allowedMimes.filter(n => req.url.split[0].startsWith(n))[0] ? req.url.split[0] : "") { | ||||||
|     mime = tmpmime = req.url.split[0]; |     mime = tmpmime = req.url.split[0]; | ||||||
| @@ -73,18 +77,18 @@ router.get(/^\/((audio\/|video\/|image\/)?[0-9]+)$/, async (req, res) => { | |||||||
|   } |   } | ||||||
|   mime += "/%"; |   mime += "/%"; | ||||||
|  |  | ||||||
|   const query = (await sql("items").where("id", id).andWhere("mime", "like", mime).limit(1))?.shift(); |   const query = (await sql("items").whereRaw(tmp).andWhere("id", id).andWhere("mime", "like", mime).limit(1))?.shift(); | ||||||
|  |  | ||||||
|   if(!query?.id) |   if(!query?.id) | ||||||
|     return res.redirect("/404"); |     return res.redirect("/404"); | ||||||
|  |  | ||||||
|   const tags = await sql("tags_assign").leftJoin("tags", "tags.id", "tags_assign.tag_id").where("tags_assign.item_id", id); |   const tags = await sql("tags_assign").leftJoin("tags", "tags.id", "tags_assign.tag_id").where("tags_assign.item_id", id); | ||||||
|  |  | ||||||
|   const qmin = await sql("items").select("id").where("mime", "like", mime).orderBy("id").limit(1); |   const qmin = await sql("items").select("id").whereRaw(tmp).andWhere("mime", "like", mime).orderBy("id").limit(1); | ||||||
|   const qmax = await sql("items").select("id").where("mime", "like", mime).orderBy("id", "desc").limit(1); |   const qmax = await sql("items").select("id").whereRaw(tmp).andWhere("mime", "like", mime).orderBy("id", "desc").limit(1); | ||||||
|  |  | ||||||
|   const qnext = (await sql("items").select("id").where("id", ">", id).andWhere("mime", "like", mime).orderBy("id").limit(3)).reverse(); |   const qnext = (await sql("items").select("id").whereRaw(tmp).andWhere("id", ">", id).andWhere("mime", "like", mime).orderBy("id").limit(3)).reverse(); | ||||||
|   const qprev = await sql("items").select("id").where("id", "<", id).andWhere("mime", "like", mime).orderBy("id", "desc").limit(3); |   const qprev = await sql("items").select("id").whereRaw(tmp).andWhere("id", "<", id).andWhere("mime", "like", mime).orderBy("id", "desc").limit(3); | ||||||
|  |  | ||||||
|   const cheat = qnext.concat([{ id: id }].concat(qprev)).map(e => +e.id); |   const cheat = qnext.concat([{ id: id }].concat(qprev)).map(e => +e.id); | ||||||
|   const next = qnext[qnext.length - 1] ? qnext[qnext.length - 1].id : false; |   const next = qnext[qnext.length - 1] ? qnext[qnext.length - 1].id : false; | ||||||
|   | |||||||
| @@ -5,7 +5,8 @@ const allowedMimes = [ "audio", "image", "video", "%" ]; | |||||||
|  |  | ||||||
| router.get(/^\/random(\/image|\/video|\/audio)?$/, async (req, res) => { | router.get(/^\/random(\/image|\/video|\/audio)?$/, async (req, res) => { | ||||||
|   const mime = (allowedMimes.filter(n => req.url.split[1]?.startsWith(n))[0] ? req.url.split[1] : "") + "%"; |   const mime = (allowedMimes.filter(n => req.url.split[1]?.startsWith(n))[0] ? req.url.split[1] : "") + "%"; | ||||||
|   const rows = await sql("items").select("id").where("mime", "like", mime).orderByRaw("rand()").limit(1); |   const tmp = req.cookies.session ? "" : "id in (select item_id from tags_assign where tag_id = 1 group by item_id)"; | ||||||
|  |   const rows = await sql("items").select("id").whereRaw(tmp).andWhere("mime", "like", mime).orderByRaw("rand()").limit(1); | ||||||
|  |  | ||||||
|   res.redirect(`/${req.url.split[1] ? req.url.split[1] + "/" : ""}${rows[0].id}`); |   res.redirect(`/${req.url.split[1] ? req.url.split[1] + "/" : ""}${rows[0].id}`); | ||||||
| }); | }); | ||||||
|   | |||||||
| @@ -4,6 +4,37 @@ import cfg from "../../inc/config.mjs"; | |||||||
| import sql from "../sql.mjs"; | import sql from "../sql.mjs"; | ||||||
| import lib from "../lib.mjs"; | import lib from "../lib.mjs"; | ||||||
|  |  | ||||||
|  | const cleanTags = async () => { | ||||||
|  |   const tags = await sql("tags").leftJoin("tags_assign", "tags_assign.tag_id", "tags.id").whereNull("tags_assign.item_id"); | ||||||
|  |   if(tags.length === 0) | ||||||
|  |     return 0; | ||||||
|  |    | ||||||
|  |   let deleteTag = sql("tags"); | ||||||
|  |   let dtags = 0; | ||||||
|  |   tags.forEach(tag => { | ||||||
|  |     if(["sfw", "nsfw"].includes(tag.tag.toLowerCase())) | ||||||
|  |       return dtags; | ||||||
|  |     deleteTag = deleteTag.orWhere("id", tag.id); | ||||||
|  |     dtags++; | ||||||
|  |   }); | ||||||
|  |   await deleteTag.del(); | ||||||
|  |   return dtags; | ||||||
|  | }; | ||||||
|  |  | ||||||
|  | const countf0cks = async () => { | ||||||
|  |   const tagged = (await sql("items").whereRaw("id in (select item_id from tags_assign group by item_id)").count("* as total"))[0].total; | ||||||
|  |   const untagged = (await sql("items").whereRaw("id not in (select item_id from tags_assign group by item_id)").count("* as total"))[0].total; | ||||||
|  |   const sfw = (await sql("items").whereRaw("id in (select item_id from tags_assign where tag_id = 1 group by item_id)").count("* as total"))[0].total; | ||||||
|  |   const nsfw = (await sql("items").whereRaw("id in (select item_id from tags_assign where tag_id = 2 group by item_id)").count("* as total"))[0].total; | ||||||
|  |   return { | ||||||
|  |     tagged, | ||||||
|  |     untagged, | ||||||
|  |     total: tagged + untagged, | ||||||
|  |     sfw, | ||||||
|  |     nsfw | ||||||
|  |   }; | ||||||
|  | }; | ||||||
|  |  | ||||||
| export default async bot => { | export default async bot => { | ||||||
|  |  | ||||||
|   return [{ |   return [{ | ||||||
| @@ -47,6 +78,14 @@ export default async bot => { | |||||||
|           e.reply("hay hay patron, hemen!"); |           e.reply("hay hay patron, hemen!"); | ||||||
|           exec("sudo systemctl restart f0ck"); |           exec("sudo systemctl restart f0ck"); | ||||||
|         break; |         break; | ||||||
|  |         case "cleanTags": | ||||||
|  |           const tags = await cleanTags(); | ||||||
|  |           e.reply(tags + " tags removed"); | ||||||
|  |         break; | ||||||
|  |         case "status": | ||||||
|  |           const tmpc = await countf0cks(); | ||||||
|  |           e.reply(`tagged: ${tmpc.tagged}; untagged: ${tmpc.untagged}; sfw: ${tmpc.sfw}; nsfw: ${tmpc.nsfw}; total: ${tmpc.total}`); | ||||||
|  |         break; | ||||||
|         default: |         default: | ||||||
|           return; |           return; | ||||||
|       } |       } | ||||||
|   | |||||||
| @@ -52,7 +52,7 @@ export default async bot => { | |||||||
|           meta = JSON.parse((await exec(`youtube-dl -f "bestvideo[ext=mp4,filesize<${maxfilesize}k][width<2000][height<=1200]+bestaudio[ext=m4a,filesize<${maxfilesize}k]/bestvideo[width<2000][height<=1200]+bestaudio/best[width<2000][height<=1200]/best"  --skip-download --dump-json "${link}"`)).stdout); |           meta = JSON.parse((await exec(`youtube-dl -f "bestvideo[ext=mp4,filesize<${maxfilesize}k][width<2000][height<=1200]+bestaudio[ext=m4a,filesize<${maxfilesize}k]/bestvideo[width<2000][height<=1200]+bestaudio/best[width<2000][height<=1200]/best"  --skip-download --dump-json "${link}"`)).stdout); | ||||||
|         } |         } | ||||||
|         catch(err) { |         catch(err) { | ||||||
|           //e.reply("(╯° °)╯︵ ┻━┻)"); |           e.reply("[error] f0ck has no bock :("); | ||||||
|           console.error(err); |           console.error(err); | ||||||
|           return; |           return; | ||||||
|         } |         } | ||||||
| @@ -74,10 +74,12 @@ export default async bot => { | |||||||
|         let source; |         let source; | ||||||
|         if(meta.ext === "mp4") { |         if(meta.ext === "mp4") { | ||||||
|           source = (await exec(`youtube-dl "${link}" --max-filesize ${maxfilesize}k -f "bestvideo[ext=mp4,filesize<${maxfilesize}k][width<2000][height<=1200]+bestaudio[ext=m4a,filesize<${maxfilesize}k]/bestvideo[width<2000][height<=1200]+bestaudio/best[width<2000][height<=1200]/best" --merge-output-format mp4 -o ./tmp/${filename}`)).stdout.trim(); |           source = (await exec(`youtube-dl "${link}" --max-filesize ${maxfilesize}k -f "bestvideo[ext=mp4,filesize<${maxfilesize}k][width<2000][height<=1200]+bestaudio[ext=m4a,filesize<${maxfilesize}k]/bestvideo[width<2000][height<=1200]+bestaudio/best[width<2000][height<=1200]/best" --merge-output-format mp4 -o ./tmp/${filename}`)).stdout.trim(); | ||||||
|  |           //change yt-dlp to youtube-dl if problem ^ | ||||||
|           //console.log("mp4 lol"); |           //console.log("mp4 lol"); | ||||||
|         } |         } | ||||||
|         else { |         else { | ||||||
|           source = (await exec(`youtube-dl "${link}" --max-filesize ${maxfilesize}k -f "bestvideo[filesize<${maxfilesize}k][width<2000][height<=1200][ext=${meta.ext}]+bestaudio[filesize<${maxfilesize}k][ext=${meta.ext}]/best" -o ./tmp/${filename}`)).stdout.trim(); |           source = (await exec(`youtube-dl "${link}" --max-filesize ${maxfilesize}k -f "bestvideo[filesize<${maxfilesize}k][width<2000][height<=1200][ext=${meta.ext}]+bestaudio[filesize<${maxfilesize}k][ext=${meta.ext}]/best" -o ./tmp/${filename}`)).stdout.trim(); | ||||||
|  |           //change yt-dlp to youtube-dl if problem ^ | ||||||
|           //console.log("alles andere lol"); |           //console.log("alles andere lol"); | ||||||
|         } |         } | ||||||
|         //console.log(source); |         //console.log(source); | ||||||
| @@ -149,7 +151,7 @@ export default async bot => { | |||||||
|         speed = !Number.isFinite(speed) ? "yes" : `${speed.toFixed(2)} Mbit/s`; |         speed = !Number.isFinite(speed) ? "yes" : `${speed.toFixed(2)} Mbit/s`; | ||||||
|  |  | ||||||
|         e.reply([ |         e.reply([ | ||||||
|           `link: ${cfg.main.url}/${insertq} | size: ${lib.formatSize(size)} | speed: ${speed}` |           `[f0cked] link: ${cfg.main.url}/${insertq} | size: ${lib.formatSize(size)} | speed: ${speed}` | ||||||
|         ]); |         ]); | ||||||
|  |  | ||||||
|       }); |       }); | ||||||
|   | |||||||
| @@ -1,5 +1,5 @@ | |||||||
| <nav class="navbar navbar-expand-lg"> | <nav class="navbar navbar-expand-lg"> | ||||||
|   <a class="navbar-brand" href="/admin"><span class="f0ck">F0CK</span></a> |   <a class="navbar-brand" href="/"><span class="f0ck">F0CK</span></a> | ||||||
|   <div class="navigation-links"> |   <div class="navigation-links"> | ||||||
|     <ul class="navbar-nav"> |     <ul class="navbar-nav"> | ||||||
|       <li class="nav-item dropdown" id="themes"> |       <li class="nav-item dropdown" id="themes"> | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user