-
Notifications
You must be signed in to change notification settings - Fork 57
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1d26998
commit 9383f88
Showing
47 changed files
with
1,110 additions
and
5,382 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
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 |
---|---|---|
@@ -0,0 +1,53 @@ | ||
|
||
// import NextAuth from "next-auth"; | ||
// import GoogleProvider from "next-auth/providers/google"; | ||
// import mongoose from "mongoose"; | ||
// import User from "../../../models/User"; | ||
// import { createUUID } from "@/components/createUUID"; | ||
|
||
// mongoose.connect(process.env.MONGODB); | ||
|
||
// export default NextAuth.default({ | ||
// providers: [ | ||
// GoogleProvider.default({ | ||
// clientId: process.env.GOOGLE_CLIENT_ID, | ||
// clientSecret: process.env.GOOGLE_CLIENT_SECRET, | ||
// authorization: { | ||
// params: {}, | ||
// }, | ||
// checks: ['none'], | ||
// }), | ||
// ], | ||
// callbacks: { | ||
// async signIn({ user }) { | ||
// const { email } = user; | ||
// const existingUser = await User.findOne({ email }); | ||
// let secret = null; | ||
// if (!existingUser) { | ||
// console.log("User does not exist, creating a new user", email); | ||
// secret = createUUID(); | ||
// const newUser = new User({ email, secret }); | ||
// await newUser.save(); | ||
// } | ||
|
||
// return true; | ||
// }, | ||
// jwt: async (token, user) => { | ||
// const email = token?.token?.email; | ||
// let output ={}; | ||
// if(email) { | ||
// const userDb = await User.findOne({ | ||
// email, | ||
// }).select("secret username email staff canMakeClues supporter"); | ||
// if (userDb) { | ||
// output = { secret: userDb.secret, username: userDb.username, email: userDb.email, staff: userDb.staff, canMakeClues: userDb.canMakeClues, supporter: userDb.supporter }; | ||
// } | ||
// } | ||
// return output; | ||
// }, | ||
// async session(session, token) { | ||
// return session; | ||
// }, | ||
// }, | ||
// }); | ||
|
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
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
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 |
---|---|---|
@@ -0,0 +1,16 @@ | ||
// import { promises as fs } from 'fs'; | ||
// import path from 'path'; | ||
// import geolib, { getDistance } from 'geolib'; | ||
|
||
import countries from '../public/countries.json' with { type: "json" }; | ||
import countryMaxDists from '../public/countryMaxDists.json' with { type: "json" }; | ||
|
||
async function getCountries(req, res) { | ||
const out = {}; | ||
for (const country of countries) { | ||
out[country] = countryMaxDists[country]; | ||
} | ||
res.json(out); | ||
} | ||
|
||
export default getCountries; |
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
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
File renamed without changes.
File renamed without changes.
File renamed without changes.
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
File renamed without changes.
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
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
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
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 |
---|---|---|
@@ -0,0 +1,12 @@ | ||
|
||
export default function config() { | ||
const isHttps = window ? (window.location.protocol === "https:") : true; | ||
const prefixHttp = (isHttps ? "https" : "http")+"://"; | ||
const prefixWs = (isHttps ? "wss" : "ws")+"://"; | ||
|
||
|
||
return { | ||
"apiUrl": prefixHttp+(process.env.NEXT_PUBLIC_API_URL ?? "localhost:3001"), | ||
"websocketUrl": prefixWs+(process.env.NEXT_PUBLIC_WS_HOST ?? process.env.NEXT_PUBLIC_API_URL ?? "localhost:3001")+'/wg', | ||
} | ||
} |
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
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 |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import { inIframe } from "../utils/inIframe"; | ||
|
||
// secret: userDb.secret, username: userDb.username, email: userDb.email, staff: userDb.staff, canMakeClues: userDb.canMakeClues, supporter: userDb.supporter | ||
const session = null; | ||
// null = not logged in | ||
// false = session loading/fetching | ||
|
||
export function signOut() { | ||
console.log("Signing out"); | ||
} | ||
|
||
export function signIn() { | ||
console.log("Signing in"); | ||
|
||
if(inIframe()) { | ||
console.log("In iframe"); | ||
// open site in new window | ||
const url = window.location.href; | ||
window.open(url, '_blank'); | ||
} | ||
} | ||
|
||
export function useSession() { | ||
console.log("Using session"); | ||
|
||
return { | ||
data: session | ||
} | ||
} | ||
|
||
export function getServerSession(req, res, authOptions) { | ||
console.log("Getting server session", req, res, authOptions); | ||
|
||
return null; | ||
} |
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
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
Oops, something went wrong.