Revert "Revert "Merge pull request #1 from captbaritone/cdn""

This reverts commit 986f0abf00.
This commit is contained in:
Jordan Eldredge 2020-09-05 15:40:08 -07:00
parent 986f0abf00
commit b7cebc73bb
26 changed files with 8 additions and 9007 deletions

View file

@ -1,7 +1,7 @@
import React, { useEffect } from "react";
import WebampComponent from "../WebampComponent";
import * as Utils from "../utils";
import { SCREENSHOT_HEIGHT, SCREENSHOT_WIDTH } from "../constants";
import { SCREENSHOT_HEIGHT, SCREENSHOT_WIDTH, API_URL } from "../constants";
import { delay, switchMap } from "rxjs/operators";
import { Subject, combineLatest, timer, fromEvent, from } from "rxjs";
import Disposable from "../Disposable";
@ -18,7 +18,7 @@ function useSkinData({ hash, skinData, setSkinData }) {
return;
}
// TODO: Move this to Epic
const subscription = from(fetch(`https://api.webamp.org/skins/${hash}`))
const subscription = from(fetch(`${API_URL}/skins/${hash}`))
.pipe(switchMap((response) => response.json()))
.subscribe((body) => {
setSkinData(hash, {

View file

@ -2,13 +2,14 @@ import React, { useState } from "react";
import DownloadLink from "./DownloadLink";
import * as Utils from "../utils";
import LinkInput from "./LinkInput";
import { API_URL } from "../constants";
function Metadata({ permalink, openFileExplorer, fileName, hash }) {
const [showLink, setShowLink] = useState(false);
async function report(e) {
e.preventDefault();
try {
await fetch(`https://api.webamp.org/skins/${hash}/report`, {
await fetch(`${API_URL}/skins/${hash}/report`, {
method: "POST",
mode: "cors",
});