From 7f9fb6ae1efa2879b16da888ce5d453a349730d3 Mon Sep 17 00:00:00 2001 From: Nathan Luiz <66922984+nathanluiz33@users.noreply.github.com> Date: Tue, 19 Dec 2023 10:39:20 -0300 Subject: [PATCH] Adding Secret to Crawler Action (#222) --- actions/startAlgoliaCrawler.ts | 11 +-- deno.json | 12 ++-- fresh.gen.ts | 124 +++++++++++++++++---------------- 3 files changed, 75 insertions(+), 72 deletions(-) diff --git a/actions/startAlgoliaCrawler.ts b/actions/startAlgoliaCrawler.ts index 230d9820..d652e362 100644 --- a/actions/startAlgoliaCrawler.ts +++ b/actions/startAlgoliaCrawler.ts @@ -1,25 +1,26 @@ +import { Secret } from "apps/website/loaders/secret.ts"; export interface Props { /** * @title Crawler User ID */ - crawlerUserId: string; + crawlerUserId: Secret; /** * @title Crawler API Key */ - crawlerApiKey: string; + crawlerApiKey: Secret; /** * @title Crawler ID */ - crawlerId: string; + crawlerId: Secret; } const action = async ( { crawlerUserId, crawlerApiKey, crawlerId }: Props, ): Promise => { - const url = `https://crawler.algolia.com/api/1/crawlers/${crawlerId}/reindex`; + const url = `https://crawler.algolia.com/api/1/crawlers/${crawlerId.get()}/reindex`; const headers = { "Content-Type": "application/json", - "Authorization": "Basic " + btoa(`${crawlerUserId}:${crawlerApiKey}`), + "Authorization": "Basic " + btoa(`${crawlerUserId.get()}:${crawlerApiKey.get()}`), }; await fetch(url, { diff --git a/deno.json b/deno.json index 6b01541a..e68f3cd8 100644 --- a/deno.json +++ b/deno.json @@ -5,13 +5,13 @@ "$live/": "https://denopkg.com/deco-cx/deco@1.47.5/", "$store/": "./", "deco/": "https://denopkg.com/deco-cx/deco@1.47.5/", - "apps/": "https://denopkg.com/deco-cx/apps@0.24.13/", - "$fresh/": "https://denopkg.com/denoland/fresh@7ad4610e3a42aba42638cbc1041b96ee58a9b29e/", - "preact": "https://esm.sh/preact@10.15.1", - "preact/": "https://esm.sh/preact@10.15.1/", + "apps/": "https://denopkg.com/deco-cx/apps@0.25.5/", + "$fresh/": "https://deno.land/x/fresh@1.6.1/", + "preact": "https://esm.sh/preact@10.19.2", + "preact/": "https://esm.sh/preact@10.19.2/", "preact-render-to-string": "https://esm.sh/*preact-render-to-string@6.2.1", - "@preact/signals": "https://esm.sh/*@preact/signals@1.1.3", - "@preact/signals-core": "https://esm.sh/*@preact/signals-core@1.2.3", + "@preact/signals": "https://esm.sh/*@preact/signals@1.2.1", + "@preact/signals-core": "https://esm.sh/*@preact/signals-core@1.5.0", "std/": "https://deno.land/std@0.190.0/", "partytown/": "https://denopkg.com/deco-cx/partytown@0.4.8/", "daisyui": "npm:daisyui@3.9.2", diff --git a/fresh.gen.ts b/fresh.gen.ts index e23522e7..1304c90d 100644 --- a/fresh.gen.ts +++ b/fresh.gen.ts @@ -2,73 +2,75 @@ // This file SHOULD be checked into source version control. // This file is automatically updated during development when running `dev.ts`. -import * as $0 from "./routes/_app.tsx"; -import * as $1 from "./routes/admin/[...catchall].tsx"; -import * as $2 from "./routes/api/calc.tsx"; -import * as $3 from "./routes/api/case.tsx"; -import * as $4 from "./routes/api/leads.tsx"; -import * as $5 from "./routes/api/ranking.ts"; -import * as $6 from "./routes/api/webinar.tsx"; -import * as $7 from "./routes/gfm.css.ts"; -import * as $8 from "./routes/hackathon4.ts"; -import * as $9 from "./routes/index.tsx"; -import * as $10 from "./routes/proxy/image/index.tsx"; -import * as $$0 from "./islands/CampHeader.tsx"; -import * as $$1 from "./islands/CampMentor.tsx"; -import * as $$2 from "./islands/Case.tsx"; -import * as $$3 from "./islands/ChangeDevice.tsx"; -import * as $$4 from "./islands/ChangeTheme.tsx"; -import * as $$5 from "./islands/Cms.tsx"; -import * as $$6 from "./islands/ContactUs.tsx"; -import * as $$7 from "./islands/FaviconImage.tsx"; -import * as $$8 from "./islands/ForwardBackButtons/ForwardBackButtons.tsx"; -import * as $$9 from "./islands/Header.tsx"; -import * as $$10 from "./islands/HelpFaq.tsx"; -import * as $$11 from "./islands/ImpactCalculator.tsx"; -import * as $$12 from "./islands/LiveProjects.tsx"; -import * as $$13 from "./islands/OnThisPage.tsx"; -import * as $$14 from "./islands/PopularDocuments.tsx"; -import * as $$15 from "./islands/RankingAnalyze.tsx"; -import * as $$16 from "./islands/RankingHeader.tsx"; -import * as $$17 from "./islands/Sidebar.tsx"; -import * as $$18 from "./islands/SliderJS.tsx"; +import * as $_app from "./routes/_app.tsx"; +import * as $admin_catchall_ from "./routes/admin/[...catchall].tsx"; +import * as $api_calc from "./routes/api/calc.tsx"; +import * as $api_case from "./routes/api/case.tsx"; +import * as $api_leads from "./routes/api/leads.tsx"; +import * as $api_ranking from "./routes/api/ranking.ts"; +import * as $api_webinar from "./routes/api/webinar.tsx"; +import * as $gfm_css from "./routes/gfm.css.ts"; +import * as $hackathon4 from "./routes/hackathon4.ts"; +import * as $index from "./routes/index.tsx"; +import * as $proxy_image_index from "./routes/proxy/image/index.tsx"; +import * as $CampHeader from "./islands/CampHeader.tsx"; +import * as $CampMentor from "./islands/CampMentor.tsx"; +import * as $Case from "./islands/Case.tsx"; +import * as $ChangeDevice from "./islands/ChangeDevice.tsx"; +import * as $ChangeTheme from "./islands/ChangeTheme.tsx"; +import * as $Cms from "./islands/Cms.tsx"; +import * as $ContactUs from "./islands/ContactUs.tsx"; +import * as $FaviconImage from "./islands/FaviconImage.tsx"; +import * as $ForwardBackButtons_ForwardBackButtons from "./islands/ForwardBackButtons/ForwardBackButtons.tsx"; +import * as $Header from "./islands/Header.tsx"; +import * as $HelpFaq from "./islands/HelpFaq.tsx"; +import * as $ImpactCalculator from "./islands/ImpactCalculator.tsx"; +import * as $LiveProjects from "./islands/LiveProjects.tsx"; +import * as $OnThisPage from "./islands/OnThisPage.tsx"; +import * as $PopularDocuments from "./islands/PopularDocuments.tsx"; +import * as $RankingAnalyze from "./islands/RankingAnalyze.tsx"; +import * as $RankingHeader from "./islands/RankingHeader.tsx"; +import * as $Sidebar from "./islands/Sidebar.tsx"; +import * as $SliderJS from "./islands/SliderJS.tsx"; +import { type Manifest } from "$fresh/server.ts"; const manifest = { routes: { - "./routes/_app.tsx": $0, - "./routes/admin/[...catchall].tsx": $1, - "./routes/api/calc.tsx": $2, - "./routes/api/case.tsx": $3, - "./routes/api/leads.tsx": $4, - "./routes/api/ranking.ts": $5, - "./routes/api/webinar.tsx": $6, - "./routes/gfm.css.ts": $7, - "./routes/hackathon4.ts": $8, - "./routes/index.tsx": $9, - "./routes/proxy/image/index.tsx": $10, + "./routes/_app.tsx": $_app, + "./routes/admin/[...catchall].tsx": $admin_catchall_, + "./routes/api/calc.tsx": $api_calc, + "./routes/api/case.tsx": $api_case, + "./routes/api/leads.tsx": $api_leads, + "./routes/api/ranking.ts": $api_ranking, + "./routes/api/webinar.tsx": $api_webinar, + "./routes/gfm.css.ts": $gfm_css, + "./routes/hackathon4.ts": $hackathon4, + "./routes/index.tsx": $index, + "./routes/proxy/image/index.tsx": $proxy_image_index, }, islands: { - "./islands/CampHeader.tsx": $$0, - "./islands/CampMentor.tsx": $$1, - "./islands/Case.tsx": $$2, - "./islands/ChangeDevice.tsx": $$3, - "./islands/ChangeTheme.tsx": $$4, - "./islands/Cms.tsx": $$5, - "./islands/ContactUs.tsx": $$6, - "./islands/FaviconImage.tsx": $$7, - "./islands/ForwardBackButtons/ForwardBackButtons.tsx": $$8, - "./islands/Header.tsx": $$9, - "./islands/HelpFaq.tsx": $$10, - "./islands/ImpactCalculator.tsx": $$11, - "./islands/LiveProjects.tsx": $$12, - "./islands/OnThisPage.tsx": $$13, - "./islands/PopularDocuments.tsx": $$14, - "./islands/RankingAnalyze.tsx": $$15, - "./islands/RankingHeader.tsx": $$16, - "./islands/Sidebar.tsx": $$17, - "./islands/SliderJS.tsx": $$18, + "./islands/CampHeader.tsx": $CampHeader, + "./islands/CampMentor.tsx": $CampMentor, + "./islands/Case.tsx": $Case, + "./islands/ChangeDevice.tsx": $ChangeDevice, + "./islands/ChangeTheme.tsx": $ChangeTheme, + "./islands/Cms.tsx": $Cms, + "./islands/ContactUs.tsx": $ContactUs, + "./islands/FaviconImage.tsx": $FaviconImage, + "./islands/ForwardBackButtons/ForwardBackButtons.tsx": + $ForwardBackButtons_ForwardBackButtons, + "./islands/Header.tsx": $Header, + "./islands/HelpFaq.tsx": $HelpFaq, + "./islands/ImpactCalculator.tsx": $ImpactCalculator, + "./islands/LiveProjects.tsx": $LiveProjects, + "./islands/OnThisPage.tsx": $OnThisPage, + "./islands/PopularDocuments.tsx": $PopularDocuments, + "./islands/RankingAnalyze.tsx": $RankingAnalyze, + "./islands/RankingHeader.tsx": $RankingHeader, + "./islands/Sidebar.tsx": $Sidebar, + "./islands/SliderJS.tsx": $SliderJS, }, baseUrl: import.meta.url, -}; +} satisfies Manifest; export default manifest;