Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
fefcaf1
Init
elistone May 3, 2020
51aa925
Fix e2e testing
elistone May 5, 2020
82f90c7
Small styling changes
elistone May 5, 2020
04e42ce
Started creating host page, and bumped bootstrapvue version
elistone May 5, 2020
35fcea3
Setup local firebase environment
elistone May 23, 2020
649174d
Sorting out some firebase settings
elistone May 24, 2020
41abfea
Updates the home page
elistone Jun 14, 2020
cfe50ca
Updating packages and added in how to play slide show
elistone Nov 6, 2020
6556d74
Sorting song selector order
elistone Nov 6, 2020
a5d26e9
Lots of little changes
elistone Nov 6, 2020
a591ee0
Added Spinner.vue
elistone Nov 7, 2020
4af127f
Correcting button sizes for letters question
elistone Nov 7, 2020
7f13dcc
Adding pulse for timer when not running.
elistone Nov 7, 2020
a96191b
Sorting out some mobile layout issues
elistone Nov 7, 2020
cdd479f
Sorting out some mobile layout issues
elistone Nov 8, 2020
aa6984d
Added in scoreboard display and game states
elistone Nov 8, 2020
6565d51
Removed the scoreboard animation but kept the rainbow
elistone Nov 9, 2020
a8ffb22
Created PlayerBadge.vue
elistone Nov 9, 2020
582356c
Added player badge to Scoreboard.vue
elistone Nov 9, 2020
016985c
updated packages and names
elistone Nov 9, 2020
1a05759
Started to add in AudioImageLoader
elistone Nov 9, 2020
c08391b
Uploaded the loading information
elistone Nov 9, 2020
07ace5e
Updated the loading image visibility options.
elistone Nov 10, 2020
32ecb7c
Limiting jumbotron width and fixing image show flicker
elistone Nov 10, 2020
0e82dd5
Added the ability to toggle image/audio
elistone Nov 10, 2020
3294630
Updated workflows
elistone Nov 12, 2020
1d4d95b
bump cypress testing version
elistone Nov 12, 2020
5fd1fdb
little bit of refactoring
elistone Nov 15, 2020
f2492f4
Moved the form submittion button and added skip in how to play
elistone Nov 15, 2020
4338ef0
Added router layout transitions
elistone Nov 15, 2020
e4fbe39
Updated waiting text
elistone Nov 15, 2020
ba30535
Setting up host page and improvement to transitions so they can be co…
elistone Nov 15, 2020
bf0e298
Speed up transitions
elistone Nov 15, 2020
6d6fb3b
Started to design the host Dashboard.vue
elistone Nov 15, 2020
edf1259
Adding more to the host dashboard
elistone Nov 17, 2020
67d1bd8
Added mobile preview onto the Dashboard.vue
elistone Nov 17, 2020
8538c7c
Setup quick joining for hosts
elistone Nov 18, 2020
7c5facd
Setting up dashboard question component
elistone Nov 18, 2020
dfa140d
Added back button on host home page
elistone Nov 18, 2020
01721bc
Few styling changes, starting to generated game codes on creation
elistone Nov 18, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[*.{js,jsx,ts,tsx,vue}]
indent_style = space
indent_size = 2
end_of_line = lf
trim_trailing_whitespace = true
insert_final_newline = true
max_line_length = 100
6 changes: 6 additions & 0 deletions .env.default
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
VUE_APP_SITE_NAME=Quiz Now
VUE_APP_PUSHER_API_ID=
VUE_APP_PUSHER_KEY=
VUE_APP_PUSHER_SECRECT=
VUE_APP_PUSHER_CLUSTER=
VUE_APP_CRYPT_KEY=
35 changes: 35 additions & 0 deletions .github/workflows/nodejs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Vue.JS CI

on: [push]

jobs:
build:

runs-on: ubuntu-latest

strategy:
matrix:
node-version: [8.x, 10.x, 12.x]

steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/checkout@v2
with:
node-version: ${{ matrix.node-version }}
- name: run npm install
run: |
npm ci
- name: run npm run test:unit
run: |
npm run test:unit
- name: cypress e2e:run
uses: cypress-io/github-action@v2
with:
start: npm run serve
wait-on: http://localhost:8080/
config_file: cypress.json
spec: "tests/e2e/**/*"
env:
CI: true
CYPRESS_baseUrl: http://localhost:8080/
32 changes: 32 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
.DS_Store
node_modules
/dist

/tests/e2e/videos/
/tests/e2e/screenshots/

# local env files
.env.local
.env.*.local
.env
.env.production

# Log files
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# Editor directories and files
.idea
.vscode
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?

# folders
/public/audio/buzzers/*
!/public/audio/buzzers/.gitkeep
.firebaserc
.firebase/
55 changes: 53 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,53 @@
# Quick Quiz
Quick quiz is a vuejs version of www.speedquizzing.com - which allows hosting and running quiz's via a web browser.
# Quiz Now

Quiz Now is a VueJs version of www.speedquizzing.com - which allows hosting and running quiz's via a web browser.

## Project setup

### Configure client

```
npm install
```

Setup the `.env` variables.
* copy `.env.default` & rename it as `.env`
* fill in the variable values
* Note: _you can also create `.env.production` if there are certain variables that only apply to production_.
* `npm run serve` - to start the server up locally


### Configure server

The backend server users firebase functions to control logging into channels with extra information.

#### Local development

To configure for local development you will need to have firebase tools installed locally:
* `npm install -g firebase-tools` - if you don't already have it installed
* inside the `/functions` folder run `npm install`
* inside the `/functions` folder copy the `example.runtimeconfig.json` and rename it to `.runtimeconfig.json`
* inside the newly created `.runtimeconfig.json` fill in the pusher information.

#### Production setup

To set up the environment for production you will need to save all the config into your firebase account.
The below method should be called replacing the example strings with real data.

```
firebase functions:config:set pusher.appid="THE APP ID" pusher.key="THE KEY" pusher.secret="THE SECRET" pusher.cluster="THE CLUSTER"
```

Note: once you have real data on your firebase account you can run `firebase functions:config:get > .runtimeconfig.json` to pull this data down to use locally.

You can then run `npm run deploy` to push the data up to firebase.

### Other information

The client end is build using vuejs and can use the following npm commands

* `npm run serve` - Compiles and hot-reloads for development
* `npm run build` - Compiles and minifies for production
* `npm run test:unit` - Run your unit tests
* `npm run test:e2e` - Run your end-to-end tests
* `npm run lint` - Lints and fixes files
5 changes: 5 additions & 0 deletions babel.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
module.exports = {
presets: [
'@vue/cli-plugin-babel/preset',
],
};
3 changes: 3 additions & 0 deletions cypress.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"pluginsFile": "tests/e2e/plugins/index.js"
}
20 changes: 20 additions & 0 deletions firebase.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"hosting": {
"public": "dist",
"ignore": [
"firebase.json",
"**/.*",
"**/node_modules/**"
],
"rewrites": [
{
"source": "/pusher{,/**}",
"function": "app"
},
{
"source": "**",
"destination": "/index.html"
}
]
}
}
111 changes: 111 additions & 0 deletions functions/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
{
"parserOptions": {
// Required for certain syntax usages
"ecmaVersion": 2017
},
"plugins": [],
"extends": "eslint:recommended",
"rules": {
// Removed rule "disallow the use of console" from recommended eslint rules
"no-console": "off",

// Removed rule "disallow multiple spaces in regular expressions" from recommended eslint rules
"no-regex-spaces": "off",

// Removed rule "disallow the use of debugger" from recommended eslint rules
"no-debugger": "off",

// Removed rule "disallow unused variables" from recommended eslint rules
"no-unused-vars": "off",

// Removed rule "disallow mixed spaces and tabs for indentation" from recommended eslint rules
"no-mixed-spaces-and-tabs": "off",

// Removed rule "disallow the use of undeclared variables unless mentioned in /*global */ comments" from recommended eslint rules
"no-undef": "off",

// Warn against template literal placeholder syntax in regular strings
"no-template-curly-in-string": 1,

// Warn if return statements do not either always or never specify values
"consistent-return": 1,

// Warn if no return statements in callbacks of array methods
"array-callback-return": 1,

// Require the use of === and !==
"eqeqeq": 2,

// Disallow the use of alert, confirm, and prompt
"no-alert": 2,

// Disallow the use of arguments.caller or arguments.callee
"no-caller": 2,

// Disallow null comparisons without type-checking operators
"no-eq-null": 2,

// Disallow the use of eval()
"no-eval": 2,

// Warn against extending native types
"no-extend-native": 1,

// Warn against unnecessary calls to .bind()
"no-extra-bind": 1,

// Warn against unnecessary labels
"no-extra-label": 1,

// Disallow leading or trailing decimal points in numeric literals
"no-floating-decimal": 2,

// Warn against shorthand type conversions
"no-implicit-coercion": 1,

// Warn against function declarations and expressions inside loop statements
"no-loop-func": 1,

// Disallow new operators with the Function object
"no-new-func": 2,

// Warn against new operators with the String, Number, and Boolean objects
"no-new-wrappers": 1,

// Disallow throwing literals as exceptions
"no-throw-literal": 2,

// Require using Error objects as Promise rejection reasons
"prefer-promise-reject-errors": 2,

// Enforce “for” loop update clause moving the counter in the right direction
"for-direction": 2,

// Enforce return statements in getters
"getter-return": 2,

// Disallow await inside of loops
"no-await-in-loop": 2,

// Disallow comparing against -0
"no-compare-neg-zero": 2,

// Warn against catch clause parameters from shadowing variables in the outer scope
"no-catch-shadow": 1,

// Disallow identifiers from shadowing restricted names
"no-shadow-restricted-names": 2,

// Enforce return statements in callbacks of array methods
"callback-return": 2,

// Require error handling in callbacks
"handle-callback-err": 2,

// Warn against string concatenation with __dirname and __filename
"no-path-concat": 1,

// Prefer using arrow functions for callbacks
"prefer-arrow-callback": 1
}
}
3 changes: 3 additions & 0 deletions functions/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
node_modules/
.runtimeconfig.json
ui-debug.log
8 changes: 8 additions & 0 deletions functions/example.runtimeconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"pusher": {
"appid": "THE APP ID",
"key": "THE KEY",
"cluster": "THE CLUSTER",
"secret": "THE SECRET"
}
}
66 changes: 66 additions & 0 deletions functions/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
const functions = require('firebase-functions');
const express = require('express');
const bodyParser = require('body-parser');

const app = express();
const Pusher = require('pusher');

const pusher = new Pusher({
appId: functions.config().pusher.appid,
key: functions.config().pusher.key,
secret: functions.config().pusher.secret,
cluster: functions.config().pusher.cluster,
useTLS: true,
});

const debug = (...args) => {
console.log('debug::: ', ...args);
};

// Body parser middleware
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({ extended: false }));

// The code below helps to fix any potential CORS issue.
app.use((req, res, next) => {
// Website you wish to allow to connect
res.setHeader('Access-Control-Allow-Origin', '*');
// Request methods you wish to allow
res.setHeader('Access-Control-Allow-Methods', 'GET, POST, OPTIONS, PUT, PATCH, DELETE');
// Request headers you wish to allow
res.setHeader('Access-Control-Allow-Headers', 'X-Requested-With,content-type');
// Set to true if you need the website to include cookies in the requests sent
// to the API (e.g. in case you use sessions)
res.setHeader('Access-Control-Allow-Credentials', true);
// Pass to next layer of middleware
next();
});

// Index API route for the Express app
app.get('/pusher/welcome', (req, res) => {
res.send('Welcome');
});

// API route used by Pusher as a way of authenticating users
app.post('/pusher/auth', (req, res) => {
const socketId = req.body.socket_id;
const channel = req.body.channel_name;
const buzzer = req.body.buzzer_id;
const name = req.body.team_name;
const host = req.body.is_host;
const userId = req.body.user_id;

// Generate a random string and use as presence channel user_id
const presenceData = {
user_id: userId,
user_info: {
is_host: host,
team_name: name,
buzzer_id: buzzer,
},
};
const auth = pusher.authenticate(socketId, channel, presenceData);
res.send(auth);
});

exports.app = functions.https.onRequest(app);
Loading