Support file hosts that provide a Pomf API as a secondary API
This commit is contained in:
parent
318d989562
commit
006053c850
|
@ -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);
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue