-
-
Notifications
You must be signed in to change notification settings - Fork 0
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
Showing
431 changed files
with
36,208 additions
and
31,598 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
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,15 +1,13 @@ | ||
name: "Workflow" | ||
on: ["push"] | ||
name: 'Workflow' | ||
on: ['push'] | ||
jobs: | ||
build: | ||
runs-on: "ubuntu-latest" | ||
runs-on: 'ubuntu-latest' | ||
steps: | ||
- uses: "actions/checkout@v3" | ||
- uses: 'actions/checkout@v3' | ||
with: | ||
fetch-depth: 0 | ||
|
||
|
||
- name: "TODO to Issue" | ||
uses: "alstr/todo-to-issue-action@v4.5" | ||
id: "todo" | ||
|
||
- name: 'TODO to Issue' | ||
uses: 'alstr/todo-to-issue-action@v4.5' | ||
id: 'todo' |
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 |
---|---|---|
|
@@ -6,3 +6,7 @@ | |
/docs | ||
/.bundle | ||
/.git | ||
.next | ||
dist | ||
|
||
README.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
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,4 +1,4 @@ | ||
{ | ||
"typescript.tsdk": "../../node_modules/.pnpm/typescript@4.9.5/node_modules/typescript/lib", | ||
"typescript.enablePromptUseWorkspaceTsdk": 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
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,46 +1,40 @@ | ||
// @ts-check | ||
import { clientSchema } from "./schema.mjs"; | ||
import { clientSchema } from './schema.mjs' | ||
|
||
/** | ||
* You can't destruct `process.env` as a regular object, so we do | ||
* a workaround. This is because Next.js evaluates this at build time, | ||
* and only used environment variables are included in the build. | ||
* @type {{ [key: string]: string | undefined; }} | ||
*/ | ||
let clientEnv = {}; | ||
Object.keys(clientSchema.shape).forEach( | ||
(key) => (clientEnv[key] = process.env[key]), | ||
); | ||
let clientEnv = {} | ||
Object.keys(clientSchema.shape).forEach((key) => (clientEnv[key] = process.env[key])) | ||
|
||
const _clientEnv = clientSchema.safeParse(clientEnv); | ||
const _clientEnv = clientSchema.safeParse(clientEnv) | ||
|
||
export const formatErrors = ( | ||
/** @type {import('zod').ZodFormattedError<Map<string,string>,string>} */ | ||
errors, | ||
) => | ||
Object.entries(errors) | ||
.map(([name, value]) => { | ||
if (value && "_errors" in value) | ||
return `${name}: ${value._errors.join(", ")}\n`; | ||
if (value && '_errors' in value) return `${name}: ${value._errors.join(', ')}\n` | ||
}) | ||
.filter(Boolean); | ||
.filter(Boolean) | ||
|
||
if (!_clientEnv.success) { | ||
console.error( | ||
"❌ Invalid environment variables:\n", | ||
...formatErrors(_clientEnv.error.format()), | ||
); | ||
throw new Error("Invalid environment variables"); | ||
console.error('❌ Invalid environment variables:\n', ...formatErrors(_clientEnv.error.format())) | ||
throw new Error('Invalid environment variables') | ||
} | ||
|
||
for (let key of Object.keys(_clientEnv.data)) { | ||
if (!key.startsWith("NEXT_PUBLIC_")) { | ||
if (!key.startsWith('NEXT_PUBLIC_')) { | ||
console.warn( | ||
`❌ Invalid public environment variable name: ${key}. It must begin with 'NEXT_PUBLIC_'`, | ||
); | ||
) | ||
|
||
throw new Error("Invalid public environment variable name"); | ||
throw new Error('Invalid public environment variable name') | ||
} | ||
} | ||
|
||
export const env = _clientEnv.data; | ||
export const env = _clientEnv.data |
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
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 |
---|---|---|
@@ -1 +1,11 @@ | ||
{"name":"","short_name":"","icons":[{"src":"/android-chrome-192x192.png","sizes":"192x192","type":"image/png"},{"src":"/android-chrome-512x512.png","sizes":"512x512","type":"image/png"}],"theme_color":"#ffffff","background_color":"#ffffff","display":"standalone"} | ||
{ | ||
"name": "", | ||
"short_name": "", | ||
"icons": [ | ||
{ "src": "/android-chrome-192x192.png", "sizes": "192x192", "type": "image/png" }, | ||
{ "src": "/android-chrome-512x512.png", "sizes": "512x512", "type": "image/png" } | ||
], | ||
"theme_color": "#ffffff", | ||
"background_color": "#ffffff", | ||
"display": "standalone" | ||
} |
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 |
---|---|---|
@@ -1,4 +1,2 @@ | ||
export const fetcher = (resource: string, init: RequestInit) => | ||
fetch(resource, { headers: { 'Access-Control-Allow-Origin': '*' } }).then( | ||
(res) => res.json() | ||
) | ||
fetch(resource, { headers: { 'Access-Control-Allow-Origin': '*' } }).then((res) => res.json()) |
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,24 +1,18 @@ | ||
import { AxiosResponse } from 'axios' | ||
import { NextApiRequest } from 'next' | ||
|
||
export const replaceCookieRes = ( | ||
response: AxiosResponse, | ||
endpoint: string | string[] | ||
) => { | ||
export const replaceCookieRes = (response: AxiosResponse, endpoint: string | string[]) => { | ||
const cookie = response.headers['set-cookie'] | ||
const myCookie = (Array.isArray(cookie) ? cookie[0] : cookie)?.replace( | ||
/domain=(.*)$/, | ||
`domain=${(Array.isArray(endpoint) ? endpoint[0] : endpoint)?.replace( | ||
/https:\/\/(.*?)\/.*/, | ||
'$1' | ||
)}` | ||
'$1', | ||
)}`, | ||
) | ||
return myCookie ? [myCookie] : '' | ||
} | ||
|
||
export const getSID = (cookie: string | string[]) => { | ||
return (Array.isArray(cookie) ? cookie[0] : cookie).replace( | ||
/.*?OJSSID=(.*?);.*/, | ||
'$1' | ||
) | ||
return (Array.isArray(cookie) ? cookie[0] : cookie).replace(/.*?OJSSID=(.*?);.*/, '$1') | ||
} |
Oops, something went wrong.