Browse Source

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

master
Les De Ridder 4 years ago
parent
commit
006053c850
2 changed files with 7 additions and 4 deletions
  1. +2
    -2
      options.html
  2. +5
    -2
      worker.js

+ 2
- 2
options.html View File

@@ -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>-->


+ 5
- 2
worker.js View File

@@ -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…
Cancel
Save