From bd4d8e674568ead061b9c76bb98f8720164f3356 Mon Sep 17 00:00:00 2001 From: Tosin Ogunjobi Date: Sat, 27 Jan 2024 11:01:36 -0800 Subject: [PATCH] secrets working --- .github/workflows/nextjs.yml | 1 - src/app/page.tsx | 30 ++++++++++-------------------- 2 files changed, 10 insertions(+), 21 deletions(-) diff --git a/.github/workflows/nextjs.yml b/.github/workflows/nextjs.yml index d823185..2513a28 100644 --- a/.github/workflows/nextjs.yml +++ b/.github/workflows/nextjs.yml @@ -43,7 +43,6 @@ jobs: echo "manager=yarn" >> $GITHUB_OUTPUT echo "command=install" >> $GITHUB_OUTPUT echo "runner=yarn" >> $GITHUB_OUTPUT - echo "Testing secret: ${{ secrets.NEXT_PUBLIC_APPLE_DEVELOPER_TOKEN }}" exit 0 elif [ -f "${{ github.workspace }}/package.json" ]; then echo "manager=npm" >> $GITHUB_OUTPUT diff --git a/src/app/page.tsx b/src/app/page.tsx index 5b3a58e..9851be8 100644 --- a/src/app/page.tsx +++ b/src/app/page.tsx @@ -12,8 +12,6 @@ import Transfer from "./components/transfer"; type OPTION = "NONE" | "TRANSFER" | "SYNC"; -// TODO: Once this is deployed, will need to make sure that the source cannot be accessed -// from regular browser. function Home() { const [source, setSource] = useState(null); const [destination, setDestination] = useState(null); @@ -33,24 +31,20 @@ function Home() { // and the user needs to reauthenticate. This is a bug that needs to be fixed. // Currently throws a 403 error when trying to fetch the user's library useEffect(() => { - // TODO: Remove this - console.log(process.env.NEXT_PUBLIC_APPLE_DEVELOPER_TOKEN ?? ""); // @ts-ignore - // window.MusicKit?.configure({ - // developerToken: process.env.NEXT_PUBLIC_APPLE_DEVELOPER_TOKEN ?? "", - // icon: "https://raw.githubusercontent.com/Musish/Musish/assets/misc/authIcon.png", - // }); + window.MusicKit?.configure({ + developerToken: process.env.NEXT_PUBLIC_APPLE_DEVELOPER_TOKEN ?? "", + icon: "https://raw.githubusercontent.com/Musish/Musish/assets/misc/authIcon.png", + }); // @ts-ignore - // const musicKit = new AppleMusicAPI(window.MusicKit?.getInstance()); + const musicKit = new AppleMusicAPI(window.MusicKit?.getInstance()); const spotifySDK = new SpotifySDK(SpotifySDK.CreateSDK()); - setProviders([spotifySDK, spotifySDK]); + setProviders([spotifySDK, musicKit]); }, []); - // const [loading, setLoading] = useState(true); // Use this to show the loading of the providers - /** * Handles the selection of the source provider * @param source The source provider @@ -71,14 +65,10 @@ function Home() { * Handles logging in to the source provider */ const handleContinueSource = async () => { - // TODO: Remove this - console.log(process.env.NEXT_PUBLIC_APPLE_DEVELOPER_TOKEN ?? "Testing"); - - // TODO: Uncomment this - // const loggedIn = await selectedSource?.LogIn(); - // if (loggedIn) { - // setSource(selectedSource); - // } + const loggedIn = await selectedSource?.LogIn(); + if (loggedIn) { + setSource(selectedSource); + } }; /**