Skip to content

Commit

Permalink
secrets working
Browse files Browse the repository at this point in the history
  • Loading branch information
oogunjob committed Jan 27, 2024
1 parent f954eef commit bd4d8e6
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 21 deletions.
1 change: 0 additions & 1 deletion .github/workflows/nextjs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
30 changes: 10 additions & 20 deletions src/app/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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<BaseProvider | null | undefined>(null);
const [destination, setDestination] = useState<BaseProvider | null | undefined>(null);
Expand All @@ -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
Expand All @@ -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);
}
};

/**
Expand Down

0 comments on commit bd4d8e6

Please sign in to comment.