Compare commits
11 Commits
0219cc7f83
..
proxy
| Author | SHA1 | Date | |
|---|---|---|---|
| 881ee4568d | |||
| 7ac32d6dff | |||
| 175a86b490 | |||
| 8f1c789c8e | |||
| c4d55ec6c7 | |||
| 3ab1623bed | |||
| 88a6e5e692 | |||
| 99f05ea2e0 | |||
| 3ef1d4bdcb | |||
| 091197e7c7 | |||
| 63a9916a03 |
@@ -1,31 +1,22 @@
|
||||
A simple no-HTML random Hatsune Miku image server: https://random-miku.owo39.me/
|
||||
A simple no-HTML random Hatsune Miku image server. Example: https://rms.owo69.me/
|
||||
|
||||
Click reload to get a different one. Delete left half of URL to get to source.
|
||||
- Click reload to get a different one. Delete left half of URL to get to source.
|
||||
- Include pornographic results: https://rms.owo69.me/?allow_r18([=only](https://rms.owo69.me/?allow_r18=only))
|
||||
- Get different sizes (original, regular, small, or thumb_mini): https://rms.owo69.me/?size=thumb_mini
|
||||
- Auto-refresh using HTTP Refresh header: https://rms.owo69.me/?auto=3
|
||||
- kek: https://rms.owo69.me/?allow_r18&size=thumb_mini&auto=0
|
||||
- See your history: https://rms.owo69.me/log
|
||||
- Load image by id without redirect thing: https://rms.owo69.me/img/51586149
|
||||
- Load random image directly without redirect thing: https://rms.owo69.me/img/random
|
||||
- Draw Pixiv URL onto upper left corner of image: https://rms.owo69.me/img/random?drawsource&size=regular
|
||||
|
||||
Include pornographic results: https://random-miku.owo39.me/?allow_r18([=only](https://random-miku.owo39.me/?allow_r18=only))
|
||||
Here is an HTML site that makes use of it: https://lamp.tk/miku.html
|
||||
|
||||
Get different sizes (original, regular, small, or thumb_mini): https://random-miku.owo39.me/?size=thumb_mini
|
||||
### Prerequisites
|
||||
|
||||
Auto-refresh using HTTP Refresh header: https://random-miku.owo39.me/?auto=3
|
||||
- Node.js
|
||||
- GraphicsMagick for ?drawsource option
|
||||
|
||||
kek: https://random-miku.owo39.me/?allow_r18&size=thumb_mini&auto=0
|
||||
### todo
|
||||
|
||||
See your history: https://random-miku.owo39.me/log
|
||||
|
||||
Load image by id without redirect thing: https://random-miku.owo39.me/img/51586149
|
||||
|
||||
Load random image without redirect thing: https://random-miku.owo39.me/img/random
|
||||
|
||||
|
||||
## Issues
|
||||
|
||||
- Browser back button is not useful
|
||||
- HTTP Refresh does not save to browser history
|
||||
- legality is ?????
|
||||
|
||||
|
||||
## todo
|
||||
|
||||
- Proper HTML site that's more user-friendly
|
||||
- Option to draw the source url onto the image
|
||||
- Option to limit range to get more higher-ranked illustrations
|
||||
|
||||
@@ -2,11 +2,12 @@ var express = require("express");
|
||||
var fetch = require("node-fetch");
|
||||
var qs = require("qs");
|
||||
var serveFavicon = require("serve-favicon");
|
||||
var gm = require("gm");
|
||||
var fs = require("fs");
|
||||
|
||||
var app = express();
|
||||
app.set("trust proxy", "127.0.0.1");
|
||||
app.listen(process.env.PORT || 39);
|
||||
app.listen(process.env.PORT || 39, process.env.ADDRESS);
|
||||
app.use(serveFavicon("ミク.png"));
|
||||
app.use((req,res,next)=>{req.rawQuery = req.url.includes('?') && req.url.substr(req.url.indexOf('?')+1);next();});
|
||||
|
||||
@@ -55,17 +56,20 @@ async function serveId(id, req, res, next) {
|
||||
if (!url) return res.status(400).type("text").send(`size must be one of the following: ${Object.keys(pages[0].urls).join(', ')}`);
|
||||
|
||||
var pxreq = await fetch(url, { headers: {"Referer": "https://www.pixiv.net"} });
|
||||
if (pxreq.status != 200 && size == "original") {
|
||||
res.header("X-Using-Backup", '1');
|
||||
pxreq = await fetch(`http://hmbp.gq:39/https://www.pixiv.net/en/artworks/${id}?noredirect`);
|
||||
}
|
||||
//if (pxreq.status != 200 && size == "original") {
|
||||
// res.header("X-Using-Backup", '1');
|
||||
// pxreq = await fetch(`https://39.hmbp.gq/https://www.pixiv.net/en/artworks/${id}?noredirect`);
|
||||
//}
|
||||
|
||||
res.status(203);
|
||||
res.status(pxreq.status);
|
||||
res.type(pxreq.headers.get("Content-Type"));
|
||||
res.header("Content-Disposition", `filename=${url.split('/').pop()}`);
|
||||
res.header("X-Pixiv-Id", id);
|
||||
if (req.query.auto) res.header("Refresh", `${Number(req.query.auto)}; url=${getRandomUrl(req)}`);
|
||||
pxreq.body.pipe(res);
|
||||
if (req.query.drawsource != null && pxreq.headers.get("Content-Type").startsWith("image")) {
|
||||
gm(pxreq.body).drawText(2, 12, size == "thumb_mini" ? id : `https://www.pixiv.net/en/artworks/${id}`).stream().pipe(res);
|
||||
}
|
||||
else pxreq.body.pipe(res);
|
||||
|
||||
fs.appendFileSync(`logs/${req.ip.replace(/[:\/]/g, '-')}.csv`, `${new Date().toISOString()},${id}\n`);
|
||||
|
||||
@@ -110,9 +114,14 @@ app.get("/img/:id", (req, res, next) => {
|
||||
serveId(req.params.id, req, res, next);
|
||||
});
|
||||
|
||||
// plaintext random id for scripts
|
||||
// plaintext random id(s) for scripts
|
||||
app.get("/randomid", function (req, res) {
|
||||
res.type("text/plain").send(getRandomId(req.query.allow_r18));
|
||||
var count = Number(req.query.count) || 1;
|
||||
count = Math.min(count, 100);
|
||||
var ids = [];
|
||||
for (let i = 0; i < count; i++) ids.push(getRandomId(req.query.allow_r18));
|
||||
ids = ids.join(',');
|
||||
res.type("text/plain").send(ids);
|
||||
});
|
||||
|
||||
|
||||
|
||||
Generated
+585
-258
File diff suppressed because it is too large
Load Diff
@@ -1,6 +1,7 @@
|
||||
{
|
||||
"dependencies": {
|
||||
"express": "^4.17.1",
|
||||
"gm": "^1.23.1",
|
||||
"node-fetch": "^2.6.5",
|
||||
"serve-favicon": "^2.5.0"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user