forked from f0ck/f0ckv2
Compare commits
28 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
728f044066 | ||
|
30ac7ef6be | ||
|
aadcfd41a0 | ||
|
1a491df018 | ||
|
bf653b042e | ||
|
1e4432ee1f | ||
|
6df28b4c5f | ||
|
5ec5fcfbf5 | ||
|
c508f2008c | ||
|
7ba56d9012 | ||
|
2696c4aac4 | ||
|
7b56660cac | ||
|
75cea742d7 | ||
|
b86b739d38 | ||
|
5fcd88b824 | ||
|
b12189c3e5 | ||
|
7399e0c74f | ||
|
0fb699996b | ||
|
a431795c27 | ||
|
408a55d1df | ||
|
e21f0e9940 | ||
|
c85c08140e | ||
|
b249a87166 | ||
|
6a002feff5 | ||
|
6f23d5b904 | ||
|
b997c1c530 | ||
|
65be5dc3e8 | ||
|
70df109d1b |
@ -5,6 +5,7 @@
|
||||
"domain": "f0ck.dev",
|
||||
"regex": "f0ck\\.dev"
|
||||
},
|
||||
"socks": "",
|
||||
"maxfilesize": 83886080,
|
||||
"adminmultiplier": 3.5,
|
||||
"ignored": [
|
||||
|
1
f0ck.sql
1
f0ck.sql
@ -422,7 +422,6 @@ CREATE TABLE public.user_sessions (
|
||||
browser character varying(255) NOT NULL,
|
||||
created_at integer NOT NULL,
|
||||
last_used integer NOT NULL,
|
||||
last_action character varying(255) NOT NULL,
|
||||
kmsi smallint DEFAULT '0'::smallint NOT NULL
|
||||
);
|
||||
|
||||
|
133
package-lock.json
generated
133
package-lock.json
generated
@ -12,6 +12,7 @@
|
||||
"cuffeo": "^1.2.2",
|
||||
"flumm-fetch": "^1.0.1",
|
||||
"flummpress": "^2.0.5",
|
||||
"node-fetch": "^3.3.2",
|
||||
"postgres": "^3.3.4"
|
||||
}
|
||||
},
|
||||
@ -23,6 +24,38 @@
|
||||
"flumm-fetch": "^1.0.1"
|
||||
}
|
||||
},
|
||||
"node_modules/data-uri-to-buffer": {
|
||||
"version": "4.0.1",
|
||||
"resolved": "https://registry.npmjs.org/data-uri-to-buffer/-/data-uri-to-buffer-4.0.1.tgz",
|
||||
"integrity": "sha512-0R9ikRb668HB7QDxT1vkpuUBtqc53YyAwMwGeUFKRojY/NWKvdZ+9UYtRfGmhqNbRkTSVpMbmyhXipFFv2cb/A==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">= 12"
|
||||
}
|
||||
},
|
||||
"node_modules/fetch-blob": {
|
||||
"version": "3.2.0",
|
||||
"resolved": "https://registry.npmjs.org/fetch-blob/-/fetch-blob-3.2.0.tgz",
|
||||
"integrity": "sha512-7yAQpD2UMJzLi1Dqv7qFYnPbaPx7ZfFK6PiIxQ4PfkGPyNyl2Ugx+a/umUonmKqjhM4DnfbMvdX6otXq83soQQ==",
|
||||
"funding": [
|
||||
{
|
||||
"type": "github",
|
||||
"url": "https://github.com/sponsors/jimmywarting"
|
||||
},
|
||||
{
|
||||
"type": "paypal",
|
||||
"url": "https://paypal.me/jimmywarting"
|
||||
}
|
||||
],
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"node-domexception": "^1.0.0",
|
||||
"web-streams-polyfill": "^3.0.3"
|
||||
},
|
||||
"engines": {
|
||||
"node": "^12.20 || >= 14.13"
|
||||
}
|
||||
},
|
||||
"node_modules/flumm-fetch": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/flumm-fetch/-/flumm-fetch-1.0.1.tgz",
|
||||
@ -33,6 +66,55 @@
|
||||
"resolved": "https://registry.npmjs.org/flummpress/-/flummpress-2.0.5.tgz",
|
||||
"integrity": "sha512-C/8Im6OvoZw67q9DvYIXKjKr28zHYLJdH4DucQ6zpVbN1eWPySmxkJTURbkq3uEwABXLngXLifS6mjxAC++umQ=="
|
||||
},
|
||||
"node_modules/formdata-polyfill": {
|
||||
"version": "4.0.10",
|
||||
"resolved": "https://registry.npmjs.org/formdata-polyfill/-/formdata-polyfill-4.0.10.tgz",
|
||||
"integrity": "sha512-buewHzMvYL29jdeQTVILecSaZKnt/RJWjoZCF5OW60Z67/GmSLBkOFM7qh1PI3zFNtJbaZL5eQu1vLfazOwj4g==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"fetch-blob": "^3.1.2"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=12.20.0"
|
||||
}
|
||||
},
|
||||
"node_modules/node-domexception": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/node-domexception/-/node-domexception-1.0.0.tgz",
|
||||
"integrity": "sha512-/jKZoMpw0F8GRwl4/eLROPA3cfcXtLApP0QzLmUT/HuPCZWyB7IY9ZrMeKw2O/nFIqPQB3PVM9aYm0F312AXDQ==",
|
||||
"funding": [
|
||||
{
|
||||
"type": "github",
|
||||
"url": "https://github.com/sponsors/jimmywarting"
|
||||
},
|
||||
{
|
||||
"type": "github",
|
||||
"url": "https://paypal.me/jimmywarting"
|
||||
}
|
||||
],
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=10.5.0"
|
||||
}
|
||||
},
|
||||
"node_modules/node-fetch": {
|
||||
"version": "3.3.2",
|
||||
"resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-3.3.2.tgz",
|
||||
"integrity": "sha512-dRB78srN/l6gqWulah9SrxeYnxeddIG30+GOqK/9OlLVyLg3HPnr6SqOWTWOXKRwC2eGYCkZ59NNuSgvSrpgOA==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"data-uri-to-buffer": "^4.0.0",
|
||||
"fetch-blob": "^3.1.4",
|
||||
"formdata-polyfill": "^4.0.10"
|
||||
},
|
||||
"engines": {
|
||||
"node": "^12.20.0 || ^14.13.1 || >=16.0.0"
|
||||
},
|
||||
"funding": {
|
||||
"type": "opencollective",
|
||||
"url": "https://opencollective.com/node-fetch"
|
||||
}
|
||||
},
|
||||
"node_modules/postgres": {
|
||||
"version": "3.3.4",
|
||||
"resolved": "https://registry.npmjs.org/postgres/-/postgres-3.3.4.tgz",
|
||||
@ -41,6 +123,15 @@
|
||||
"type": "individual",
|
||||
"url": "https://github.com/sponsors/porsager"
|
||||
}
|
||||
},
|
||||
"node_modules/web-streams-polyfill": {
|
||||
"version": "3.3.3",
|
||||
"resolved": "https://registry.npmjs.org/web-streams-polyfill/-/web-streams-polyfill-3.3.3.tgz",
|
||||
"integrity": "sha512-d2JWLCivmZYTSIoge9MsgFCZrt571BikcWGYkjC1khllbTeDlGqZ2D8vD8E/lJa8WGWbb7Plm8/XJYV7IJHZZw==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">= 8"
|
||||
}
|
||||
}
|
||||
},
|
||||
"dependencies": {
|
||||
@ -52,6 +143,20 @@
|
||||
"flumm-fetch": "^1.0.1"
|
||||
}
|
||||
},
|
||||
"data-uri-to-buffer": {
|
||||
"version": "4.0.1",
|
||||
"resolved": "https://registry.npmjs.org/data-uri-to-buffer/-/data-uri-to-buffer-4.0.1.tgz",
|
||||
"integrity": "sha512-0R9ikRb668HB7QDxT1vkpuUBtqc53YyAwMwGeUFKRojY/NWKvdZ+9UYtRfGmhqNbRkTSVpMbmyhXipFFv2cb/A=="
|
||||
},
|
||||
"fetch-blob": {
|
||||
"version": "3.2.0",
|
||||
"resolved": "https://registry.npmjs.org/fetch-blob/-/fetch-blob-3.2.0.tgz",
|
||||
"integrity": "sha512-7yAQpD2UMJzLi1Dqv7qFYnPbaPx7ZfFK6PiIxQ4PfkGPyNyl2Ugx+a/umUonmKqjhM4DnfbMvdX6otXq83soQQ==",
|
||||
"requires": {
|
||||
"node-domexception": "^1.0.0",
|
||||
"web-streams-polyfill": "^3.0.3"
|
||||
}
|
||||
},
|
||||
"flumm-fetch": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/flumm-fetch/-/flumm-fetch-1.0.1.tgz",
|
||||
@ -62,10 +167,38 @@
|
||||
"resolved": "https://registry.npmjs.org/flummpress/-/flummpress-2.0.5.tgz",
|
||||
"integrity": "sha512-C/8Im6OvoZw67q9DvYIXKjKr28zHYLJdH4DucQ6zpVbN1eWPySmxkJTURbkq3uEwABXLngXLifS6mjxAC++umQ=="
|
||||
},
|
||||
"formdata-polyfill": {
|
||||
"version": "4.0.10",
|
||||
"resolved": "https://registry.npmjs.org/formdata-polyfill/-/formdata-polyfill-4.0.10.tgz",
|
||||
"integrity": "sha512-buewHzMvYL29jdeQTVILecSaZKnt/RJWjoZCF5OW60Z67/GmSLBkOFM7qh1PI3zFNtJbaZL5eQu1vLfazOwj4g==",
|
||||
"requires": {
|
||||
"fetch-blob": "^3.1.2"
|
||||
}
|
||||
},
|
||||
"node-domexception": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/node-domexception/-/node-domexception-1.0.0.tgz",
|
||||
"integrity": "sha512-/jKZoMpw0F8GRwl4/eLROPA3cfcXtLApP0QzLmUT/HuPCZWyB7IY9ZrMeKw2O/nFIqPQB3PVM9aYm0F312AXDQ=="
|
||||
},
|
||||
"node-fetch": {
|
||||
"version": "3.3.2",
|
||||
"resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-3.3.2.tgz",
|
||||
"integrity": "sha512-dRB78srN/l6gqWulah9SrxeYnxeddIG30+GOqK/9OlLVyLg3HPnr6SqOWTWOXKRwC2eGYCkZ59NNuSgvSrpgOA==",
|
||||
"requires": {
|
||||
"data-uri-to-buffer": "^4.0.0",
|
||||
"fetch-blob": "^3.1.4",
|
||||
"formdata-polyfill": "^4.0.10"
|
||||
}
|
||||
},
|
||||
"postgres": {
|
||||
"version": "3.3.4",
|
||||
"resolved": "https://registry.npmjs.org/postgres/-/postgres-3.3.4.tgz",
|
||||
"integrity": "sha512-XVu0+d/Y56pl2lSaf0c7V19AhAEfpVrhID1IENWN8nf0xch6hFq6dAov5dtUX6ZD46wfr1TxvLhxLtV8WnNsOg=="
|
||||
},
|
||||
"web-streams-polyfill": {
|
||||
"version": "3.3.3",
|
||||
"resolved": "https://registry.npmjs.org/web-streams-polyfill/-/web-streams-polyfill-3.3.3.tgz",
|
||||
"integrity": "sha512-d2JWLCivmZYTSIoge9MsgFCZrt571BikcWGYkjC1khllbTeDlGqZ2D8vD8E/lJa8WGWbb7Plm8/XJYV7IJHZZw=="
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -18,6 +18,7 @@
|
||||
"cuffeo": "^1.2.2",
|
||||
"flumm-fetch": "^1.0.1",
|
||||
"flummpress": "^2.0.5",
|
||||
"node-fetch": "^3.3.2",
|
||||
"postgres": "^3.3.4"
|
||||
}
|
||||
}
|
||||
|
@ -463,6 +463,10 @@ html[theme="paper"] .login-form button[type="submit"] {
|
||||
color: black;
|
||||
}
|
||||
|
||||
html[theme="paper"] .btn.disabled {
|
||||
text-shadow: 1px 1px 3px;
|
||||
}
|
||||
|
||||
html[theme="atmos"] {
|
||||
--accent: #1fb2b0;
|
||||
--bg: #161618;
|
||||
@ -581,10 +585,6 @@ html[theme="term"] span#favs {
|
||||
border: 1px solid var(--black);
|
||||
}
|
||||
|
||||
html[theme="term"] .metadata {
|
||||
text-shadow: 0px 0px 1px var(--accent), 1px 0px 2px var(--accent), 0px 0px 5px var(--black);
|
||||
}
|
||||
|
||||
html[theme="term"] .metadata>.badge-dark,
|
||||
#themeselector {
|
||||
box-shadow: var(--pagination-anchor-box-shadow);
|
||||
@ -3016,3 +3016,134 @@ input#s_avatar {
|
||||
#s_avatar:hover {
|
||||
background: #ffffff0f;
|
||||
}
|
||||
|
||||
/* nav ↓ (mobile) */
|
||||
@media (max-width: 768px) {
|
||||
body {
|
||||
display: grid;
|
||||
grid-template-rows: 1fr auto;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.navbar.navbar-expand-lg {
|
||||
grid-row-start: 2;
|
||||
position: sticky;
|
||||
bottom: 0;
|
||||
}
|
||||
|
||||
.nav-link .user span {
|
||||
visibility: hidden;
|
||||
}
|
||||
|
||||
.navbar-nav {
|
||||
display: grid !important;
|
||||
grid-template-rows: 1fr;
|
||||
grid-template-columns: 1fr 1fr 1fr 1fr 1fr;
|
||||
grid-gap: 0.25em;
|
||||
}
|
||||
|
||||
.dropdown-menu {
|
||||
position: absolute;
|
||||
bottom: 30px;
|
||||
top: unset;
|
||||
}
|
||||
|
||||
.navbar-brand {
|
||||
line-height: 1.5;
|
||||
}
|
||||
|
||||
.navUserName {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.container {
|
||||
padding-top: 15px;
|
||||
padding-bottom: 3em;
|
||||
padding-left: 15px;
|
||||
padding-right: 15px;
|
||||
}
|
||||
|
||||
html {
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.err {
|
||||
margin: unset;
|
||||
width: unset;
|
||||
}
|
||||
|
||||
.dropdown-menu {
|
||||
list-style: none;
|
||||
padding: 0;
|
||||
min-width: 25vw;
|
||||
border-left: 1px solid;
|
||||
border-right: 1px solid;
|
||||
border-bottom: 1px solid;
|
||||
border-top: 1px solid;
|
||||
border-color: var(--black);
|
||||
margin-bottom: 0;
|
||||
text-align: left;
|
||||
box-shadow: 2px 3px 5px var(--black);
|
||||
}
|
||||
|
||||
.dropdown-menu li {
|
||||
padding-left: 6px;
|
||||
}
|
||||
|
||||
.nav-link {
|
||||
border-radius: 0;
|
||||
}
|
||||
|
||||
.metadata {
|
||||
grid-template-columns: auto;
|
||||
}
|
||||
|
||||
button[data-skip="-10"] {
|
||||
display: none;
|
||||
}
|
||||
|
||||
button[data-skip="10"] {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.v0ck_player_button {
|
||||
font-family: monospace;
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
tr {
|
||||
display: grid;
|
||||
grid-template-columns: auto 1fr;
|
||||
}
|
||||
|
||||
tbody td {
|
||||
box-shadow: none;
|
||||
}
|
||||
|
||||
table tr td:nth-child(4) {
|
||||
color: yellow;
|
||||
font-size: xx-large;
|
||||
font-family: 'VCR';
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
align-self: center;
|
||||
}
|
||||
|
||||
td:nth-child(1) {
|
||||
grid-column: 1;
|
||||
}
|
||||
|
||||
td:nth-child(2) {
|
||||
grid-column: 2;
|
||||
grid-row: 2;
|
||||
}
|
||||
|
||||
td:nth-child(3) {
|
||||
grid-column: 2;
|
||||
grid-row: 1;
|
||||
}
|
||||
|
||||
td:nth-child(4) {
|
||||
grid-column: 3;
|
||||
}
|
||||
}
|
@ -219,16 +219,6 @@ window.requestAnimFrame = (function(){
|
||||
elem = document.querySelector(".pagination > .prev:not(.disabled)");
|
||||
}
|
||||
}
|
||||
else {
|
||||
if(Math.abs(swipeRT.yDiff) > swipeOpt.treshold && timeDiff < swipeOpt.timeout) {
|
||||
if(navbar = document.querySelector("nav.navbar") && document.querySelector("div.posts")) {
|
||||
if(swipeRT.yDiff > 0 && (window.innerHeight + window.scrollY) >= document.body.offsetHeight) // up
|
||||
elem = document.querySelector(".pagination > .next:not(.disabled)");
|
||||
else if(swipeRT.yDiff <= 0 && window.scrollY <= 0 && document.querySelector("div.posts")) // down
|
||||
elem = document.querySelector(".pagination > .prev:not(.disabled)");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
swipeRT.xDown = null;
|
||||
swipeRT.yDown = null;
|
||||
|
@ -149,8 +149,16 @@ class v0ck {
|
||||
|
||||
player.addEventListener('click', e => {
|
||||
const path = e.path || (e.composedPath && e.composedPath());
|
||||
if(!path.filter(f => f.classList?.contains('v0ck_player_controls')).length)
|
||||
togglePlay(e);
|
||||
if(path.filter(f => f.classList?.contains('v0ck_player_controls')).length)
|
||||
return;
|
||||
|
||||
//navigator.userAgentData = { mobile: true };
|
||||
if(navigator.userAgentData?.mobile) { // mobile
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
togglePlay(e);
|
||||
});
|
||||
toggle.addEventListener('click', togglePlay);
|
||||
video.addEventListener('play', updatePlayIcon);
|
||||
|
@ -1,6 +1,13 @@
|
||||
import fetch from 'flumm-fetch';
|
||||
import fetch from 'node-fetch';
|
||||
import cfg from './config.mjs';
|
||||
|
||||
const parseOutput = text => {
|
||||
text = text.trim().toLowerCase();
|
||||
return text.includes(', ')
|
||||
? text.split(', ')
|
||||
: text.replace(/\d\. /g, '').split('\n');
|
||||
};
|
||||
|
||||
export default new class autotagger {
|
||||
async isNSFW(filename, filesize) {
|
||||
let opts = {
|
||||
@ -29,4 +36,34 @@ export default new class autotagger {
|
||||
else
|
||||
return res.unsafe;
|
||||
};
|
||||
|
||||
async getTags(id) {
|
||||
if(!id)
|
||||
return;
|
||||
|
||||
try {
|
||||
const f0ck = `${cfg.main.url.full}/t/${id}.webp`;
|
||||
const blob = await (await fetch(f0ck)).arrayBuffer();
|
||||
|
||||
const res = await fetch(`${cfg.apis.cf.url}/${cfg.apis.cf.id}/ai/run/${cfg.apis.cf.model}`, {
|
||||
method: "POST",
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
"Authorization": `Bearer ${cfg.apis.cf.key}`
|
||||
},
|
||||
body: JSON.stringify({
|
||||
image: [ ...new Uint8Array(blob) ],
|
||||
prompt: "Generate eight comma separated tags without colors for this image.",
|
||||
max_tokens: 128
|
||||
})
|
||||
});
|
||||
const json = await res.json();
|
||||
console.log(json.result.description);
|
||||
return parseOutput(json.result.description);
|
||||
} catch(err) {
|
||||
return {
|
||||
error: err.message || "unknown error"
|
||||
};
|
||||
}
|
||||
};
|
||||
};
|
||||
|
@ -31,11 +31,11 @@ export default (router, tpl) => {
|
||||
return res.reply({ body: "user doesn't exist or wrong password" });
|
||||
const stamp = ~~(Date.now() / 1e3);
|
||||
|
||||
await db`
|
||||
/*await db`
|
||||
delete from user_sessions
|
||||
where last_action <= ${(Date.now() - 6048e5)}
|
||||
where last_used <= ${(Date.now() - 6048e5)}
|
||||
and kmsi = 0
|
||||
`;
|
||||
`;*/
|
||||
|
||||
const session = lib.md5(lib.createID());
|
||||
const blah = {
|
||||
@ -44,13 +44,12 @@ export default (router, tpl) => {
|
||||
browser: req.headers["user-agent"],
|
||||
created_at: stamp,
|
||||
last_used: stamp,
|
||||
last_action: "/login",
|
||||
kmsi: typeof req.post.kmsi !== 'undefined' ? 1 : 0
|
||||
};
|
||||
|
||||
await db`
|
||||
insert into "user_sessions" ${
|
||||
db(blah, 'user_id', 'session', 'browser', 'created_at', 'last_used', 'last_action', 'kmsi')
|
||||
db(blah, 'user_id', 'session', 'browser', 'created_at', 'last_used', 'kmsi')
|
||||
}
|
||||
`;
|
||||
|
||||
|
@ -10,7 +10,7 @@ const auth = async (req, res, next) => {
|
||||
};
|
||||
|
||||
export default (router, tpl) => {
|
||||
router.get(/\/user\/(?<user>.*)/, async (req, res) => {
|
||||
router.get(/\/user\/(?<user>.*)/, lib.loggedin, async (req, res) => {
|
||||
const user = decodeURIComponent(req.params.user);
|
||||
|
||||
const query = await db`
|
||||
@ -82,6 +82,9 @@ export default (router, tpl) => {
|
||||
|
||||
router.get(/^\/?(?:\/tag\/(?<tag>.+?))?(?:\/user\/(?<user>.+?)\/(?<mode>f0cks|favs))?(?:\/(?<mime>image|audio|video))?(?:\/p\/(?<page>\d+))?(?:\/(?<itemid>\d+))?$/, async (req, res) => {
|
||||
const mode = req.params.itemid ? 'item' : 'index';
|
||||
if(mode === 'item' && !req.session)
|
||||
return res.redirect('/login');
|
||||
|
||||
const data = await (req.params.itemid ? f0cklib.getf0ck : f0cklib.getf0cks)({
|
||||
user: req.params.user,
|
||||
tag: req.params.tag,
|
||||
|
@ -1,8 +1,9 @@
|
||||
import cfg from "../../inc/config.mjs";
|
||||
import lib from "../lib.mjs";
|
||||
import f0cklib from "../routeinc/f0cklib.mjs";
|
||||
|
||||
export default (router, tpl) => {
|
||||
router.get(/^\/random$/, async (req, res) => {
|
||||
router.get(/^\/random$/, lib.loggedin, async (req, res) => {
|
||||
let referer = req.headers.referer ?? '';
|
||||
let opts = {};
|
||||
|
||||
@ -33,7 +34,7 @@ export default (router, tpl) => {
|
||||
});
|
||||
}
|
||||
|
||||
res.redirect(`${data.link.main}${data.link.path}${data.itemid}`);
|
||||
res.redirect(encodeURI(`${data.link.main}${data.link.path}${data.itemid}`));
|
||||
});
|
||||
return router;
|
||||
};
|
||||
|
@ -73,7 +73,7 @@ export default async bot => {
|
||||
// is instagram
|
||||
try {
|
||||
// @flummi -> is there a variable for the actual work directory so it doesn't have to be hardcoded?
|
||||
const meta = JSON.parse((await queue.exec(`yt-dlp -f 'bv*[height<=720]+ba/b[height<=720] / wv*+ba/w' --skip-download --dump-json "${link}"`)).stdout);
|
||||
const meta = JSON.parse((await queue.exec(`yt-dlp --proxy ${cfg.main.socks} -f 'bv*[height<=720]+ba/b[height<=720] / wv*+ba/w' --skip-download --dump-json "${link}"`)).stdout);
|
||||
ext = meta.ext;
|
||||
} catch(err) {
|
||||
const tmphead = (await fetch(link, { method: "HEAD" })).headers["content-type"];
|
||||
@ -88,7 +88,7 @@ export default async bot => {
|
||||
else {
|
||||
// is not instagram
|
||||
try {
|
||||
const meta = JSON.parse((await queue.exec(`yt-dlp -f 'bv*[height<=720]+ba/b[height<=720] / wv*+ba/w' --skip-download --dump-json "${link}"`)).stdout);
|
||||
const meta = JSON.parse((await queue.exec(`yt-dlp --proxy ${cfg.main.socks} -f 'bv*[height<=720]+ba/b[height<=720] / wv*+ba/w' --skip-download --dump-json "${link}"`)).stdout);
|
||||
ext = meta.ext;
|
||||
} catch(err) {
|
||||
const tmphead = (await fetch(link, { method: "HEAD" })).headers["content-type"];
|
||||
@ -98,6 +98,7 @@ export default async bot => {
|
||||
}
|
||||
|
||||
if(!Object.values(cfg.mimes).includes(ext?.toLowerCase())) {
|
||||
await e.reply("mime schmime");
|
||||
return console.log('mime schmime ' + ext);
|
||||
}
|
||||
|
||||
@ -112,7 +113,7 @@ export default async bot => {
|
||||
if(link.match(regex.instagram)) {
|
||||
try {
|
||||
// add --cookies <path-to-cookies-file> on local instance if you want to avoid getting rate limited
|
||||
source = (await queue.exec(`yt-dlp -f 'bv*[height<=720]+ba/b[height<=720] / wv*+ba/w' "${link}" --max-filesize ${maxfilesize / 1024}k --postprocessor-args "ffmpeg:-bitexact" -o "./tmp/${uuid}.%(ext)s" --print after_move:filepath --merge-output-format "mp4"`)).stdout.trim();
|
||||
source = (await queue.exec(`yt-dlp --proxy ${cfg.main.socks} -f 'bv*[height<=720]+ba/b[height<=720] / wv*+ba/w' "${link}" --max-filesize ${maxfilesize / 1024}k --postprocessor-args "ffmpeg:-bitexact" -o "./tmp/${uuid}.%(ext)s" --print after_move:filepath --merge-output-format "mp4"`)).stdout.trim();
|
||||
} catch(err) {
|
||||
if(e.type == 'tg')
|
||||
return await e.editMessageText(msg.result.chat.id, msg.result.message_id, "instagram dl error");
|
||||
@ -122,7 +123,8 @@ export default async bot => {
|
||||
else if(link.match(regex.imgur)) {
|
||||
// imghure via torsocks
|
||||
try {
|
||||
await queue.exec(`torsocks wget ${link} -O ./tmp/${uuid}.${ext}`);
|
||||
//await queue.exec(`torsocks wget ${link} -O ./tmp/${uuid}.${ext}`);
|
||||
await queue.exec(`curl -x ${cfg.main.socks} ${link} --output ./tmp/${uuid}.${ext}`);
|
||||
source = `./tmp/${uuid}.${ext}`;
|
||||
} catch(err) {
|
||||
console.error('err:', err);
|
||||
@ -133,7 +135,7 @@ export default async bot => {
|
||||
}
|
||||
else {
|
||||
try {
|
||||
source = (await queue.exec(`yt-dlp -f 'bv*[height<=720]+ba/b[height<=720] / wv*+ba/w' "${link}" --max-filesize ${maxfilesize / 1024}k --postprocessor-args "ffmpeg:-bitexact" -o "./tmp/${uuid}.%(ext)s" --print after_move:filepath --merge-output-format "mp4"`)).stdout.trim();
|
||||
source = (await queue.exec(`yt-dlp --proxy ${cfg.main.socks} -f 'bv*[height<=720]+ba/b[height<=720] / wv*+ba/w' "${link}" --max-filesize ${maxfilesize / 1024}k --postprocessor-args "ffmpeg:-bitexact" -o "./tmp/${uuid}.%(ext)s" --print after_move:filepath --merge-output-format "mp4"`)).stdout.trim();
|
||||
} catch(err) {
|
||||
console.error('err:', err);
|
||||
if(e.type == 'tg')
|
||||
@ -253,29 +255,12 @@ export default async bot => {
|
||||
let speed = lib.calcSpeed(size, end);
|
||||
speed = !Number.isFinite(speed) ? "yes" : `${speed.toFixed(2)} Mbit/s`;
|
||||
|
||||
// autotagger
|
||||
let tags = [];
|
||||
/*if(cfg.apis?.nsfw1 && mime.startsWith('image')) {
|
||||
const nsfw = await autotagger.isNSFW(filename, size);
|
||||
tags.push(nsfw ? 'nsfw' : 'sfw');
|
||||
if(nsfw)
|
||||
await queue.tagNSFW(itemid);
|
||||
else
|
||||
await queue.tagSFW(itemid);
|
||||
}*/
|
||||
|
||||
let outputmsgirc = `[f0cked] link: ${cfg.main.url.full}/${itemid} | size: ${lib.formatSize(size)} | speed: ${speed}`;
|
||||
let outputmsgtg = `[f0cked] size: ${lib.formatSize(size)} | speed: ${speed}`;
|
||||
|
||||
if(tags?.length > 0) {
|
||||
const tagstr = tags.join(', ');
|
||||
outputmsgirc += ` | tags: ${tagstr}`;
|
||||
outputmsgtg += ` | tags: ${tagstr}`;
|
||||
}
|
||||
|
||||
if(e.type == 'tg') {
|
||||
await e.deleteMessage(msg.result.chat.id, msg.result.message_id);
|
||||
await e.reply(outputmsgtg, {
|
||||
/*await e.reply(outputmsgtg, {
|
||||
reply_markup: JSON.stringify({
|
||||
inline_keyboard: [[
|
||||
{ text: (await lib.hasTag(itemid, 1) ? '✓ ' : '') + 'sfw', callback_data: `b_sfw:${itemid}` },
|
||||
@ -286,6 +271,42 @@ export default async bot => {
|
||||
{ text: `open f0ck #${itemid}`, url: `${cfg.main.url.full}/${itemid}` }
|
||||
]]
|
||||
})
|
||||
});*/
|
||||
|
||||
let tags;
|
||||
|
||||
try {
|
||||
tags = (await autotagger.getTags(itemid))
|
||||
.map(t => ({ text: t, callback_data: 'nope' }));
|
||||
await e.reply(outputmsgtg, {
|
||||
reply_markup: JSON.stringify({
|
||||
inline_keyboard: [[
|
||||
{ text: (await lib.hasTag(itemid, 1) ? '✓ ' : '') + 'sfw', callback_data: `b_sfw:${itemid}` },
|
||||
{ text: (await lib.hasTag(itemid, 2) ? '✓ ' : '') + 'nsfw', callback_data: `b_nsfw:${itemid}` },
|
||||
],
|
||||
[ ...tags.splice(0, 4) ],
|
||||
[ ...tags.splice(0, 4) ],
|
||||
[
|
||||
{ text: `open f0ck #${itemid}`, url: `${cfg.main.url.full}/${itemid}` },
|
||||
{ text: '❌ delete', callback_data: `b_delete:${itemid}` }
|
||||
]]
|
||||
})
|
||||
});
|
||||
return;
|
||||
} catch(err) {
|
||||
console.error(err);
|
||||
}
|
||||
|
||||
await e.reply(outputmsgtg, {
|
||||
reply_markup: JSON.stringify({
|
||||
inline_keyboard: [[
|
||||
{ text: (await lib.hasTag(itemid, 1) ? '✓ ' : '') + 'sfw', callback_data: `b_sfw:${itemid}` },
|
||||
{ text: (await lib.hasTag(itemid, 2) ? '✓ ' : '') + 'nsfw', callback_data: `b_nsfw:${itemid}` },
|
||||
], [
|
||||
{ text: `open f0ck #${itemid}`, url: `${cfg.main.url.full}/${itemid}` },
|
||||
{ text: '❌ delete', callback_data: `b_delete:${itemid}` }
|
||||
]]
|
||||
})
|
||||
});
|
||||
}
|
||||
else {
|
||||
|
@ -94,9 +94,8 @@ process.on('unhandledRejection', err => {
|
||||
update "user_sessions" set ${
|
||||
db({
|
||||
last_used: ~~(Date.now() / 1e3),
|
||||
last_action: req.url.pathname,
|
||||
browser: req.headers['user-agent']
|
||||
}, 'last_used', 'last_action', 'browser')
|
||||
}, 'last_used', 'browser')
|
||||
}
|
||||
where id = ${+user[0].sess_id}
|
||||
`;
|
||||
|
@ -26,7 +26,7 @@
|
||||
<ul>
|
||||
<li>You must be 18 years or older to visit or post</li>
|
||||
<li>You shall not post animal cruelty, we like our animals alive and well, living a happy life until they are ready for our Schnitzel!</li>
|
||||
<li>You shall not post under <b>ANY</b> circumstances: Snuff, Beastiality, Rape, Terrorist stuff (Beheadings, First person shootings, warcrimes), Childporn, Childmodeling</li>
|
||||
<li>You shall not post under <b>ANY</b> circumstances: Snuff, Beastiality, Rape, Terrorist stuff (Beheadings, First person shootings, warcrimes), Politics, News, Childporn, Childmodeling</li>
|
||||
</ul>
|
||||
<h5>f0cked up?</h5>
|
||||
<p>To have something removed in case you accidentally f0cked something that actually shouldn't be f0cked you can always contact the admins either via IRC or Email</p>
|
||||
@ -38,11 +38,6 @@
|
||||
<p>f0ck is developed and tested for Firefox and Chromium in their latest versions</p>
|
||||
<p>If you encounter bugs please report them so we can fix them.</p>
|
||||
<p>Microsoft Edgy is not actively supported, but if it werks, great! Same for anything apple related.</p>
|
||||
<h5>Tinfoil f0ckers listen!</h5>
|
||||
<p>f0ck onions and moons, but fockulite!</p>
|
||||
<p>http://fockmoonsb24iczs7odozzy5uktlzbcgp337nabrgffzxv5ihabgpvyd.onion</p>
|
||||
<p>http://fockulite74atso2xsxxw6q2gzqrgck572tiwvkyf5vdxictjn2vmlyd.onion</p>
|
||||
<p>f0ck is completely functional without javascript enabled, you can be the beardiest neckbeard of all, we got you m'gentleman, if you want to use a custom theme you gotta allow our style cookie.</p>
|
||||
<h5>f0ck Privacy?</h5>
|
||||
<p>Cookies: Yes, we set 1 cookie for your prefered stylesheet, this is a optional cookie and not required for the site to function, simply cosmetics, you can block this cookie and the site will still work as intended and will default to the default f0ck theme called "f0ck"</p>
|
||||
<p>Logs: We do not log users accessing our website.</p>
|
||||
|
@ -10,7 +10,6 @@
|
||||
<td>browser</td>
|
||||
<td>created_at</td>
|
||||
<td>last_used</td>
|
||||
<td>last_action</td>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@ -23,7 +22,6 @@
|
||||
<td>{{ session.browser }}</td>
|
||||
<td>{{ new Date(session.created_at * 1e3).toLocaleString("de-DE") }}</td>
|
||||
<td>{{ new Date(session.last_used * 1e3).toLocaleString("de-DE") }}</td>
|
||||
<td>{{ session.last_action }}</td>
|
||||
</tr>
|
||||
@endeach
|
||||
</tbody>
|
||||
|
@ -9,7 +9,7 @@
|
||||
<body type="login">
|
||||
<form class="login-form" method="post" action="/login">
|
||||
<p><a href="/"><img src="/s/img/f0ck_small.png" /></a></p>
|
||||
<input type="text" name="username" placeholder="username" autocomplete="off" required />
|
||||
<input type="text" name="username" placeholder="username" autocomplete="off" autofocus required />
|
||||
<input type="password" name="password" placeholder="password" autocomplete="off" required />
|
||||
<p><input type="checkbox" id="kmsi" name="kmsi" /> <label for="kmsi">stay signed in</label></p>
|
||||
<button type="submit">Login</button>
|
||||
|
@ -5,7 +5,7 @@
|
||||
<ul class="navbar-nav">
|
||||
<li class="nav-item dropdown">
|
||||
<a class="nav-link user" href="#" content="{{ session.user }}" data-toggle="dropdown">
|
||||
<img src="@if(session.avatar)/t/{{ session.avatar }}.webp@else/s/img/ava/default.png@endif" class="avatar"><span>@if(session.admin)⭐ @endif{{ session.user }}</span>
|
||||
<img src="@if(session.avatar)/t/{{ session.avatar }}.webp@else/s/img/ava/default.png@endif" class="avatar"><span class="navUserName">@if(session.admin)⭐ @endif{{ session.user }}</span>
|
||||
</a>
|
||||
<ul class="dropdown-menu">
|
||||
<li><a href="/user/{{ session.user.toLowerCase() }}">my profile</a></li>
|
||||
|
Loading…
x
Reference in New Issue
Block a user