-
Notifications
You must be signed in to change notification settings - Fork 127
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #99 from project-slippi/feature/broadcast
Add Broadcasting
- Loading branch information
Showing
55 changed files
with
3,646 additions
and
561 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
FIREBASE_API_KEY=example | ||
FIREBASE_AUTH_DOMAIN=example | ||
FIREBASE_DATABASE_URL=example | ||
FIREBASE_PROJECT_ID=example | ||
FIREBASE_STORAGE_BUCKET=example | ||
FIREBASE_MESSAGING_SENDER_ID=example | ||
FIREBASE_APP_ID=example | ||
FIREBASE_MEASUREMENT_ID=example | ||
|
||
SLIPPI_WS_SERVER=ws://localhost:9898/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,100 @@ | ||
name: Release Builds | ||
|
||
on: | ||
push: | ||
paths-ignore: | ||
- '**.md' | ||
|
||
jobs: | ||
package: | ||
name: Build and package on node ${{ matrix.node-version }} and ${{ matrix.os }} | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
node-version: [10.x] | ||
os: [ubuntu-latest, windows-latest, macOS-latest] | ||
include: | ||
- os: windows-latest | ||
playback_image: windows64-playback | ||
playback_dolphin_path: app/dolphin-dev/windows/ | ||
- os: ubuntu-latest | ||
playback_image: linux-playback | ||
playback_dolphin_path: app/dolphin-dev/linux/ | ||
- os: macOS-latest | ||
playback_image: macOS-playback | ||
playback_dolphin_path: app/dolphin-dev/osx/ | ||
steps: | ||
- name: Use Node.js ${{ matrix.node-version }} on ${{ matrix.os }} | ||
uses: actions/setup-node@v1 | ||
with: | ||
node-version: ${{ matrix.node-version }} | ||
- name: Checkout | ||
uses: actions/[email protected] | ||
- name: Fetch Git Tags | ||
if: success() | ||
shell: bash | ||
run: | | ||
git fetch --prune --unshallow | ||
echo "GIT_BRANCH=$(git rev-parse --abbrev-ref HEAD)" >> $GITHUB_ENV | ||
echo "GIT_HASH=$(git rev-parse --short HEAD)" >> $GITHUB_ENV | ||
echo "GIT_TAG=$(git describe --tags --abbrev=0)" >> $GITHUB_ENV | ||
- name: Cache node modules | ||
uses: actions/cache@v1 | ||
id: cache | ||
with: | ||
path: node_modules | ||
key: ${{ runner.OS }}-build-${{ hashFiles('**/yarn.lock') }} | ||
restore-keys: | | ||
${{ runner.OS }}-build-${{ env.cache-name }}- | ||
${{ runner.OS }}-build- | ||
${{ runner.OS }}- | ||
- name: Load macOS signing certificates and secrets | ||
if: matrix.os == 'macOS-latest' && env.CERTIFICATE_MACOS_PASSWORD != null | ||
run: | | ||
chmod +x build/load-macos-certs-ci.sh && ./build/load-macos-certs-ci.sh | ||
mkdir -p ~/private_keys/ | ||
echo '${{ secrets.APPLE_CONNECT_API_KEY }}' > ~/private_keys/AuthKey_${{ secrets.APPLE_API_KEY_ID }}.p8 | ||
echo "CSC_LINK=${{ secrets.CERTIFICATE_MACOS_APPLICATION }}" >> $GITHUB_ENV | ||
echo "CSC_KEY_PASSWORD=${{ secrets.CERTIFICATE_MACOS_PASSWORD }}" >> $GITHUB_ENV | ||
echo "APPLE_API_KEY=${{ secrets.APPLE_API_KEY_ID }}" >> $GITHUB_ENV | ||
echo "APPLE_ISSUER_ID=${{ secrets.APPLE_ISSUER_ID }}" >> $GITHUB_ENV | ||
echo "APPLE_TEAM_PROVIDER_ID=${{ secrets.APPLE_TEAM_PROVIDER_ID }}" >> $GITHUB_ENV | ||
env: | ||
CERTIFICATE_MACOS_APPLICATION: ${{ secrets.CERTIFICATE_MACOS_APPLICATION }} | ||
CERTIFICATE_MACOS_PASSWORD: ${{ secrets.CERTIFICATE_MACOS_PASSWORD }} | ||
- name: Install dependencies | ||
run: | | ||
yarn install | ||
- name: Download playback artifact | ||
uses: dawidd6/action-download-artifact@v2 | ||
with: | ||
github_token: ${{ secrets.GITHUB_TOKEN }} | ||
workflow: pr-build.yml | ||
branch: slippi | ||
name: ${{ matrix.playback_image }} | ||
path: ${{ matrix.playback_dolphin_path }} | ||
repo: project-slippi/Ishiiruka | ||
- name: Unzip | ||
shell: bash | ||
working-directory: ${{ matrix.playback_dolphin_path }} | ||
run: | | ||
unzip * | ||
rm *.zip | ||
- name: Package | ||
shell: bash | ||
working-directory: ${{ github.workspace }} | ||
run: | | ||
echo ${{ secrets.ENVFILE }} > .env | ||
yarn package | ||
mkdir artifact | ||
cp ./release/Slippi* ./artifact | ||
cp ./release/*.yml ./artifact | ||
env: | ||
USE_HARD_LINKS: false | ||
- name: Publish | ||
if: success() | ||
uses: actions/upload-artifact@v2-preview | ||
with: | ||
name: ${{ matrix.os }} | ||
path: './artifact/' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -51,3 +51,5 @@ main.js.map | |
npm-debug.log.* | ||
|
||
dolphin/ | ||
|
||
.env |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
import { auth } from 'firebase'; | ||
|
||
export const SET_AUTH_USER = 'SET_AUTH_USER'; | ||
export const SET_AUTH_LOADING = 'SET_AUTH_LOADING'; | ||
export const SET_AUTH_ERROR = 'SET_AUTH_ERROR'; | ||
|
||
export function setAuthUser(user) { | ||
return async dispatch => { | ||
dispatch({ | ||
type: SET_AUTH_USER, | ||
user: user, | ||
}); | ||
}; | ||
} | ||
|
||
export function login(email, password, callback) { | ||
return async (dispatch) => { | ||
// Set loading state | ||
dispatch({ | ||
type: SET_AUTH_LOADING, | ||
loading: true, | ||
}); | ||
|
||
// Clear any existing errors | ||
dispatch({ | ||
type: SET_AUTH_ERROR, | ||
error: null, | ||
}); | ||
|
||
try { | ||
const user = await auth().signInWithEmailAndPassword(email, password); | ||
if (user && callback) { | ||
callback(); | ||
} | ||
} catch (err) { | ||
console.error(err); | ||
dispatch({ | ||
type: SET_AUTH_ERROR, | ||
error: err.message, | ||
}); | ||
} | ||
|
||
// Clear loading state | ||
dispatch({ | ||
type: SET_AUTH_LOADING, | ||
loading: false, | ||
}); | ||
}; | ||
} | ||
|
||
export function logout() { | ||
return async () => { | ||
await auth().signOut(); | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
import { BroadcastManager } from '../domain/BroadcastManager'; | ||
import { SpectateManager } from '../domain/SpectateManager'; | ||
|
||
export const SET_DOLPHIN_STATUS = 'SET_DOLPHIN_STATUS'; | ||
export const SET_SLIPPI_STATUS = 'SET_SLIPPI_STATUS'; | ||
export const UPDATE_VIEWABLE_BROADCASTS = 'UPDATE_VIEWABLE_BROADCASTS'; | ||
|
||
const broadcastManager = new BroadcastManager(); | ||
const spectateManager = new SpectateManager(); | ||
|
||
export function setDolphinStatus(status) { | ||
return async (dispatch) => { | ||
dispatch({ | ||
type: SET_DOLPHIN_STATUS, | ||
status: status, | ||
}); | ||
}; | ||
} | ||
|
||
export function setSlippiStatus(status) { | ||
return async (dispatch) => { | ||
dispatch({ | ||
type: SET_SLIPPI_STATUS, | ||
status: status, | ||
}); | ||
}; | ||
} | ||
|
||
export function updateViewableBroadcasts(broadcasts) { | ||
return async (dispatch) => { | ||
dispatch({ | ||
type: UPDATE_VIEWABLE_BROADCASTS, | ||
broadcasts: broadcasts, | ||
}); | ||
}; | ||
} | ||
|
||
export function startBroadcast(target) { | ||
return async () => { | ||
await broadcastManager.start(target); | ||
}; | ||
} | ||
|
||
export function stopBroadcast() { | ||
return async () => { | ||
broadcastManager.stop(); | ||
}; | ||
} | ||
|
||
export function refreshBroadcasts() { | ||
return async () => { | ||
try { | ||
await spectateManager.connect(); | ||
spectateManager.refreshBroadcasts(); | ||
} catch { | ||
// Do nothing | ||
} | ||
}; | ||
} | ||
|
||
export function watchBroadcast(broadcastId) { | ||
return async () => { | ||
spectateManager.watchBroadcast(broadcastId); | ||
}; | ||
} | ||
|
||
export function initSpectate() { | ||
return async () => { | ||
try { | ||
await spectateManager.connect(); | ||
} catch { | ||
// Do nothing | ||
} | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.