Support file hosts that provide a Pomf API as a secondary API

このコミットが含まれているのは:
Les De Ridder 2016-06-03 11:56:07 +02:00
コミット 006053c850
2個のファイルの変更7行の追加4行の削除

ファイルの表示

@ -7,10 +7,10 @@
<select id="pomfclone">
<option value="https://p.fuwafuwa.moe">p.fuwafuwa.moe (HTTPS)</option>
<option value="https://pomf.pyonpyon.moe">pomf.pyonpyon.moe (HTTPS)</option>
<!--<option value="https://fuwa.se">fuwa.se (HTTPS)</option>-->
<option value="https://cocaine.ninja">cocaine.ninja (HTTPS)</option>
<option value="https://fuwa.se/api/upload">fuwa.se (HTTPS)</option>
<!--<option value="http://1339.cf">1339.cf (HTTP)</option>-->
<option value="http://catgirlsare.sexy">catgirlsare.sexy (HTTP)</option>
<option value="https://cocaine.ninja">cocaine.ninja (HTTPS)</option>
<!--<option value="https://cuntflaps.me">cuntflaps.me (HTTPS)</option>-->
<!--<option value="https://kyaa.sg">kyaa.sg (HTTPS)</option>-->
<!--<option value="https://pomf.hummingbird.moe">pomf.hummingbird.moe (HTTPS)</option>-->

ファイルの表示

@ -17,9 +17,12 @@ self.onmessage = function(event) {
function uploadBuffer(pomfclone, buffer, filename) {
var formData = new FormData();
formData.append('files[]', buffer, filename);
var endpoint = pomfclone.indexOf('upload') != -1 || pomfclone.indexOf('api') != -1 ?
pomfclone : pomfclone + '/upload.php';
var request = new XMLHttpRequest();
request.open('POST', pomfclone + '/upload.php', true);
request.open('POST', endpoint, true);
request.onload = function(e) {
postMessage(request.response);
};