This file contains hidden or 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
import express from 'express'; | |
import path from 'path'; | |
import bodyParser from 'body-parser'; | |
import routes from './routes'; | |
import cors from 'cors'; | |
const app = express(); | |
const router = express.Router(); | |
const headers1 = 'Origin, X-Requested-With, Content-Type, Accept'; |
This file contains hidden or 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
import { | |
hasAdminRole, | |
decodeFirebaseIdToken, | |
isAuthorized | |
} from '../controllers/middleware/auth.middleware'; | |
const UserRoute = (router) => { | |
// Get all users | |
router.route('/users') | |
.get( |
This file contains hidden or 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
// Import Firebase Admin initialized instance to middleware | |
import firebase from '../../firebase'; | |
const roleRanks = { | |
superAdmin: 1, | |
admin: 2, | |
user: 3 | |
}; | |
export const decodeFirebaseIdToken = async (req, res, next) => { |
This file contains hidden or 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
// import the firebase config into the auth controller | |
import firebase from '../../firebase'; | |
const firebaseAuth = async (req, res) => { | |
try { | |
// req.body the payload coming from the client to authenticate the user | |
// uid is the firebase uid generated when a user is authenticated on the firebase client | |
const userRequest = await firebase.database().ref(`users/${req.body.uid}`).once('value'); | |
const userPayload = userRequest.val(); | |
This file contains hidden or 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
require('dotenv').config(); | |
import firebase from 'firebase-admin'; | |
var serviceAccount = require('./firebase-service-account.json'); | |
export default firebase.initializeApp({ | |
credential: firebase.credential.cert(serviceAccount), | |
databaseURL: process.env.FIREBASE_DATABASE_URL | |
}) |
This file contains hidden or 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
{ | |
"type": "service_account", | |
"project_id": "<project-id>", | |
"private_key_id": "<private-key-id>", | |
"private_key": "<private-key>", | |
"client_email": "<client-email>", | |
"client_id": "<client-id>", | |
"auth_uri": "https://accounts.google.com/o/oauth2/auth", | |
"token_uri": "https://oauth2.googleapis.com/token", | |
"auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs", |
This file contains hidden or 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
<template> | |
<div id="app"> | |
<router-view></router-view> | |
<div class="refresh-container" v-if="hashChanged && $root.env !== 'development'"> | |
<div class="notification-header"> | |
<button type="button" class="close-refresh-modal" @click="closeModal" aria-label="Close"> | |
<span aria-hidden="true"><i class="fal fa-times fa-sm"></i></span> | |
</button> | |
</div> | |
<div class="notification-body"> |
This file contains hidden or 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
import axios from 'axios'; | |
export const refreshPageMixin = { | |
data() { | |
return { | |
currentHash: '{{POST_BUILD_ENTERS_HASH_HERE}}', | |
token: localStorage.getItem('user-token'), | |
hashChanged: false, | |
newHash: '' | |
} |
This file contains hidden or 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
{ | |
"scripts": { | |
"build": "node build/build.js && npm run post:build", | |
"post:build": "node build/post-build.js" | |
}, | |
} |
This file contains hidden or 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
const path = require('path'); | |
const fs = require('fs'); | |
const util = require('util'); | |
// get application version from package.json | |
const appVersion = require('../package.json').version; | |
// promisify core APIs | |
const readDir = util.promisify(fs.readdir); | |
const writeFile = util.promisify(fs.writeFile); |
NewerOlder