Finally fixed origin

This commit is contained in:
2026-02-14 23:15:53 +01:00
parent 694652dccd
commit 705d504cd7
4 changed files with 13 additions and 5 deletions
+1 -1
View File
@@ -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"
+10
View File
@@ -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 };
}
+2 -4
View File
@@ -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",