Skip to content
This repository was archived by the owner on Feb 7, 2022. It is now read-only.

Commit fb46288

Browse files
authored
Merge pull request #63 from Pogify/dev-deploy
Start of Pogify Alpha. Onto Pogify Beta 0.1.0
2 parents b4c95ce + 91bee17 commit fb46288

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

79 files changed

+3571
-1684
lines changed

.dockerignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
node_modules

.env.development

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
REACT_APP_CLOUD_FUNCTION_EMULATOR_BASE_URL=http://localhost:5001/fakeproject/us-central1
2+
REACT_APP_SPOTIFY_CLIENT_ID=
3+
REACT_APP_SUB=http://localhost
Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,20 @@
11
---
22
name: Bug report
33
about: Create a report to help us improve
4-
title: ''
5-
labels: ''
6-
assignees: ''
7-
4+
title: ""
5+
labels: ""
6+
assignees: ""
87
---
98

9+
**Do you understand that Pogify does not support Safari, Mobile, or Spotify Free at this time?**
10+
(Yes / No)
11+
1012
**Describe the bug**
1113
A clear and concise description of what the bug is.
1214

1315
**To Reproduce**
1416
Steps to reproduce the behavior:
17+
1518
1. Go to '...'
1619
2. Click on '....'
1720
3. Scroll down to '....'
@@ -24,15 +27,17 @@ A clear and concise description of what you expected to happen.
2427
If applicable, add screenshots to help explain your problem.
2528

2629
**Desktop (please complete the following information):**
27-
- OS: [e.g. iOS]
28-
- Browser [e.g. chrome, safari]
29-
- Version [e.g. 22]
30+
31+
- OS: [e.g. iOS]
32+
- Browser [e.g. chrome, safari]
33+
- Version [e.g. 22]
3034

3135
**Smartphone (please complete the following information):**
32-
- Device: [e.g. iPhone6]
33-
- OS: [e.g. iOS8.1]
34-
- Browser [e.g. stock browser, safari]
35-
- Version [e.g. 22]
36+
37+
- Device: [e.g. iPhone6]
38+
- OS: [e.g. iOS8.1]
39+
- Browser [e.g. stock browser, safari]
40+
- Version [e.g. 22]
3641

3742
**Additional context**
3843
Add any other context about the problem here.

.github/ISSUE_TEMPLATE/feature_request.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
---
22
name: Feature request
33
about: Suggest an idea for this project
4-
title: ''
5-
labels: ''
6-
assignees: ''
7-
4+
title: ""
5+
labels: ""
6+
assignees: ""
87
---
98

9+
**Do you understand that Pogify does not support Safari, Mobile, or Spotify Free at this time?**
10+
(Yes / No)
11+
1012
**Is your feature request related to a problem? Please describe.**
1113
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
1214

.github/config.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
todo:
2+
autoAssign: false
3+
keyword: ["@todo","TODO","TODO:", "FIXME", "FIXME:"]

.github/workflows/dev-deploy.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# This is a basic workflow to help you get started with Actions
2+
3+
name: Deploy develop branch
4+
5+
# Controls when the action will run. Triggers the workflow on push or pull request
6+
# events but only for the develop branch
7+
on:
8+
push:
9+
branches: [ develop ]
10+
11+
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
12+
jobs:
13+
# This workflow contains a single job called "build"
14+
Merge:
15+
# The type of runner that the job will run on
16+
runs-on: ubuntu-latest
17+
18+
# Steps represent a sequence of tasks that will be executed as part of the job
19+
steps:
20+
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
21+
- uses: actions/checkout@v2
22+
23+
- name: Merge develop -> dev-deploy
24+
# You may pin to the exact commit or the version.
25+
# uses: devmasx/merge-branch@f469882817d277403efcfba82a62fe96a61a6805
26+
uses: devmasx/[email protected]
27+
with:
28+
type: now
29+
head_to_merge: develop
30+
target_branch: dev-deploy
31+
github_token: ${{ secrets.GITHUB_TOKEN }}

CODE_OF_CONDUCT.md

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -14,22 +14,22 @@ appearance, race, religion, or sexual identity and orientation.
1414
Examples of behavior that contributes to creating a positive environment
1515
include:
1616

17-
* Using welcoming and inclusive language
18-
* Being respectful of differing viewpoints and experiences
19-
* Gracefully accepting constructive criticism
20-
* Focusing on what is best for the community
21-
* Showing empathy towards other community members
17+
- Using welcoming and inclusive language
18+
- Being respectful of differing viewpoints and experiences
19+
- Gracefully accepting constructive criticism
20+
- Focusing on what is best for the community
21+
- Showing empathy towards other community members
2222

2323
Examples of unacceptable behavior by participants include:
2424

25-
* The use of sexualized language or imagery and unwelcome sexual attention or
26-
advances
27-
* Trolling, insulting/derogatory comments, and personal or political attacks
28-
* Public or private harassment
29-
* Publishing others' private information, such as a physical or electronic
30-
address, without explicit permission
31-
* Other conduct which could reasonably be considered inappropriate in a
32-
professional setting
25+
- The use of sexualized language or imagery and unwelcome sexual attention or
26+
advances
27+
- Trolling, insulting/derogatory comments, and personal or political attacks
28+
- Public or private harassment
29+
- Publishing others' private information, such as a physical or electronic
30+
address, without explicit permission
31+
- Other conduct which could reasonably be considered inappropriate in a
32+
professional setting
3333

3434
## Our Responsibilities
3535

CONTRIBUTING.md

Lines changed: 41 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,9 @@ If you are looking to help with UI/UX, please note that we do not have a style g
4949
{
5050
"jwt": {
5151
"secret": "anysecretyoudlike"
52+
},
53+
"pubsub": {
54+
"url": "https://anystringyoudlike.itdoesntmatteritsnotusedinemulation.com"
5255
}
5356
}
5457
```
@@ -63,8 +66,8 @@ Congratulations, you should now be running a local environment for the backend o
6366

6467
1. Clone this repo (`git clone https://github.com/Pogify/pogify.git`)
6568
2. Switch to the `develop` branch (`git checkout develop`)
66-
2. Change directory `cd` to the newly created `pogify` repo and install dependencies with `yarn install`.
67-
3. Create a file in the directory named `.env` or `.env.development.local`, replace {URL} with the URL of your emulated functions (from your Firebase CLI window) and {CLIENT_ID} with your Spotify API Client ID from the prerequisites.
69+
3. Change directory `cd` to the newly created `pogify` repo and install dependencies with `yarn install`.
70+
4. Create a file in the directory named `.env` or `.env.development.local`, replace {URL} with the URL of your emulated functions (from your Firebase CLI window) and {CLIENT_ID} with your Spotify API Client ID from the prerequisites.
6871
```
6972
REACT_APP_SUB=https://messages.pogify.net
7073
REACT_APP_CLOUD_FUNCTION_EMULATOR_BASE_URL={URL}
@@ -78,6 +81,7 @@ Congratulations, you should now be running a local environment for the backend o
7881
Congratulations, you should now be running a local environment for the frontend of Pogify!
7982

8083
###### A couple notes:
84+
8185
- Sessions hosted from local environments cannot be joined from the pogify.net production deployment.
8286
- Sessions hosted on a pogify.net production deployment can be joined from a local environment.
8387
- Missing any one step wil throw an error. Be sure to read each and every single instruction carefully.
@@ -94,4 +98,38 @@ Congratulations, you should now be running a local environment for the backend o
9498
4. Change directory `cd` into the `pogify` repo.
9599
5. Run `yarn start`.
96100

97-
**Thanks for contributing to Pogify! We can't wait to see what you do with it!**
101+
## Naming Scheme Conventions
102+
103+
- React components are PascalCased
104+
- non React js files are camelCased
105+
- folders are hyphen-cased
106+
- test files are cased according to the file that the test runs
107+
- CSS files are PascalCased
108+
- Note: please avoid using global namespaced stylesheets and use [css modules](https://create-react-app.dev/docs/adding-a-css-modules-stylesheet/) instead.
109+
- [Styled-components](https://styled-components.com/) are also acceptable.
110+
- Just avoid using inline styles
111+
- We are transitioning away from inline styles.
112+
113+
## Directory structure
114+
115+
- `/src` all source files
116+
- `/src/routes` components that react-router
117+
- `/src/components` other components
118+
- Components can be just jsx files or PascalCased folders with an index.jsx and index.module.css
119+
- `/src/components/utils` components
120+
- `/src/layouts` layout related HOCs
121+
- `/src/modals` modal components
122+
- `/src/stores` mobx stores
123+
- `/src/context` contexts
124+
- `/src/hooks` react hooks
125+
- `/src/styles` CSS files for global or reused styles
126+
- _Note:_ Please try avoid writing global CSS styles (ie. \[something\].css) and use css modules instead (ie. \[something\]._module_.css)
127+
- `/src/utils` utility functions
128+
- `src/__tests__` all tests
129+
- `src/__tests__/unit` unit tests
130+
- follows structure of src files
131+
- `src/__tests__/integration` integration tests
132+
- `src/__mocks__` test mocks
133+
- `src/__utils__` test utils
134+
135+
## **Thanks for contributing to Pogify! We can't wait to see what you do with it!**

Dockerfile

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
FROM node:dubnium-alpine
2+
3+
WORKDIR /app
4+
5+
COPY package.json ./
6+
COPY yarn.lock ./
7+
RUN yarn install
8+
9+
COPY . ./
10+
11+
EXPOSE 3000
12+
13+
CMD ["yarn", "start"]
14+
15+
16+

README.md

Lines changed: 54 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ Pogify does **NOT** stream audio from the host of a listening session. Instead,
5555
- Nginx
5656
- with [push_stream_module](https://github.com/wandenberg/nginx-push-stream-module)
5757
- module enables us to handle 60k connections on one VPS (single core, 1GB).
58-
- Google Firebase
58+
- Google Firebase
5959
- Realtime Database & Authentication
6060
- uses anonymous sign in and the realtime database to implement a rate limiter for cloud functions
6161
- Cloud Functions
@@ -90,34 +90,36 @@ Pogify uses Google Firebase's Authentication service to use its anonymous sign i
9090

9191
## Known Issues / Limitations
9292

93-
This project is still in alpha and as such there are still lots of bugs.
93+
This project is still in alpha and as such, there are still lots of bugs.
94+
95+
If you have an issue that isn't listed below or does not have an open issue, please help us by [opening a new one](https://github.com/Pogify/pogify/issues/new/choose).
9496

9597
Currently the project is deployed on a free tier heroku dyno. Thus, we cannot use SSL with a custom domain. Thus, www.pogify.net redirects to the non-custom pogify.herokuapp.com for the moment.
9698

97-
1. ### Pogify does **NOT** work on Safari, or Mobile Browsers
98-
99-
- This is a limitation of the Spotify Web Playback SDK.
100-
- ref 1: https://developer.spotify.com/documentation/web-playback-sdk/#supported-browsers
101-
- ref 2: https://github.com/spotify/web-playback-sdk/issues/10
102-
103-
2. Listeners cannot play pause their local spotify
104-
3. Session member count is always 0.
105-
4. Listener Player will stutter.
106-
5. Listener player unexpectedly seek to beginning of track.
107-
6. Seeking on a listener player will de-synchronize a listener from the host and will not resynchronize until an update from host.
108-
7. ~~Volume Control is not good.~~
109-
8. 'Join Session' / 'Start session' buttons sometimes do not work
110-
9. Incomplete error handling
111-
10. Leftover console.logs
112-
11. No nav bar or alternative
113-
12. Sessions may timeout even if its active.
114-
13. Navigating away from player screen shows an alert.
115-
14. Pogify will unexpectedly automatically redirect to the Spotify login page if it fails to refresh the login session.
116-
15. State updates by the Spotify Web Player SDK makes two plus updates per state change. There is not yet a solution to consolidate and/or drop an update and not post an update.
117-
16. ~~Pogify does not yet comply 100% with Spotify Developer Agreement. We are working as fast as possible to remedy this shortfall.~~
118-
17. there are no tests.
119-
18. sparse code commenting
120-
19. And probably many more I forgot about
99+
### Note: Pogify does **NOT** work on Safari, or Mobile Browsers
100+
101+
- This is a limitation of the Spotify Web Playback SDK.
102+
- ref 1: https://developer.spotify.com/documentation/web-playback-sdk/#supported-browsers
103+
- ref 2: https://github.com/spotify/web-playback-sdk/issues/10
104+
105+
### Major Issues
106+
107+
2. Listener player may cut out a couple seconds to the end of a track.
108+
- diagnosis: because of latency and things of this nature, host may send a new track update before the end of the listener's current track.
109+
- short-term solution: if the update is for the next track (ie position = 0) have player wait till end of track _or_ add as next song in queue for continuous playback.
110+
- long-term solution: listener player's queue should be synchronized with host's. If host updates with the start of the next track, listener should just continue.
111+
3. 'Join Session' / 'Start session' buttons sometimes do not work
112+
4. Incomplete error handling
113+
5. Leftover console.logs
114+
6. No nav bar or alternative
115+
7. Sessions may timeout even if its active.
116+
8. Excessive skipping forward or backwards will break listener.
117+
- diagnosis: repeated skips aren't captured by debouncer, probably because updates take longer than 300 to fire thus every skip is sent to the listener.
118+
- solution:
119+
9. ~~there are no tests.~~ there are two tests.
120+
10. Pogify can't recognize seeks to 0 ~~sometimes~~ most of the time.
121+
- diagnosis: Spotify doesn't fire a state change event when seeking to 0 if already seeked to 0 once, so Pogify misses it.
122+
- solution: poll for spotify data periodically (ie once a second) using player.getCurrentState()
121123

122124
## Contributing and Communication
123125

@@ -126,15 +128,37 @@ Currently, Pogify is open to contributors but please note that Pogify is stil in
126128
The above paragraph is verbatim from the [Contributing Guidelines](https://github.com/Pogify/pogify/blob/master/CONTRIBUTING.md) which all contributors must read before attempting to contribute!
127129
All Pogify contributors are bound by the [Contributor Covenant Code of Conduct](https://github.com/Pogify/pogify/blob/develop/CONTRIBUTING.md).
128130

131+
## Dev-ing
132+
133+
1. Execute `yarn` into the folder of this repository
134+
2. Copy the file `.env.development` to `.env.development.local` and edit the following:
135+
- the URL in the env variable `REACT_APP_CLOUD_FUNCTION_EMULATOR_BASE_URL` to match the URL of the functions endpoint in the Firebase emulator (typically of the form: `http://localhost:5001/theprojectyoucreated/us-central1`)
136+
- The client ID of the Spotify App in `REACT_APP_SPOTIFY_CLIENT_ID`, obtainable from their developer website here: https://developer.spotify.com/dashboard/applications <br>
137+
Do not forget to also whitelist the redirect URI (`/auth`, so you can put `http://localhost:3000/auth` with the default settings)
138+
- If needed, also set the Nginx SSE endpoint via the `REACT_APP_SUB` variable
139+
3. Run `yarn start-dev`
140+
129141
## Todo List
130142

131-
- [ ] Make a looping script or something that people can use to develop the listener player without 2 accounts.
132-
- [ ] code comments
143+
- [x] Make a looping script or something that people can use to develop the listener player without 2 accounts. (available in pogify/pogify-nginx-container)
144+
- [x] code comments
133145
- [ ] tests
134-
- [ ] debouncer for client events (would fix no. 15 of Known Issues)
146+
- [x] debouncer for client events (would fix no. 15 of Known Issues)
147+
- [ ] verified sessions
148+
- [ ] twitch
149+
- [ ] move all player (host and listener) logic into stores so that player can be used outside of `/session/{id}`.
150+
- [x] player logic moved to mobx store.
151+
- [ ] readme `Fixed by {SHA}` should have proper links to commits.
152+
- [ ] `'playImmediately'` button
135153

136154
## Related Repos
137155

138156
### [Pogify/pogify-functions](https://github.com/Pogify/pogify-functions)
139157

140-
Repo housing pogify's Google Cloud functions
158+
Repo housing Pogify's Google Cloud functions
159+
<br>
160+
<br>
161+
162+
### [Pogify/pogify-nginx-container](https://github.com/Pogify/pogify-nginx-container)
163+
164+
Repo housing Pogify's message broadcaster system

0 commit comments

Comments
 (0)