aktueller Stand

This commit is contained in:
Flummi 2017-07-27 08:56:37 +02:00
parent 19c2d224b1
commit ff392f35ff
8 changed files with 37 additions and 37 deletions

4
bot.js
View File

@ -30,7 +30,7 @@ var child = new (forever.Monitor)(__dirname+'/src/main.js', {
watch: true, watch: true,
watchIgnoreDotFiles: true, watchIgnoreDotFiles: true,
watchIgnorePatterns: [ watchIgnorePatterns: [
'*.log', 'b/*', 't/*', 'node_modules/*' '*.log', 'b/*', 't/*', 'node_modules/* ./.*'
], ],
watchDirectory: __dirname, watchDirectory: __dirname,
outFile: log_bot, outFile: log_bot,
@ -50,4 +50,4 @@ child.on('exit:code', (code) => {
putlog('detected bot exited with code ' + code + '\n'); putlog('detected bot exited with code ' + code + '\n');
child.restart(); child.restart();
}); });
child.start(); child.start();

View File

@ -6,8 +6,7 @@
</head> </head>
<body> <body>
<div class="contact"> <div class="contact">
<h4>This is a side project of <a href="https://w0bm.com" target="_blank">w0bm.com</a></h4> <p>Got a problem? We have the answer: <a href="mailto:admin@f0ck.space">admin@f0ck.space</a></p>
<p>Got a problem? We have the answer: <a href="mailto:admin@w0bm.com">admin@w0bm.com</a></p>
<a href="/">return to main</a> <span id="themes"></span> <a href="/">return to main</a> <span id="themes"></span>
</div> </div>
<script src="./s/theme.js"></script> <script src="./s/theme.js"></script>

View File

@ -7,7 +7,7 @@
<link rel="icon" type="image/gif" href="./s/favicon.gif" /> <link rel="icon" type="image/gif" href="./s/favicon.gif" />
<meta name="Description" content="f0cked by {{ username }}" /> <meta name="Description" content="f0cked by {{ username }}" />
<meta property="og:image" content="https://f0ck.me/t/{{ id }}.png" /> <meta property="og:image" content="https://f0ck.cf/t/{{ id }}.png" />
</head> </head>
<body> <body>
<div class="return"><a href="/" title="return to main">f0ck.me</a></div> <div class="return"><a href="/" title="return to main">f0ck.me</a></div>

View File

@ -75,4 +75,4 @@ self.write = (kat, key, value, type, cb) => {
}); });
} }
}); });
}; };

View File

@ -240,4 +240,4 @@ self.genStdTrigger = () => {
out[entry.name] = entry.active?true:false; out[entry.name] = entry.active?true:false;
}); });
return out; return out;
}; };

View File

@ -13,7 +13,7 @@ module.exports = (lib) => {
name: 'parser', name: 'parser',
call: /https?:\/\/[\w-]+(\.[\w-]+)+\.?(:\d+)?(\/\S*)?/gi, call: /https?:\/\/[\w-]+(\.[\w-]+)+\.?(:\d+)?(\/\S*)?/gi,
level: 0, level: 0,
active: 0, active: 1,
func: (e, userlevel) => { func: (e, userlevel) => {
if(e.channel.getName() === lib.cfg.main.debugchannel || e.message.match(/(!|-)f0ck/i)) { if(e.channel.getName() === lib.cfg.main.debugchannel || e.message.match(/(!|-)f0ck/i)) {
if(!e.message.match(/(!|-)ignore/)) { if(!e.message.match(/(!|-)ignore/)) {
@ -137,7 +137,7 @@ module.exports = (lib) => {
}, },
(err, res, data) => { (err, res, data) => {
if(!err) { if(!err) {
var type = res.headers['content-type']; var type = res.headers['content-type'].split(";")[0];
lib.log('MimeType: '+type); lib.log('MimeType: '+type);
if(lib.cfg.main.allowedMimes.hasOwnProperty(type)) { if(lib.cfg.main.allowedMimes.hasOwnProperty(type)) {
if( ( data.length <= lib.cfg.main.maxFileSize ) || force || ( userlevel >= 60 && data.length <= (lib.cfg.main.maxFileSize * 2) ) ) { if( ( data.length <= lib.cfg.main.maxFileSize ) || force || ( userlevel >= 60 && data.length <= (lib.cfg.main.maxFileSize * 2) ) ) {
@ -208,4 +208,4 @@ module.exports = (lib) => {
cb({ success: false, file: tmpdest, msg: 'repost motherf0cker: '+lib.cfg.main.url+'/'+cbcr }); cb({ success: false, file: tmpdest, msg: 'repost motherf0cker: '+lib.cfg.main.url+'/'+cbcr });
}); });
}; };
}; };

View File

@ -8,10 +8,10 @@ module.exports = (lib) => {
active: 0, active: 0,
func: (e) => { func: (e) => {
lib.sql.query("select count(`id`) as anzahl from `f0ck`.`items`", (err, rows, fields) => { lib.sql.query("select count(`id`) as anzahl from `f0ck`.`items`", (err, rows, fields) => {
var ret = "f0ck gave "+String(rows[0].anzahl); var ret = "gave "+String(rows[0].anzahl);
du('./b/', function (err, size) { du('./b/', function (err, size) {
ret += " f0cks ("+lib.formatSize(size)+")"; ret += " f0cks ("+lib.formatSize(size)+")";
e.reply(ret); e.replyAction(ret);
}) })
}); });
}, },

View File

@ -179,30 +179,30 @@ function Websrv(tlib) {
|| contentType === "audio/mpeg" || contentType === "audio/mpeg"
|| contentType === "audio/ogg") && req.headers['range']) { || contentType === "audio/ogg") && req.headers['range']) {
fs.readFile(filePath, "binary", function(err, file) { fs.readFile(filePath, "binary", function(err, file) {
if(typeof req.headers.range !== 'undefined') { if(typeof req.headers.range !== 'undefined') {
var range = req.headers.range; var range = req.headers.range;
var parts = range.replace(/bytes=/, "").split("-"); var parts = range.replace(/bytes=/, "").split("-");
var partialstart = parts[0]; var partialstart = parts[0];
var partialend = parts[1]; var partialend = parts[1];
var total = file.length; var total = file.length;
var start = parseInt(partialstart, 10); var start = parseInt(partialstart, 10);
var end = partialend ? parseInt(partialend, 10) : total-1; var end = partialend ? parseInt(partialend, 10) : total-1;
res.writeHead(206, { res.writeHead(206, {
"Content-Range": "bytes " + start + "-" + end + "/" + (total), "Content-Range": "bytes " + start + "-" + end + "/" + (total),
"Accept-Ranges": "bytes", "Accept-Ranges": "bytes",
"Content-Length": (end-start)+1, "Content-Length": (end-start)+1,
"Transfer-Encoding": "chunked", "Transfer-Encoding": "chunked",
"Connection": "close" "Connection": "close"
}); });
res.write(file.slice(start, end)+'0', "binary"); res.write(file.slice(start, end)+'0', "binary");
} }
else { else {
res.writeHead(200); res.writeHead(200);
res.write(file, "binary"); res.write(file, "binary");
} }
res.end(); res.end();
}); });
} }
else { else {
fs.readFile(filePath, (error, content) => { fs.readFile(filePath, (error, content) => {
@ -218,7 +218,8 @@ function Websrv(tlib) {
} }
} }
else { else {
res.writeHead(200, { 'Content-Type': contentType, 'Content-Length': content.length, 'Cache-Control': 'max-age=2592000, public' }); //res.writeHead(200, { 'Content-Type': contentType, 'Content-Length': content.length, 'Cache-Control': 'max-age=2592000, public' });
res.writeHead(200);
res.end(content, 'utf-8'); res.end(content, 'utf-8');
} }
}); });
@ -311,4 +312,4 @@ Websrv.prototype.getTpls = () => {
"how": fs.readFileSync("./s/how.tpl.html", "utf-8"), "how": fs.readFileSync("./s/how.tpl.html", "utf-8"),
"contact": fs.readFileSync("./s/contact.tpl.html", "utf-8") "contact": fs.readFileSync("./s/contact.tpl.html", "utf-8")
}; };
}; };