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/hash.txt
data/
.env

View File

@ -6,9 +6,21 @@ version: "3"
services:
redis:
container_name: meteoredis
image: redis
image: redis/redis-stack
ports:
- 6379:6379
restart: unless-stopped
volumes:
- ./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">
import { onMount } from "svelte"
import { PUBLIC_ORIGIN } from "$env/static/public"
export let size: string
export let status = "Offline"
@ -21,7 +22,7 @@
class="{customclass} absolute bottom-2 right-5 w-{size} h-{size} bg-blue-500 rounded-full">
</div>
{: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
class="{customclass} absolute bottom-2 right-5 w-{size} h-{size} bg-green-500 rounded-full">
</div>

View File

@ -1,4 +1,5 @@
import type { RequestEvent } from "@sveltejs/kit"
import { PUBLIC_ORIGIN } from "$env/static/public"
export const authenticateUser = async (event: RequestEvent) => {
// 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
// this is where you would check the user token against your database
// 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",
headers: { cookie: "jwt=" + userToken, route: route.id as string },
})

View File

@ -1,3 +1,4 @@
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 type { PageLoad } from "./$types"
import { PUBLIC_ORIGIN } from "$env/static/public"
export const load = (async ({ fetch, params }) => {
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()
if (data.error === false) {

View File

@ -1,9 +1,10 @@
import { error, redirect } from "@sveltejs/kit"
import type { PageLoad } from "./$types"
import { PUBLIC_ORIGIN } from "$env/static/public"
export const load = (async ({ fetch, params }) => {
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()
@ -25,7 +26,9 @@ export const load = (async ({ fetch, params }) => {
if (data.error === false) {
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()
return {

View File

@ -1,9 +1,10 @@
import { error, redirect } from "@sveltejs/kit"
import type { PageLoad } from "./$types"
import { PUBLIC_ORIGIN } from "$env/static/public"
export const load = (async ({ parent, fetch, params }) => {
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()
let self = (await parent()).user

View File

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

View File

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

View File

@ -1,8 +1,9 @@
import { error, redirect } from "@sveltejs/kit"
import type { PageLoad } from "./$types"
import { PUBLIC_ORIGIN } from "$env/static/public"
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()
if (data.error === false) {
throw redirect(

View File

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

View File

@ -1,8 +1,9 @@
import { error, redirect } from "@sveltejs/kit"
import type { PageLoad } from "./$types"
import { PUBLIC_ORIGIN } from "$env/static/public"
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()
if (

View File

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

View File

@ -1,22 +1,25 @@
import { error } from "@sveltejs/kit"
import type { PageLoad } from "./$types"
import { url } from "$lib/url"
import { PUBLIC_ORIGIN } from "$env/static/public"
export const load = (async ({ fetch, params, parent }) => {
let data = await parent()
let alreadyFriends = false
let otherUserWantsToBeFriends = false
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 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 result = await fetch(
"http://mete0r.xyz/api/friends/has-sent-request",
`http://${PUBLIC_ORIGIN}/api/friends/has-sent-request`,
{
method: "POST",
headers: {