Skip to content

Commit

Permalink
Changing the site used to share links
Browse files Browse the repository at this point in the history
Use of my own site: "https://p-u.vercel.app".
  • Loading branch information
spel987 authored Mar 17, 2024
1 parent 2d2071e commit dad83a9
Showing 1 changed file with 11 additions and 14 deletions.
25 changes: 11 additions & 14 deletions src/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -365,6 +365,10 @@ document.addEventListener("DOMContentLoaded", function () {
let is_drag_file = false
let link_receive = 0;

let file_to_upload = "";
let file_to_upload_name = "";
let file_to_upload_size = "";

function get_value_from_path(path, json_data) {
return path.reduce((current, key) => current?.[key], json_data);
}
Expand Down Expand Up @@ -772,32 +776,29 @@ document.addEventListener("DOMContentLoaded", function () {
if (share_link_created == 0) {
const upload_date = new Date().toLocaleString("en-US", {month: "2-digit", day: "2-digit", year: "numeric", hour: "numeric", minute: "numeric", hour12: true}).replace(",", "");

fetch("https://sourceb.in/api/bins", {
fetch(url_for_bypass_cors + "https://p-u.vercel.app/api", {
method: "POST",
headers: {
"Content-Type": "application/json"
},
body: JSON.stringify({
title: "Links - PolyUploader",
description: "These links were created automatically by PolyUploader. For more information: https://github.com/spel987/PolyUploader",
files: [{
content: "Links created on " + upload_date + "\n\n------------------------------\n" + all_links_copy + "\n------------------------------\n\nCreated with PolyUploader",
languageId: 372
}]
action: "upload_bin",
title: file_to_upload_name,
content: "Links created on " + upload_date + " for \"" + file_to_upload_name + "\"" + "\n\n------------------------------\n" + all_links_copy + "\n------------------------------\n\nCreated with PolyUploader"
})
})
.then(response => response.json())
.then((data) => {
sourcebin_id = data.key;
copy_to_clipboard("https://sourceb.in/" + sourcebin_id);
share_link = data.url;
copy_to_clipboard(share_link);
share_link_created = 1;
document.getElementById("share_link_button").innerHTML = `<button id="share_link_button" class="underline transition duration-200 hover:scale-[1.02] active:scale-[1.05]">Copy a single share link <i class="fa-solid fa-check"></i></button>`;
setTimeout(function() {
document.getElementById("share_link_button").innerHTML = `<button id="share_link_button" class="underline transition duration-200 hover:scale-[1.02] active:scale-[1.05]">Copy a single share link <i class="fa-solid fa-up-right-from-square"></i></button>`;
}, 1500);
})
} else {
copy_to_clipboard("https://sourceb.in/" + sourcebin_id);
copy_to_clipboard(share_link);
document.getElementById("share_link_button").innerHTML = `<button id="share_link_button" class="underline transition duration-200 hover:scale-[1.02] active:scale-[1.05]">Copy a single share link <i class="fa-solid fa-check"></i></button>`;
setTimeout(function() {
document.getElementById("share_link_button").innerHTML = `<button id="share_link_button" class="underline transition duration-200 hover:scale-[1.02] active:scale-[1.05]">Copy a single share link <i class="fa-solid fa-up-right-from-square"></i></button>`;
Expand Down Expand Up @@ -1534,10 +1535,6 @@ document.addEventListener("DOMContentLoaded", function () {
event.preventDefault();
disabled_upload_button();

let file_to_upload = "";
let file_to_upload_name = "";
let file_to_upload_size = "";

if (upload_mode == "local") {
popup_upload_button_local.innerHTML = '<i class="fas fa-spinner fa-spin"></i> Uploading...';

Expand Down

0 comments on commit dad83a9

Please sign in to comment.