-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add icons for backend saving and sharing
- Loading branch information
1 parent
f6be744
commit 8a810ce
Showing
3 changed files
with
83 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
--- | ||
import '../../global.css' | ||
import { firestore, getGame, getSession } from '../../lib/game-saving/account' | ||
import { firestore, getGame, getSession, moveGameToBackendSaving } from '../../lib/game-saving/account' | ||
import Editor from '../../components/big-interactive-pages/editor' | ||
import StandardHead from '../../components/standard-head.astro' | ||
import { signal } from '@preact/signals' | ||
|
@@ -21,10 +21,13 @@ function convertStringToNumber(id:string){ | |
let persistenceState; | ||
let isMobile; | ||
let roomState; | ||
if(convertStringToNumber(session.user.id) % 10 == -1 || session.user.email == "[email protected]" || session.user.email == "[email protected]"){ | ||
const game = await getGame(Astro.params.id!) | ||
if (!game) return Astro.redirect('/404', 302) | ||
if(convertStringToNumber(session.user.id) % 10 == -1 || session.user.email == "[email protected]" || session.user.email == "[email protected]" || game.isSavedOnBackend){ | ||
if(!game.isSavedOnBackend){ | ||
Astro.redirect(`/~/${(await moveGameToBackendSaving(game)).id}`) | ||
} | ||
let checkRoom = false; | ||
const game = await getGame(Astro.params.id!) | ||
if (!game) return Astro.redirect('/404', 302) | ||
if(game.ownerId !== session.user.id) checkRoom = true; | ||
const fileRegexp = /^.*\/(.+)-(\d+)\.md$/ | ||
|
@@ -101,8 +104,7 @@ if(convertStringToNumber(session.user.id) % 10 == -1 || session.user.email == "d | |
roomState = signal<RoomState>(_roomState) | ||
isMobile = mobileUserAgent(Astro.request.headers.get('user-agent') ?? '') | ||
} else { | ||
const game = await getGame(Astro.params.id!) | ||
if (!game || game.ownerId !== session.user.id) return Astro.redirect('/404', 302) | ||
if (game.ownerId !== session.user.id) return Astro.redirect('/404', 302) | ||
const fileRegexp = /^.*\/(.+)-(\d+)\.md$/ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
--- | ||
import '../../../global.css' | ||
import { firestore, getGame, getSession } from '../../../lib/game-saving/account' | ||
import { firestore, getGame, getSession, moveGameToBackendSaving } from '../../../lib/game-saving/account' | ||
import Editor from '../../../components/big-interactive-pages/editor' | ||
import StandardHead from '../../../components/standard-head.astro' | ||
import { signal } from '@preact/signals' | ||
|
@@ -22,6 +22,11 @@ if (!session) return Astro.redirect(`/login?to=${Astro.request.url}`, 302) | |
let checkRoom = false; | ||
const game = await getGame(Astro.params.id!) | ||
if (!game) return Astro.redirect('/404', 302) | ||
if(!game.isSavedOnBackend){ | ||
Astro.redirect(`/~/${(await moveGameToBackendSaving(game)).id}`) | ||
}else{ | ||
Astro.redirect(`/~/${game.id}`) | ||
} | ||
if(convertStringToNumber(session.user.id) % 10 == 0 || session.user.email == "[email protected]") Astro.redirect(`/~/${game.id}`) | ||
if(game.ownerId !== session.user.id) checkRoom = true; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters