0
0
mirror of https://github.com/Maks1mS/userscripts.git synced 2024-12-23 16:22:59 +03:00

Update QuarklyUploadImageViaURL.user.js

This commit is contained in:
Maxim Slipenko 2023-08-03 19:48:21 +03:00 committed by GitHub
parent a986a4da96
commit c775d088a7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,7 +1,7 @@
// ==UserScript==
// @name Quarkly Upload Image via URL
// @namespace http://tampermonkey.net/
// @version 0.1
// @version 0.2
// @description try to take over the world!
// @author Maxim Slipenko
// @match https://quarkly.io/project/*
@ -34,11 +34,17 @@
const finalUrl = r.finalUrl;
// TODO: Better filename detection
const filename = url.substring(url.lastIndexOf('/')+1);
var arr = r.responseHeaders.split('\r\n');
var headers = arr.reduce(function (acc, current, i){
var parts = current.split(': ');
acc[parts[0]] = parts[1];
return acc;
}, {});
const file = new File(
[r.response],
filename,
{
type:"image/jpeg",
type: headers['content-type'],
lastModified:new Date().getTime()
}
);