Docker
This commit is contained in:
@@ -2,6 +2,7 @@ import { useEffect, useState } from 'react';
|
||||
import Editor from './components/Editor';
|
||||
import parseContentType from 'content-type-parser';
|
||||
import { languageIds } from './util/highlighting';
|
||||
import { bytebinUrl } from './util/constants';
|
||||
|
||||
function getPasteIdFromUrl() {
|
||||
const path = window.location.pathname;
|
||||
@@ -14,7 +15,7 @@ function getPasteIdFromUrl() {
|
||||
|
||||
async function loadFromBytebin(id) {
|
||||
try {
|
||||
const resp = await fetch('https://bytebin.lucko.me/' + id);
|
||||
const resp = await fetch(bytebinUrl + id);
|
||||
if (resp.ok) {
|
||||
const content = await resp.text();
|
||||
const type = parseLanguageFromContentType(
|
||||
|
||||
@@ -7,6 +7,7 @@ import copy from 'copy-to-clipboard';
|
||||
import { MenuButton, Button } from './Menu';
|
||||
import { languageIds } from '../util/highlighting';
|
||||
import themes from '../style/themes';
|
||||
import { postUrl } from '../util/constants';
|
||||
|
||||
export default function EditorControls({
|
||||
code,
|
||||
@@ -142,7 +143,7 @@ async function saveToBytebin(code, language) {
|
||||
const compressed = gzip(code);
|
||||
const contentType = langaugeToContentType(language);
|
||||
|
||||
const resp = await fetch('https://bytebin.lucko.me/post', {
|
||||
const resp = await fetch(postUrl, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': contentType,
|
||||
|
||||
4
src/util/constants.js
Normal file
4
src/util/constants.js
Normal file
@@ -0,0 +1,4 @@
|
||||
export const bytebinUrl =
|
||||
process.env.REACT_APP_BYTEBIN_URL || 'https://bytebin.lucko.me/';
|
||||
|
||||
export const postUrl = bytebinUrl + 'post';
|
||||
Reference in New Issue
Block a user