Finally fixed origin
This commit is contained in:
@@ -11,7 +11,7 @@ import { java } from "@codemirror/lang-java";
|
||||
import { useEffect, useRef, useState } from "react";
|
||||
import { LiveRun, LiveRunEvent, LiveRunMove } from "@/modules/live-run/types";
|
||||
import useAction from "@/hook/use-action";
|
||||
import { getOrigin } from "@/modules/getOrigin";
|
||||
import { getOrigin } from "@/lib/origin/client";
|
||||
|
||||
type Language =
|
||||
| "javascript"
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
import { headers } from "next/headers";
|
||||
import "server-only";
|
||||
|
||||
export async function getOrigin(): Promise<{ protocol: string; host: string }> {
|
||||
const h = await headers();
|
||||
const host = process.env.ORIGIN || h.get(":authority") || "localhost:3000";
|
||||
const protocol = h.get("x-forwarded-proto") || h.get(":scheme") || "https";
|
||||
|
||||
return { protocol, host };
|
||||
}
|
||||
@@ -1,16 +1,14 @@
|
||||
"use server";
|
||||
|
||||
import { getOrigin } from "@/lib/origin/server";
|
||||
import * as Core from "./core";
|
||||
import { createClient } from "@/lib/supabase/server";
|
||||
import { headers } from "next/headers";
|
||||
import { redirect } from "next/navigation";
|
||||
|
||||
export async function signInWithGitHub() {
|
||||
const supabase = await createClient();
|
||||
|
||||
const h = await headers();
|
||||
const host = h.get("host");
|
||||
const protocol = h.get("x-forwarded-proto") ?? "https";
|
||||
const { host, protocol } = await getOrigin();
|
||||
|
||||
const { data, error } = await supabase.auth.signInWithOAuth({
|
||||
provider: "github",
|
||||
|
||||
Reference in New Issue
Block a user