Replace mete0r.xyz URLs with URL loaded from .env file

This commit is contained in:
Lewin Kelly 2023-09-15 17:58:30 +01:00
parent 30646ebca2
commit 5d5eda6bab
No known key found for this signature in database
GPG Key ID: C103AD9C84014FD7
15 changed files with 51 additions and 22 deletions

1
Back/.gitignore vendored
View File

@ -2,3 +2,4 @@ node_modules/
assets/release.zip assets/release.zip
assets/hash.txt assets/hash.txt
data/ data/
.env

View File

@ -6,9 +6,21 @@ version: "3"
services: services:
redis: redis:
container_name: meteoredis container_name: meteoredis
image: redis image: redis/redis-stack
ports: ports:
- 6379:6379 - 6379:6379
restart: unless-stopped restart: unless-stopped
volumes: volumes:
- ./data/redis:/data - ./data/redis:/data
mongo:
image: mongo
ports:
- 27017:27017
restart: unless-stopped
volumes:
- ./data/mongo:/data/db
environment:
MONGO_INITDB_DATABASE: meteoritedb
MONGO_INITDB_ROOT_USERNAME: server
MONGO_INITDB_ROOT_PASSWORD: password

View File

@ -1,5 +1,6 @@
<script lang="ts"> <script lang="ts">
import { onMount } from "svelte" import { onMount } from "svelte"
import { PUBLIC_ORIGIN } from "$env/static/public"
export let size: string export let size: string
export let status = "Offline" export let status = "Offline"
@ -21,7 +22,7 @@
class="{customclass} absolute bottom-2 right-5 w-{size} h-{size} bg-blue-500 rounded-full"> class="{customclass} absolute bottom-2 right-5 w-{size} h-{size} bg-blue-500 rounded-full">
</div> </div>
{:else if status.includes("Playing") === true} {:else if status.includes("Playing") === true}
<a class="unstyled" href="http://mete0r.xyz/games/{gameid}"> <a class="unstyled" href="http://{PUBLIC_ORIGIN}/games/{gameid}">
<div <div
class="{customclass} absolute bottom-2 right-5 w-{size} h-{size} bg-green-500 rounded-full"> class="{customclass} absolute bottom-2 right-5 w-{size} h-{size} bg-green-500 rounded-full">
</div> </div>

View File

@ -1,4 +1,5 @@
import type { RequestEvent } from "@sveltejs/kit" import type { RequestEvent } from "@sveltejs/kit"
import { PUBLIC_ORIGIN } from "$env/static/public"
export const authenticateUser = async (event: RequestEvent) => { export const authenticateUser = async (event: RequestEvent) => {
// get the cookies from the request // get the cookies from the request
@ -13,7 +14,7 @@ export const authenticateUser = async (event: RequestEvent) => {
// if the user token is not valid, return null // if the user token is not valid, return null
// this is where you would check the user token against your database // this is where you would check the user token against your database
// to see if it is valid and return the user object // to see if it is valid and return the user object
const res = await fetch("http://mete0r.xyz/api/auth", { const res = await fetch(`http://${PUBLIC_ORIGIN}/api/auth`, {
credentials: "include", credentials: "include",
headers: { cookie: "jwt=" + userToken, route: route.id as string }, headers: { cookie: "jwt=" + userToken, route: route.id as string },
}) })

View File

@ -1,3 +1,4 @@
import { browser } from "$app/environment" import { browser } from "$app/environment"
import { PUBLIC_ORIGIN } from "$env/static/public"
export const url = !browser ? "http://mete0r.xyz" : "" // if no browser return "http://mete0r.xyz" otherwise nothing export const url = !browser ? `http://${PUBLIC_ORIGIN}` : "" // if no browser return "http://mete0r.xyz" otherwise nothing

View File

@ -1,9 +1,10 @@
import { error, redirect } from "@sveltejs/kit" import { error, redirect } from "@sveltejs/kit"
import type { PageLoad } from "./$types" import type { PageLoad } from "./$types"
import { PUBLIC_ORIGIN } from "$env/static/public"
export const load = (async ({ fetch, params }) => { export const load = (async ({ fetch, params }) => {
const res = await fetch( const res = await fetch(
`http://mete0r.xyz/api/catalog/iteminfo/${params.slug}`, `http://${PUBLIC_ORIGIN}/api/catalog/iteminfo/${params.slug}`,
) )
const data = await res.json() const data = await res.json()
if (data.error === false) { if (data.error === false) {

View File

@ -1,9 +1,10 @@
import { error, redirect } from "@sveltejs/kit" import { error, redirect } from "@sveltejs/kit"
import type { PageLoad } from "./$types" import type { PageLoad } from "./$types"
import { PUBLIC_ORIGIN } from "$env/static/public"
export const load = (async ({ fetch, params }) => { export const load = (async ({ fetch, params }) => {
const res = await fetch( const res = await fetch(
`http://mete0r.xyz/api/catalog/iteminfo/${params.slug}`, `http://${PUBLIC_ORIGIN}/api/catalog/iteminfo/${params.slug}`,
) )
const data = await res.json() const data = await res.json()
@ -25,7 +26,9 @@ export const load = (async ({ fetch, params }) => {
if (data.error === false) { if (data.error === false) {
const creatorusernameresp = await fetch( const creatorusernameresp = await fetch(
`http://mete0r.xyz/api/userinfo/${data.iteminfo.Creator ?? "0"}`, `http://${PUBLIC_ORIGIN}/api/userinfo/${
data.iteminfo.Creator ?? "0"
}`,
) )
const creatorusername = await creatorusernameresp.json() const creatorusername = await creatorusernameresp.json()
return { return {

View File

@ -1,9 +1,10 @@
import { error, redirect } from "@sveltejs/kit" import { error, redirect } from "@sveltejs/kit"
import type { PageLoad } from "./$types" import type { PageLoad } from "./$types"
import { PUBLIC_ORIGIN } from "$env/static/public"
export const load = (async ({ parent, fetch, params }) => { export const load = (async ({ parent, fetch, params }) => {
const res = await fetch( const res = await fetch(
`http://mete0r.xyz/api/catalog/iteminfo/${params.slug}`, `http://${PUBLIC_ORIGIN}/api/catalog/iteminfo/${params.slug}`,
) )
const data = await res.json() const data = await res.json()
let self = (await parent()).user let self = (await parent()).user

View File

@ -159,5 +159,5 @@
<Accessories jwt={data.jwt} type={storeTab} /> <Accessories jwt={data.jwt} type={storeTab} />
{/if} {/if}
{#if storeTab === "userads"}{/if} <!-- {#if storeTab === "userads"}{/if} -->
</div> </div>

View File

@ -1,11 +1,12 @@
import { error } from "@sveltejs/kit" import { error } from "@sveltejs/kit"
import type { PageLoad } from "./$types" import type { PageLoad } from "./$types"
import { PUBLIC_ORIGIN } from "$env/static/public"
export const load = (async ({ fetch, parent }) => { export const load = (async ({ fetch, parent }) => {
let data = await parent() let data = await parent()
const response = await fetch( const response = await fetch(
"http://mete0r.xyz/api/friends/friend-requests", `http://${PUBLIC_ORIGIN}/api/friends/friend-requests`,
{ {
method: "POST", method: "POST",
headers: { headers: {

View File

@ -1,8 +1,9 @@
import { error, redirect } from "@sveltejs/kit" import { error, redirect } from "@sveltejs/kit"
import type { PageLoad } from "./$types" import type { PageLoad } from "./$types"
import { PUBLIC_ORIGIN } from "$env/static/public"
export const load = (async ({ fetch, params }) => { export const load = (async ({ fetch, params }) => {
const res = await fetch(`http://mete0r.xyz/games/gameinfo/${params.slug}`) const res = await fetch(`http://${PUBLIC_ORIGIN}/games/gameinfo/${params.slug}`)
const data = await res.json() const data = await res.json()
if (data.error === false) { if (data.error === false) {
throw redirect( throw redirect(

View File

@ -13,6 +13,7 @@
import Advertisemodal from "../../../../components/assets/advertisemodal.svelte" import Advertisemodal from "../../../../components/assets/advertisemodal.svelte"
import Itemcard from "../../../../components/itemcard.svelte" import Itemcard from "../../../../components/itemcard.svelte"
import { MoreHorizontalIcon } from "lucide-svelte" import { MoreHorizontalIcon } from "lucide-svelte"
import { PUBLIC_ORIGIN } from "$env/static/public"
let storeTab = "About" let storeTab = "About"
export let data: PageData export let data: PageData
@ -62,7 +63,7 @@
} }
async function shutdown() { async function shutdown() {
const shutdownresp = await fetch("http://mete0r.xyz/games/shutdown", { const shutdownresp = await fetch(`http://${PUBLIC_ORIGIN}/games/shutdown`, {
method: "POST", method: "POST",
headers: { headers: {
"Content-Type": "application/json", "Content-Type": "application/json",
@ -78,7 +79,7 @@
async function evictplayer(userid: Number) { async function evictplayer(userid: Number) {
const evictplayerresp = await fetch( const evictplayerresp = await fetch(
"http://mete0r.xyz/games/evictplayer", `http://${PUBLIC_ORIGIN}/games/evictplayer`,
{ {
method: "POST", method: "POST",
headers: { headers: {
@ -127,12 +128,12 @@
content="{data.game content="{data.game
.nameofgame} - Join others who are recreating the game world." .nameofgame} - Join others who are recreating the game world."
property="og:description" /> property="og:description" />
<meta content="https://mete0r.xyz" property="og:url" /> <meta content="https://{PUBLIC_ORIGIN}" property="og:url" />
<meta content="#6f00ff" data-react-helmet="true" name="theme-color" /> <meta content="#6f00ff" data-react-helmet="true" name="theme-color" />
<meta <meta
name="twitter:image:src" name="twitter:image:src"
content="https://mete0r.xyz/assets/gameassets/thumbnail-{data.game content="https://{PUBLIC_ORIGIN}/assets/gameassets/thumbnail-{data.game
.idofgame}.png" /> .idofgame}.png" />
<meta name="twitter:site" content="@Meteorite" /> <meta name="twitter:site" content="@Meteorite" />
<meta name="twitter:card" content="summary_large_image" /> <meta name="twitter:card" content="summary_large_image" />
@ -150,7 +151,7 @@
<img <img
class="h-[360px] w-[640px] aspect-video m-auto" class="h-[360px] w-[640px] aspect-video m-auto"
alt={data.game.nameofgame} alt={data.game.nameofgame}
src="http://mete0r.xyz/assets/gameassets/thumbnail-{data.game src="http://{PUBLIC_ORIGIN}/assets/gameassets/thumbnail-{data.game
.idofgame}.png#" .idofgame}.png#"
style="height:360px;width:640px" /> style="height:360px;width:640px" />
<div class="grow"> <div class="grow">

View File

@ -1,8 +1,9 @@
import { error, redirect } from "@sveltejs/kit" import { error, redirect } from "@sveltejs/kit"
import type { PageLoad } from "./$types" import type { PageLoad } from "./$types"
import { PUBLIC_ORIGIN } from "$env/static/public"
export const load = (async ({ fetch, params }) => { export const load = (async ({ fetch, params }) => {
const res = await fetch(`http://mete0r.xyz/games/gameinfo/${params.slug}`) const res = await fetch(`http://${PUBLIC_ORIGIN}/games/gameinfo/${params.slug}`)
const data = await res.json() const data = await res.json()
if ( if (

View File

@ -1,5 +1,6 @@
<script lang="ts"> <script lang="ts">
import Gamecard from "../../../../components/gamecard.svelte" import Gamecard from "../../../../components/gamecard.svelte"
import { PUBLIC_ORIGIN } from "$env/static/public"
let gamearray: any[] = [] let gamearray: any[] = []
let currentcursor = 1 let currentcursor = 1
import type { PageData } from "./$types" import type { PageData } from "./$types"
@ -16,7 +17,7 @@
$: data, fetchfirst() $: data, fetchfirst()
async function fetchfirst() { async function fetchfirst() {
const response = await fetch("http://mete0r.xyz/games/search", { const response = await fetch(`http://${PUBLIC_ORIGIN}/games/search`, {
method: "POST", method: "POST",
body: JSON.stringify({ cursor: 0, searchquery: search }), body: JSON.stringify({ cursor: 0, searchquery: search }),
headers: { "content-type": "application/json" }, headers: { "content-type": "application/json" },
@ -37,7 +38,7 @@
} }
async function addToArray() { async function addToArray() {
const response = await fetch("http://mete0r.xyz/games/search", { const response = await fetch(`http://${PUBLIC_ORIGIN}/games/search`, {
method: "POST", method: "POST",
body: JSON.stringify({ body: JSON.stringify({
cursor: currentcursor, cursor: currentcursor,

View File

@ -1,22 +1,25 @@
import { error } from "@sveltejs/kit" import { error } from "@sveltejs/kit"
import type { PageLoad } from "./$types" import type { PageLoad } from "./$types"
import { url } from "$lib/url" import { url } from "$lib/url"
import { PUBLIC_ORIGIN } from "$env/static/public"
export const load = (async ({ fetch, params, parent }) => { export const load = (async ({ fetch, params, parent }) => {
let data = await parent() let data = await parent()
let alreadyFriends = false let alreadyFriends = false
let otherUserWantsToBeFriends = false let otherUserWantsToBeFriends = false
let wearingItems: Array<any> = [] let wearingItems: Array<any> = []
const res = await fetch(`http://mete0r.xyz/api/userinfo/${params.slug}`) const res = await fetch(
`http://${PUBLIC_ORIGIN}/api/userinfo/${params.slug}`,
)
const datauser = await res.json() const datauser = await res.json()
const resvisits = await fetch( const resvisits = await fetch(
`http://mete0r.xyz/api/userinfo/${params.slug}/visits`, `http://${PUBLIC_ORIGIN}/api/userinfo/${params.slug}/visits`,
) )
const datavisits = await resvisits.json() const datavisits = await resvisits.json()
const result = await fetch( const result = await fetch(
"http://mete0r.xyz/api/friends/has-sent-request", `http://${PUBLIC_ORIGIN}/api/friends/has-sent-request`,
{ {
method: "POST", method: "POST",
headers: { headers: {