Code Monkey home page Code Monkey logo

open-apollo-server's Introduction

open-apollo server component

This is an implementation of the server component for the Apollo Spotify player that implements streaming on the Apple Watch.

Special thanks to @KhaosT for making this player available as open source and to @rafaelmaeuer for pointing me in the right direction for the server implementation.

Prerequisites

To run this, you'll need to have Google Cloud Functions configured.

You'll need to have a Spotify app registered at https://developer.spotify.com/dashboard/applications.

Enter open-apollo://callback under "Redirect URIs" and app.awas.Apollo under "Bundle IDs".

Note your client ID and secret, you'll need it below.

Installing the server endpoints

Set the following environment variables: SPOTIFY_CLIENT_ID, SPOTIFY_CLIENT_SECRET.

Select a nearby region to keep latency low, replacing $REGION below:

gcloud config set functions/region $REGION

The replace statement in the go.mod file doesn't seem to work with the way Cloud Functions are compiled for deployment, therefore run the following to create a vendor directory:

go mod vendor

Finally, deploy the various endpoints:

# /token
gcloud functions deploy token --entry-point Token --runtime go113 --trigger-http --set-env-vars SPOTIFY_CLIENT_ID=$SPOTIFY_CLIENT_ID,SPOTIFY_CLIENT_SECRET=$SPOTIFY_CLIENT_SECRET

# /refresh
gcloud functions deploy refresh --entry-point Refresh --runtime go113 --trigger-http --set-env-vars SPOTIFY_CLIENT_ID=$SPOTIFY_CLIENT_ID,SPOTIFY_CLIENT_SECRET=$SPOTIFY_CLIENT_SECRET

# /track
gcloud functions deploy track --entry-point Track --runtime go113 --trigger-http

# /tracks
gcloud functions deploy tracks --entry-point Tracks --runtime go113 --trigger-http

# /storage-resolve
gcloud functions deploy storage-resolve --entry-point StorageResolve --runtime go113 --trigger-http

Configuring open-apollo

Clone the open-apollo repository.

Copy the base URL for your endpoints (https://$REGION-$PROJECT.cloudfunctions.net/) to the open-apollo/Apollo/Configuration/DefaultServiceConfiguration.swift file, for both YOUR_SERVICE_URL and YOUR_TRACK_SERVICE_URL.

In the open-apollo/Apollo/Configuration/SpotifyAuthorizationContext.swift file, enter your client ID as YOUR_CLIENT_ID, open-apollo as the callbackURLScheme, and open-apollo://callback as the redirect_uri.

In your Apollo Xcode project, in the Info settings for the Apollo target, make sure to add open-apollo as "URL Schemes" in the "URL Types" section.

Compile and run the Apollo app. If you have trouble installing the Apollo Watch app through the iOS Watch app, try running the Watch target directly from Xcode.

If you get any errors, the Cloud Function logs might contain some clues.

open-apollo-server's People

Contributors

lgruen avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

open-apollo-server's Issues

START_ERROR when running Apollo app

Followed your setup with no luck.
Is this supposed to still work?

I'm getting this error when running the app:

[Token] An error has occurred. Please try again later. (START_ERROR) Error: unexpectedResponse(Optional(99 bytes), Optional(Swift.DecodingError.keyNotFound(CodingKeys(string-Value: "id", intValue: nil), Swift.DecodingError.Context(coding-Path: [], debugDescription: "No value associated with key CodingKeys(stringValue:\"id\", intValue: nil) (\"id\").", underlyingError: nil))))

Downloading of tracks for Offline mode fails

Hi there, thank you for putting this together, it's very helpful.

I was able to get open-apollo up and running on my watch but the downloading of tracks for offline access is very slow and it fails most of the time.

Any idea what the reason could be? The cloud functions' logs look OK.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.