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

This commit is contained in:
Les De Ridder 2016-06-03 11:56:07 +02:00
parent 318d989562
commit 006053c850
2 changed files with 7 additions and 4 deletions

View File

@ -7,10 +7,10 @@
<select id="pomfclone"> <select id="pomfclone">
<option value="https://p.fuwafuwa.moe">p.fuwafuwa.moe (HTTPS)</option> <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://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://1339.cf">1339.cf (HTTP)</option>-->
<option value="http://catgirlsare.sexy">catgirlsare.sexy (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://cuntflaps.me">cuntflaps.me (HTTPS)</option>-->
<!--<option value="https://kyaa.sg">kyaa.sg (HTTPS)</option>--> <!--<option value="https://kyaa.sg">kyaa.sg (HTTPS)</option>-->
<!--<option value="https://pomf.hummingbird.moe">pomf.hummingbird.moe (HTTPS)</option>--> <!--<option value="https://pomf.hummingbird.moe">pomf.hummingbird.moe (HTTPS)</option>-->

View File

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