diff --git a/supabase/functions/.env.dev b/supabase/functions/.env.dev index 07c2adf20..d1885bd67 100644 --- a/supabase/functions/.env.dev +++ b/supabase/functions/.env.dev @@ -1,7 +1,6 @@ LEADMINER_ANON_KEY=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZS1kZW1vIiwicm9sZSI6ImFub24iLCJleHAiOjE5ODM4MTI5OTZ9.CRXP1A7WOeoJeXxjNni43kdQwgnWNReilDMblYTn_I0 LEADMINER_API_HASH_SECRET=change_me SUPABASE_PROJECT_URL=http://host.docker.internal:54321/ # Required for self-hosted/prod: Your public Supabase URL (e.g., https://db.yourdomain.com) -LEADMINER_SECRET_TOKEN=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZS1kZW1vIiwicm9sZSI6InNlcnZpY2Vfcm9sZSIsImV4cCI6MTk4MzgxMjk5Nn0.EGIM96RAZx35lJzdJsyH-qQwv8Hdp7fsn3W0YpN81IU # Use an SMTP testing service like Ethereal for development https://ethereal.email/ SMTP_HOST=smtp.example.email diff --git a/supabase/functions/passive-mining/index.ts b/supabase/functions/passive-mining/index.ts index 94473e9fb..d8458bee7 100644 --- a/supabase/functions/passive-mining/index.ts +++ b/supabase/functions/passive-mining/index.ts @@ -4,7 +4,7 @@ import { getFolders } from "./boxes.ts"; const supabase = createSupabaseAdmin(); const SERVER_ENDPOINT = Deno.env.get("SERVER_ENDPOINT"); -const LEADMINER_SECRET_TOKEN = Deno.env.get("LEADMINER_SECRET_TOKEN"); +const SUPABASE_SERVICE_ROLE_KEY = Deno.env.get("SUPABASE_SERVICE_ROLE_KEY"); // Edge Functions have access to this secret by default const functionName = "passive-mining"; const app = new Hono().basePath(`/${functionName}`); @@ -40,15 +40,6 @@ app.post("/", async (c: Context) => { } }); -app.get("/", (c: Context) => { - try { - return c.json({ msg: "Passive mining is running" }); - } catch (error) { - console.error("Error in passive-mining:", error); - return c.json({ error: "Failed to check passive-mining" }, 500); - } -}); - Deno.serve((req) => app.fetch(req)); async function getMiningSources() { @@ -66,7 +57,9 @@ async function getMiningSources() { return data; } -async function getLatestPassiveMiningDate(userId: string): Promise { +async function getLatestPassiveMiningDate( + userId: string, +): Promise { const { data, error } = await supabase .schema("private") .from("tasks") @@ -91,14 +84,16 @@ async function getLatestPassiveMiningDate(userId: string): Promise