diff --git a/.env.development b/.env.development new file mode 100644 index 00000000..ec5fb844 --- /dev/null +++ b/.env.development @@ -0,0 +1,3 @@ +VITE_OPEN_SAUCED_INSIGHTS_DOMAIN = "beta.insights.opensauced.pizza" +VITE_OPEN_SAUCED_API_ENDPOINT = "https://beta.api.opensauced.pizza/v1" +VITE_OPEN_SAUCED_SUPABASE_ID = "fcqqkxwlntnrtjfbcioz" \ No newline at end of file diff --git a/.env.production b/.env.production new file mode 100644 index 00000000..7de39ca8 --- /dev/null +++ b/.env.production @@ -0,0 +1,3 @@ +VITE_OPEN_SAUCED_INSIGHTS_DOMAIN = "insights.opensauced.pizza" +VITE_OPEN_SAUCED_API_ENDPOINT = "https://api.opensauced.pizza/v1" +VITE_OPEN_SAUCED_SUPABASE_ID = "ibcwmlhcimymasokhgvn" \ No newline at end of file diff --git a/README.md b/README.md index 8dc00379..9b0080d5 100644 --- a/README.md +++ b/README.md @@ -38,12 +38,23 @@ To install the project dependencies: npm ci ``` + To run a local instance of the project: +### On development environment + ```shell npm run dev ``` +### On Production environment + +```shell +npm run build +npm run preview +``` + + ## Installing the local build on a Chromium based browser: After running the above commands, 1. Navigate to `chrome://extensions`. diff --git a/manifest.json b/manifest.json index e68ac894..f44bbee7 100644 --- a/manifest.json +++ b/manifest.json @@ -20,6 +20,6 @@ "48": "src/assets/os-icons/os-icon-48.png", "128": "src/assets/os-icons/os-icon-128.png" }, - "host_permissions": ["https://github.com/*", "https://insights.opensauced.pizza/*"], + "host_permissions": ["https://github.com/*", "https://*.insights.opensauced.pizza/*"], "permissions": ["storage", "tabs", "cookies"] } diff --git a/src/constants.ts b/src/constants.ts index 9cd94565..ec88216d 100644 --- a/src/constants.ts +++ b/src/constants.ts @@ -1,20 +1,23 @@ // OpenSauced constants -export const SUPABASE_LOGIN_URL = "https://ibcwmlhcimymasokhgvn.supabase.co/auth/v1/authorize?provider=github&redirect_to=https://insights.opensauced.pizza/"; +export const OPEN_SAUCED_INSIGHTS_DOMAIN = import.meta.env.VITE_OPEN_SAUCED_INSIGHTS_DOMAIN; +export const OPEN_SAUCED_API_ENDPOINT = import.meta.env.VITE_OPEN_SAUCED_API_ENDPOINT; +export const SUPABASE_LOGIN_URL = `https://${import.meta.env.VITE_OPEN_SAUCED_SUPABASE_ID}.supabase.co/auth/v1/authorize?provider=github&redirect_to=https://${OPEN_SAUCED_INSIGHTS_DOMAIN}/`; + + export const SUPABASE_AUTH_COOKIE_NAME = "supabase-auth-token"; export const OPEN_SAUCED_AUTH_TOKEN_KEY = "os-access-token"; export const OPEN_SAUCED_OPTED_LOG_OUT_KEY = "opted-log-out"; -export const OPEN_SAUCED_INSIGHTS_DOMAIN = "insights.opensauced.pizza"; export const AI_PR_DESCRIPTION_CONFIG_KEY = "ai-pr-description-config"; -// API endpoints -export const OPEN_SAUCED_API_ENDPOINT = "https://api.opensauced.pizza/v1"; + export const OPEN_SAUCED_USERS_ENDPOINT = `${OPEN_SAUCED_API_ENDPOINT}/users`; export const OPEN_SAUCED_REPOS_ENDPOINT = `${OPEN_SAUCED_API_ENDPOINT}/repos`; export const OPEN_SAUCED_SESSION_ENDPOINT = `${OPEN_SAUCED_API_ENDPOINT}/auth/session`; export const OPEN_SAUCED_USER_INSIGHTS_ENDPOINT = `${OPEN_SAUCED_API_ENDPOINT}/user/insights`; export const OPEN_SAUCED_AI_PR_DESCRIPTION_ENDPOINT = `${OPEN_SAUCED_API_ENDPOINT}/prs/description/generate`; export const OPEN_SAUCED_USER_HIGHLIGHTS_ENDPOINT = `${OPEN_SAUCED_API_ENDPOINT}/user/highlights`; -export const OPEN_SAUCED_AI_CODE_REFACTOR_ENDPOINT = "https://api.opensauced.pizza/v1/prs/suggestion/generate"; +export const OPEN_SAUCED_AI_CODE_REFACTOR_ENDPOINT = `${OPEN_SAUCED_API_ENDPOINT}/prs/suggestion/generate`; + // GitHub constants/selectors export const GITHUB_PROFILE_MENU_SELECTOR = ".p-nickname.vcard-username.d-block"; diff --git a/src/content-scripts/components/AddPRToHighlights/AddPRToHighlightsButton.ts b/src/content-scripts/components/AddPRToHighlights/AddPRToHighlightsButton.ts index 15a9ff01..16e436eb 100644 --- a/src/content-scripts/components/AddPRToHighlights/AddPRToHighlightsButton.ts +++ b/src/content-scripts/components/AddPRToHighlights/AddPRToHighlightsButton.ts @@ -1,5 +1,6 @@ import { createHtmlElement } from "../../../utils/createHtmlElement"; import openSaucedLogoIcon from "../../../assets/opensauced-icon.svg"; +import { OPEN_SAUCED_INSIGHTS_DOMAIN } from "../../../constants"; export const AddPRToHighlightsButton = () => { const addPRToHighlightsButton = createHtmlElement("a", { @@ -9,7 +10,7 @@ export const AddPRToHighlightsButton = () => { openSaucedLogoIcon, )}>