Cleaned up the copied project & got the Google authentication working. A lot of work still needs to be done to add content and allow only certain users access.

This commit is contained in:
2022-03-09 07:55:26 -08:00
parent c61ca6b32e
commit 9e0e231152
16 changed files with 257 additions and 448 deletions

View File

@@ -6,24 +6,25 @@
meteor-base@1.5.1 # Packages every Meteor app needs to have meteor-base@1.5.1 # Packages every Meteor app needs to have
mobile-experience@1.1.0 # Packages for a great mobile UX mobile-experience@1.1.0 # Packages for a great mobile UX
mongo@1.13.0 # The database Meteor supports right now mongo@1.14.6 # The database Meteor supports right now
jquery # Wrapper package for npm-installed jquery jquery # Wrapper package for npm-installed jquery
reactive-var@1.0.11 # Reactive variable for tracker reactive-var@1.0.11 # Reactive variable for tracker
tracker@1.2.0 # Meteor's client-side reactive programming library tracker@1.2.0 # Meteor's client-side reactive programming library
standard-minifier-css@1.7.4 # CSS minifier run for production mode standard-minifier-css@1.7.4 # CSS minifier run for production mode
standard-minifier-js@2.7.1 # JS minifier run for production mode standard-minifier-js@2.8.0 # JS minifier run for production mode
es5-shim@4.8.0 # ECMAScript 5 compatibility for older browsers es5-shim@4.8.0 # ECMAScript 5 compatibility for older browsers
ecmascript@0.16.0 # Enable ECMAScript2015+ syntax in app code ecmascript@0.16.1 # Enable ECMAScript2015+ syntax in app code
typescript@4.4.0 # Enable TypeScript syntax in .ts and .tsx modules typescript@4.4.1 # Enable TypeScript syntax in .ts and .tsx modules
shell-server@0.5.0 # Server-side component of the `meteor shell` command shell-server@0.5.0 # Server-side component of the `meteor shell` command
svelte:compiler svelte:compiler
rdb:svelte-meteor-data rdb:svelte-meteor-data
static-html@1.3.2 static-html@1.3.2
accounts-ui@1.4.1 accounts-ui@1.4.2
accounts-password@2.2.0 accounts-password@2.2.0
svelte:blaze-integration svelte:blaze-integration
meteortesting:mocha meteortesting:mocha
accounts-google@1.4.0 accounts-google@1.4.0
service-configuration@1.3.0 service-configuration@1.3.0
google-config-ui

View File

@@ -1 +1 @@
METEOR@2.5 METEOR@2.6.1

View File

@@ -1,12 +1,12 @@
accounts-base@2.2.0 accounts-base@2.2.1
accounts-google@1.4.0 accounts-google@1.4.0
accounts-oauth@1.4.0 accounts-oauth@1.4.0
accounts-password@2.2.0 accounts-password@2.2.0
accounts-ui@1.4.1 accounts-ui@1.4.2
accounts-ui-unstyled@1.6.0 accounts-ui-unstyled@1.6.0
allow-deny@1.1.0 allow-deny@1.1.1
autoupdate@1.8.0 autoupdate@1.8.0
babel-compiler@7.7.0 babel-compiler@7.8.1
babel-runtime@1.5.0 babel-runtime@1.5.0
base64@1.0.12 base64@1.0.12
binary-heap@1.0.11 binary-heap@1.0.11
@@ -24,7 +24,7 @@ ddp-rate-limiter@1.1.0
ddp-server@2.5.0 ddp-server@2.5.0
diff-sequence@1.1.1 diff-sequence@1.1.1
dynamic-import@0.7.2 dynamic-import@0.7.2
ecmascript@0.16.0 ecmascript@0.16.1
ecmascript-runtime@0.8.0 ecmascript-runtime@0.8.0
ecmascript-runtime-client@0.12.1 ecmascript-runtime-client@0.12.1
ecmascript-runtime-server@0.11.0 ecmascript-runtime-server@0.11.0
@@ -33,6 +33,7 @@ email@2.2.0
es5-shim@4.8.0 es5-shim@4.8.0
fetch@0.1.1 fetch@0.1.1
geojson-utils@1.0.10 geojson-utils@1.0.10
google-config-ui@1.0.3
google-oauth@1.4.1 google-oauth@1.4.1
hot-code-push@1.0.4 hot-code-push@1.0.4
html-tools@1.1.2 html-tools@1.1.2
@@ -47,31 +48,31 @@ localstorage@1.2.0
logging@1.3.1 logging@1.3.1
meteor@1.10.0 meteor@1.10.0
meteor-base@1.5.1 meteor-base@1.5.1
meteortesting:browser-tests@1.3.4 meteortesting:browser-tests@1.3.5
meteortesting:mocha@2.0.3 meteortesting:mocha@2.0.3
meteortesting:mocha-core@8.1.2 meteortesting:mocha-core@8.1.2
minifier-css@1.6.0 minifier-css@1.6.0
minifier-js@2.7.2 minifier-js@2.7.3
minimongo@1.7.0 minimongo@1.8.0
mobile-experience@1.1.0 mobile-experience@1.1.0
mobile-status-bar@1.1.0 mobile-status-bar@1.1.0
modern-browsers@0.1.7 modern-browsers@0.1.7
modules@0.17.0 modules@0.18.0
modules-runtime@0.12.0 modules-runtime@0.12.0
mongo@1.13.0 mongo@1.14.6
mongo-decimal@0.1.2 mongo-decimal@0.1.2
mongo-dev-server@1.1.0 mongo-dev-server@1.1.0
mongo-id@1.0.8 mongo-id@1.0.8
npm-mongo@3.9.1 npm-mongo@4.3.1
oauth@2.1.0 oauth@2.1.1
oauth2@1.3.1 oauth2@1.3.1
observe-sequence@1.0.19 observe-sequence@1.0.19
ordered-dict@1.1.0 ordered-dict@1.1.0
promise@0.12.0 promise@0.12.0
random@1.2.0 random@1.2.0
rate-limit@1.0.9 rate-limit@1.0.9
rdb:svelte-meteor-data@0.3.0 rdb:svelte-meteor-data@0.3.1
react-fast-refresh@0.2.0 react-fast-refresh@0.2.2
reactive-dict@1.3.0 reactive-dict@1.3.0
reactive-var@1.0.11 reactive-var@1.0.11
reload@1.3.1 reload@1.3.1
@@ -85,17 +86,17 @@ socket-stream-client@0.4.0
spacebars@1.2.0 spacebars@1.2.0
spacebars-compiler@1.3.0 spacebars-compiler@1.3.0
standard-minifier-css@1.7.4 standard-minifier-css@1.7.4
standard-minifier-js@2.7.2 standard-minifier-js@2.8.0
static-html@1.3.2 static-html@1.3.2
svelte:blaze-integration@0.4.0 svelte:blaze-integration@0.4.0
svelte:compiler@3.31.2 svelte:compiler@3.46.4
templating@1.4.1 templating@1.4.1
templating-compiler@1.4.1 templating-compiler@1.4.1
templating-runtime@1.5.0 templating-runtime@1.5.0
templating-tools@1.2.1 templating-tools@1.2.1
tracker@1.2.0 tracker@1.2.0
typescript@4.4.0 typescript@4.4.1
underscore@1.0.10 underscore@1.0.10
url@1.3.2 url@1.3.2
webapp@1.13.0 webapp@1.13.1
webapp-hashing@1.1.0 webapp-hashing@1.1.0

View File

@@ -1,5 +1,5 @@
<head> <head>
<title>Todo List</title> <title>District Central</title>
</head> </head>
<body> <body>

View File

@@ -1,127 +1,9 @@
import {Meteor} from 'meteor/meteor'; import {Meteor} from 'meteor/meteor';
import App from '../imports/ui/App.svelte'; import App from '../imports/ui/App.svelte';
import '../imports/startup/accounts-config.js'; import '../imports/startup/accounts-config.js';
import Phaser from 'phaser';
Meteor.startup(() => { Meteor.startup(() => {
new App({ new App({
target: document.getElementById('app') target: document.getElementById('app')
}); });
class playGame extends Phaser.Scene {
constructor() {
super("PlayGame");
}
create() {
// graphic object used to draw walls
this.wallGraphics = this.add.graphics();
this.wallGraphics.lineStyle(1, 0x00ff00);
// graphic object used to draw rays of light
this.lightGraphics = this.add.graphics();
// array with all polygons in game
this.polygons = [];
// add random boxes
for(let i = 0; i < gameOptions.boxes; i ++){
this.addRandomBox();
}
// walls around game perimeter
this.polygons.push([[-1, -1], [game.config.width + 1, -1], [game.config.width + 1, game.config.height+1], [-1, game.config.height + 1]]);
// listener for input movement
this.input.on("pointermove", this.renderLight, this);
}
addRandomBox() {
// use a do...while statement because there can't be intersecting polygons
do {
// random x and y coordinates, width and height
var startX = Phaser.Math.Between(10, game.config.width - 10 - gameOptions.sizeRange.max);
var startY = Phaser.Math.Between(10, game.config.height - 10 - gameOptions.sizeRange.max);
var width = Phaser.Math.Between(gameOptions.sizeRange.min, gameOptions.sizeRange.max);
var height = Phaser.Math.Between(gameOptions.sizeRange.min, gameOptions.sizeRange.max);
// check if current box intersects other boxes
} while(this.boxesIntersect(startX, startY, width, height));
// draw the box
this.wallGraphics.strokeRect(startX, startY, width, height);
// insert box vertices into polygons array
this.polygons.push([[startX, startY], [startX + width, startY], [startX + width, startY + height], [startX, startY + height]]);
}
// method to check if the box intersects other boxes
boxesIntersect(x, y, w, h) {
// loop through existing boxes
for(let i = 0; i < this.polygons.length; i ++) {
// if the box intersects the existing i-th box...
if(x < this.polygons[i][1][0] && x + w > this.polygons[i][0][0] && y < this.polygons[i][3][1] && y + h > this.polygons[i][0][1]){
// return true
return true;
}
}
// if we reach the end of the loop, return false
return false;
}
// method to render the light
renderLight(pointer) {
// determine light polygon starting from pointer coordinates
let visibility = this.createLightPolygon(pointer.x, pointer.y);
// clear and prepare lightGraphics graphic object
this.lightGraphics.clear();
this.lightGraphics.lineStyle(2, 0xff8800);
this.lightGraphics.fillStyle(0xffff00);
// begin a drawing path
this.lightGraphics.beginPath();
// move the graphic pen to first vertex of light polygon
this.lightGraphics.moveTo(visibility[0][0], visibility[0][1]);
// loop through all light polygon vertices
for(let i = 1; i <= visibility.length; i ++) {
// draw a line to i-th light polygon vertex
this.lightGraphics.lineTo(visibility[i % visibility.length][0], visibility[ i %visibility.length][1]);
}
// close, stroke and fill light polygon
this.lightGraphics.closePath();
this.lightGraphics.fillPath();
this.lightGraphics.strokePath();
}
// method to create light polygon using visibility_polygon.js
createLightPolygon(x, y) {
let segments = VisibilityPolygon.convertToSegments(this.polygons);
segments = VisibilityPolygon.breakIntersections(segments);
let position = [x, y];
if (VisibilityPolygon.inPolygon(position, this.polygons[this.polygons.length - 1])) {
return VisibilityPolygon.compute(position, segments);
}
return null;
}
}
let config = {
type: Phaser.AUTO,
parent: "game",
width: "100%",
height: "100%",
physics: {
default: 'arcade',
arcade: {
gravity: {y: 200}
}
},
scene: {
scene: playGame
}
};
let game = new Phaser.Game(config);
}); });

View File

@@ -1,2 +1,2 @@
import "./tasks.js"; import "./records.js";
import "./users.js"; import "./users.js";

40
imports/api/records.js Normal file
View File

@@ -0,0 +1,40 @@
import { Meteor } from 'meteor/meteor';
import { Mongo } from 'meteor/mongo';
import { check } from 'meteor/check';
export const Records = new Mongo.Collection('records');
if (Meteor.isServer) {
// This code only runs on the server
Meteor.publish('records', function() {
return Records.find({});
});
}
Meteor.methods({
// 'tasks.setChecked'(taskId, setChecked) {
// check(taskId, String);
// check(setChecked, Boolean);
//
// const task = Tasks.findOne(taskId);
// if (task.private && task.owner !== this.userId) {
// // If the task is private, make sure only the owner can check it off
// throw new Meteor.Error('not-authorized');
// }
//
// Tasks.update(taskId, { $set: { checked: setChecked } });
// },
// 'tasks.setPrivate'(taskId, setToPrivate) {
// check(taskId, String);
// check(setToPrivate, Boolean);
//
// const task = Tasks.findOne(taskId);
//
// // Make sure only the task owner can make a task private
// if (task.owner !== this.userId) {
// throw new Meteor.Error('not-authorized');
// }
//
// Tasks.update(taskId, { $set: { private: setToPrivate } });
// },
});

View File

@@ -1,71 +0,0 @@
import { Meteor } from 'meteor/meteor';
import { Mongo } from 'meteor/mongo';
import { check } from 'meteor/check';
export const Tasks = new Mongo.Collection('tasks');
if (Meteor.isServer) {
// This code only runs on the server
Meteor.publish('tasks', function tasksPublication() {
return Tasks.find({
$or: [
{ private: { $ne: true } },
{ owner: this.userId },
],
});
});
}
Meteor.methods({
'tasks.insert'(text) {
check(text, String);
// Make sure the user is logged in before inserting a task
if (!this.userId) {
throw new Meteor.Error('not-authorized');
}
Tasks.insert({
text,
createdAt: new Date(),
owner: this.userId,
username: Meteor.users.findOne(this.userId).username,
});
},
'tasks.remove'(taskId) {
check(taskId, String);
const task = Tasks.findOne(taskId);
if (task.private && task.owner !== this.userId) {
// If the task is private, make sure only the owner can delete it
throw new Meteor.Error('not-authorized');
}
Tasks.remove(taskId);
},
'tasks.setChecked'(taskId, setChecked) {
check(taskId, String);
check(setChecked, Boolean);
const task = Tasks.findOne(taskId);
if (task.private && task.owner !== this.userId) {
// If the task is private, make sure only the owner can check it off
throw new Meteor.Error('not-authorized');
}
Tasks.update(taskId, { $set: { checked: setChecked } });
},
'tasks.setPrivate'(taskId, setToPrivate) {
check(taskId, String);
check(setToPrivate, Boolean);
const task = Tasks.findOne(taskId);
// Make sure only the task owner can make a task private
if (task.owner !== this.userId) {
throw new Meteor.Error('not-authorized');
}
Tasks.update(taskId, { $set: { private: setToPrivate } });
},
});

View File

@@ -1,41 +0,0 @@
/* eslint-env mocha */
import { Meteor } from 'meteor/meteor';
import { Random } from 'meteor/random';
import { assert } from 'chai';
import { Tasks } from './tasks.js';
if (Meteor.isServer) {
describe('Tasks', () => {
describe('methods', () => {
const userId = Random.id();
let taskId;
beforeEach(() => {
Tasks.remove({});
taskId = Tasks.insert({
text: 'test task',
createdAt: new Date(),
owner: userId,
username: 'tmeasday',
});
});
it('can delete owned task', () => {
// Find the internal implementation of the task method so we can
// test it in isolation
const deleteTask = Meteor.server.method_handlers['tasks.remove'];
// Set up a fake method invocation that looks like what the method expects
const invocation = { userId };
// Run the method with `this` set to the fake invocation
deleteTask.apply(invocation, [taskId]);
// Verify that the method does what we expected
assert.equal(Tasks.find().count(), 0);
});
});
});
}

View File

@@ -1,5 +1,11 @@
import { Accounts } from 'meteor/accounts-base'; import { Accounts } from 'meteor/accounts-base'
Accounts.ui.config({ Accounts.ui.config({
passwordSignupFields: 'USERNAME_ONLY' passwordSignupFields: 'USERNAME_ONLY'
}); });
Accounts.config({
restrictCreationByEmailDomain: function(address) {
return new RegExp('.*@avpanthers.org$', 'i').test(address)
}
});

View File

@@ -3,51 +3,41 @@
import {onMount} from 'svelte'; import {onMount} from 'svelte';
import {useTracker} from 'meteor/rdb:svelte-meteor-data'; import {useTracker} from 'meteor/rdb:svelte-meteor-data';
import {BlazeTemplate} from 'meteor/svelte:blaze-integration'; import {BlazeTemplate} from 'meteor/svelte:blaze-integration';
import Task from './Task.svelte'; import {Records} from '../api/records.js'
import {Tasks} from '../api/tasks.js' import ServiceConfiguration from "meteor/service-configuration";
let newTask = "";
let hideCompleted = false;
let tasks;
let currentUser; let currentUser;
onMount(async () => { onMount(async () => {
Meteor.subscribe('tasks'); // Meteor.subscribe('records');
}); });
$: incompleteCount = useTracker(() => Tasks.find({checked: {$ne: true}}).count()); // $: incompleteCount = useTracker(() => Tasks.find({checked: {$ne: true}}).count());
$: currentUser = useTracker(() => Meteor.user()); $: currentUser = useTracker(() => Meteor.user());
const taskStore = Tasks.find({}, {sort: {createdAt: -1}}); // const taskStore = Tasks.find({}, {sort: {createdAt: -1}});
$: { // $: {
tasks = $taskStore; // tasks = $taskStore;
if (hideCompleted) { // if (hideCompleted) {
tasks = tasks.filter(task => !task.checked); // tasks = tasks.filter(task => !task.checked);
} // }
} // }
function handleSubmit(event) { // function handleSubmit(event) {
Meteor.call("tasks.insert", newTask); // Meteor.call("tasks.insert", newTask);
// Clear form // // Clear form
newTask = ""; // newTask = "";
} // }
function performLogin() { function performLogin() {
//console.log("In Perform Login"); //Login style can be "popup" or "redirect". I am not sure we need to request and offline token.
//Meteor.call("users.login"); Meteor.loginWithGoogle({loginStyle: "popup", requestOfflineToken: true}, (err) => {
let config = ServiceConfiguration.configurations.findOne({service: 'google'});
console.log(config);
let scope = config.scope;
let loginStyle = "popup";
Meteor.loginWithGoogle({requestPermissions: scope, loginStyle, requestOfflineToken: true}, (err) => {
if(err) { if(err) {
console.log(err); console.log(err);
} }
else { else {
console.log("Logged in"); //console.log("Logged in");
} }
}) })
} }
@@ -59,42 +49,39 @@
<div class="container"> <div class="container">
<header> <header>
<h1>Todo List ({ $incompleteCount })</h1> <!-- <h1>Todo List ({ $incompleteCount })</h1>-->
<label className="hide-completed"> <!-- <label className="hide-completed">-->
<input <!-- <input-->
type="checkbox" <!-- type="checkbox"-->
bind:checked={hideCompleted} <!-- bind:checked={hideCompleted}-->
/> <!-- />-->
Hide Completed Tasks <!-- Hide Completed Tasks-->
</label> <!-- </label>-->
<BlazeTemplate template="loginButtons"/> <!-- <BlazeTemplate template="loginButtons"/>-->
{#if !$currentUser} {#if !$currentUser}
<button type="button" on:click={performLogin}>Login</button> <button type="button" on:click={performLogin}>Login</button>
{:else} {:else}
<button type="button" on:click={performLogout}>Logout</button> <button type="button" on:click={performLogout}>Logout</button>
{/if} {/if}
{#if $currentUser} <!--{#if $currentUser}-->
<form class="new-task" on:submit|preventDefault={handleSubmit}> <!-- <form class="new-task" on:submit|preventDefault={handleSubmit}>-->
<input <!-- <input-->
type="text" <!-- type="text"-->
placeholder="Type to add new tasks" <!-- placeholder="Type to add new tasks"-->
bind:value={newTask} <!-- bind:value={newTask}-->
/> <!-- />-->
</form> <!-- </form>-->
{/if} <!--{/if}-->
</header> </header>
<ul> <ul>
{#each tasks as task} <!--{#each tasks as task}-->
<Task <!-- <Task-->
key={task._id} <!-- key={task._id}-->
task={task} <!-- task={task}-->
/> <!-- />-->
{/each} <!--{/each}-->
</ul> </ul>
<div id="game" style="height: 400px; width: 400px">
</div>
</div> </div>

176
package-lock.json generated
View File

@@ -6,23 +6,26 @@
"": { "": {
"name": "DistrictCentral", "name": "DistrictCentral",
"dependencies": { "dependencies": {
"@babel/runtime": "^7.8.3", "@babel/runtime": "^7.16.7",
"connect-route": "^0.1.5", "connect-route": "^0.1.5",
"jquery": "^3.4.1", "jquery": "^3.6.0",
"meteor-node-stubs": "^1.0.0", "meteor-node-stubs": "^1.0.0",
"phaser": "3.55.2", "svelte": "^3.46.4",
"svelte": "^3.31.2" "ws": "^8.4.2"
}, },
"devDependencies": { "devDependencies": {
"chai": "^4.2.0" "chai": "^4.2.0"
} }
}, },
"node_modules/@babel/runtime": { "node_modules/@babel/runtime": {
"version": "7.9.2", "version": "7.16.7",
"resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.9.2.tgz", "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.16.7.tgz",
"integrity": "sha512-NE2DtOdufG7R5vnfQUTehdTfNycfUANEtCa9PssN9O/xmTzP4E08UI797ixaei6hBEVL9BI/PsdJS5x7mWoB9Q==", "integrity": "sha512-9E9FJowqAsytyOY6LG+1KuueckRL+aQW+mKvXRXnuFGyRAyepJPmEo9vgMfXUA6O9u3IeEdv9MAkppFcaQwogQ==",
"dependencies": { "dependencies": {
"regenerator-runtime": "^0.13.4" "regenerator-runtime": "^0.13.4"
},
"engines": {
"node": ">=6.9.0"
} }
}, },
"node_modules/assertion-error": { "node_modules/assertion-error": {
@@ -80,11 +83,6 @@
"node": ">=0.12" "node": ">=0.12"
} }
}, },
"node_modules/eventemitter3": {
"version": "4.0.7",
"resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-4.0.7.tgz",
"integrity": "sha512-8guHBZCwKnFhYdHr2ysuRWErTwhoN2X8XELRlrRwpmfeY2jjuUN4taQMsULKUVo1K4DvZl+0pgfyoysHxvmvEw=="
},
"node_modules/get-func-name": { "node_modules/get-func-name": {
"version": "2.0.0", "version": "2.0.0",
"resolved": "https://registry.npmjs.org/get-func-name/-/get-func-name-2.0.0.tgz", "resolved": "https://registry.npmjs.org/get-func-name/-/get-func-name-2.0.0.tgz",
@@ -94,15 +92,10 @@
"node": "*" "node": "*"
} }
}, },
"node_modules/inherits": {
"version": "2.0.3",
"resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz",
"integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4="
},
"node_modules/jquery": { "node_modules/jquery": {
"version": "3.4.1", "version": "3.6.0",
"resolved": "https://registry.npmjs.org/jquery/-/jquery-3.4.1.tgz", "resolved": "https://registry.npmjs.org/jquery/-/jquery-3.6.0.tgz",
"integrity": "sha512-36+AdBzCL+y6qjw5Tx7HgzeGCzC81MDDgaUP8ld2zhx58HdqXGoBd+tHdrBMiyjGQs0Hxs/MLZTu/eHNJJuWPw==" "integrity": "sha512-JVzAR/AjBvVt2BmYhxRCSYysDsPcssdmTFnzyLEts9qNwmjmu4JTAMYubEfwVOSwpQ1I1sKKFcxhZCI2buerfw=="
}, },
"node_modules/meteor-node-stubs": { "node_modules/meteor-node-stubs": {
"version": "1.0.0", "version": "1.0.0",
@@ -788,50 +781,24 @@
"node": ">=0.4" "node": ">=0.4"
} }
}, },
"node_modules/path": {
"version": "0.12.7",
"resolved": "https://registry.npmjs.org/path/-/path-0.12.7.tgz",
"integrity": "sha1-1NwqUGxM4hl+tIHr/NWzbAFAsQ8=",
"dependencies": {
"process": "^0.11.1",
"util": "^0.10.3"
}
},
"node_modules/pathval": { "node_modules/pathval": {
"version": "1.1.0", "version": "1.1.1",
"resolved": "https://registry.npmjs.org/pathval/-/pathval-1.1.0.tgz", "resolved": "https://registry.npmjs.org/pathval/-/pathval-1.1.1.tgz",
"integrity": "sha1-uULm1L3mUwBe9rcTYd74cn0GReA=", "integrity": "sha512-Dp6zGqpTdETdR63lehJYPeIOqpiNBNtc7BpWSLrOje7UaIsE5aY92r/AunQA7rsXvet3lrJ3JnZX29UPTKXyKQ==",
"dev": true, "dev": true,
"engines": { "engines": {
"node": "*" "node": "*"
} }
}, },
"node_modules/phaser": {
"version": "3.55.2",
"resolved": "https://registry.npmjs.org/phaser/-/phaser-3.55.2.tgz",
"integrity": "sha512-amKXsbb2Ht29dGPKvt1edq3yGGYKtq8373GpJYGKPNPnneYY6MtVTOgjHDuZwtmUyK4v86FugkT3hzW/N4tjxQ==",
"dependencies": {
"eventemitter3": "^4.0.7",
"path": "^0.12.7"
}
},
"node_modules/process": {
"version": "0.11.10",
"resolved": "https://registry.npmjs.org/process/-/process-0.11.10.tgz",
"integrity": "sha1-czIwDoQBYb2j5podHZGn1LwW8YI=",
"engines": {
"node": ">= 0.6.0"
}
},
"node_modules/regenerator-runtime": { "node_modules/regenerator-runtime": {
"version": "0.13.5", "version": "0.13.9",
"resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.13.5.tgz", "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.13.9.tgz",
"integrity": "sha512-ZS5w8CpKFinUzOwW3c83oPeVXoNsrLsaCoLtJvAClH135j/R77RuymhiSErhm2lKcwSCIpmvIWSbDkIfAqKQlA==" "integrity": "sha512-p3VT+cOEgxFsRRA9X4lkI1E+k2/CtnKtU4gcxyaCUreilL/vqI6CdZ3wxVUx3UOUg+gnUOQQcRI7BmSI656MYA=="
}, },
"node_modules/svelte": { "node_modules/svelte": {
"version": "3.38.2", "version": "3.46.4",
"resolved": "https://registry.npmjs.org/svelte/-/svelte-3.38.2.tgz", "resolved": "https://registry.npmjs.org/svelte/-/svelte-3.46.4.tgz",
"integrity": "sha512-q5Dq0/QHh4BLJyEVWGe7Cej5NWs040LWjMbicBGZ+3qpFWJ1YObRmUDZKbbovddLC9WW7THTj3kYbTOFmU9fbg==", "integrity": "sha512-qKJzw6DpA33CIa+C/rGp4AUdSfii0DOTCzj/2YpSKKayw5WGSS624Et9L1nU1k2OVRS9vaENQXp2CVZNU+xvIg==",
"engines": { "engines": {
"node": ">= 8" "node": ">= 8"
} }
@@ -845,20 +812,32 @@
"node": ">=4" "node": ">=4"
} }
}, },
"node_modules/util": { "node_modules/ws": {
"version": "0.10.4", "version": "8.4.2",
"resolved": "https://registry.npmjs.org/util/-/util-0.10.4.tgz", "resolved": "https://registry.npmjs.org/ws/-/ws-8.4.2.tgz",
"integrity": "sha512-0Pm9hTQ3se5ll1XihRic3FDIku70C+iHUdT/W926rSgHV5QgXsYbKZN8MSC3tJtSkhuROzvsQjAaFENRXr+19A==", "integrity": "sha512-Kbk4Nxyq7/ZWqr/tarI9yIt/+iNNFOjBXEWgTb4ydaNHBNGgvf2QHbS9fdfsndfjFlFwEd4Al+mw83YkaD10ZA==",
"dependencies": { "engines": {
"inherits": "2.0.3" "node": ">=10.0.0"
},
"peerDependencies": {
"bufferutil": "^4.0.1",
"utf-8-validate": "^5.0.2"
},
"peerDependenciesMeta": {
"bufferutil": {
"optional": true
},
"utf-8-validate": {
"optional": true
}
} }
} }
}, },
"dependencies": { "dependencies": {
"@babel/runtime": { "@babel/runtime": {
"version": "7.9.2", "version": "7.16.7",
"resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.9.2.tgz", "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.16.7.tgz",
"integrity": "sha512-NE2DtOdufG7R5vnfQUTehdTfNycfUANEtCa9PssN9O/xmTzP4E08UI797ixaei6hBEVL9BI/PsdJS5x7mWoB9Q==", "integrity": "sha512-9E9FJowqAsytyOY6LG+1KuueckRL+aQW+mKvXRXnuFGyRAyepJPmEo9vgMfXUA6O9u3IeEdv9MAkppFcaQwogQ==",
"requires": { "requires": {
"regenerator-runtime": "^0.13.4" "regenerator-runtime": "^0.13.4"
} }
@@ -903,26 +882,16 @@
"type-detect": "^4.0.0" "type-detect": "^4.0.0"
} }
}, },
"eventemitter3": {
"version": "4.0.7",
"resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-4.0.7.tgz",
"integrity": "sha512-8guHBZCwKnFhYdHr2ysuRWErTwhoN2X8XELRlrRwpmfeY2jjuUN4taQMsULKUVo1K4DvZl+0pgfyoysHxvmvEw=="
},
"get-func-name": { "get-func-name": {
"version": "2.0.0", "version": "2.0.0",
"resolved": "https://registry.npmjs.org/get-func-name/-/get-func-name-2.0.0.tgz", "resolved": "https://registry.npmjs.org/get-func-name/-/get-func-name-2.0.0.tgz",
"integrity": "sha1-6td0q+5y4gQJQzoGY2YCPdaIekE=", "integrity": "sha1-6td0q+5y4gQJQzoGY2YCPdaIekE=",
"dev": true "dev": true
}, },
"inherits": {
"version": "2.0.3",
"resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz",
"integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4="
},
"jquery": { "jquery": {
"version": "3.4.1", "version": "3.6.0",
"resolved": "https://registry.npmjs.org/jquery/-/jquery-3.4.1.tgz", "resolved": "https://registry.npmjs.org/jquery/-/jquery-3.6.0.tgz",
"integrity": "sha512-36+AdBzCL+y6qjw5Tx7HgzeGCzC81MDDgaUP8ld2zhx58HdqXGoBd+tHdrBMiyjGQs0Hxs/MLZTu/eHNJJuWPw==" "integrity": "sha512-JVzAR/AjBvVt2BmYhxRCSYysDsPcssdmTFnzyLEts9qNwmjmu4JTAMYubEfwVOSwpQ1I1sKKFcxhZCI2buerfw=="
}, },
"meteor-node-stubs": { "meteor-node-stubs": {
"version": "1.0.0", "version": "1.0.0",
@@ -1485,44 +1454,21 @@
} }
} }
}, },
"path": {
"version": "0.12.7",
"resolved": "https://registry.npmjs.org/path/-/path-0.12.7.tgz",
"integrity": "sha1-1NwqUGxM4hl+tIHr/NWzbAFAsQ8=",
"requires": {
"process": "^0.11.1",
"util": "^0.10.3"
}
},
"pathval": { "pathval": {
"version": "1.1.0", "version": "1.1.1",
"resolved": "https://registry.npmjs.org/pathval/-/pathval-1.1.0.tgz", "resolved": "https://registry.npmjs.org/pathval/-/pathval-1.1.1.tgz",
"integrity": "sha1-uULm1L3mUwBe9rcTYd74cn0GReA=", "integrity": "sha512-Dp6zGqpTdETdR63lehJYPeIOqpiNBNtc7BpWSLrOje7UaIsE5aY92r/AunQA7rsXvet3lrJ3JnZX29UPTKXyKQ==",
"dev": true "dev": true
}, },
"phaser": {
"version": "3.55.2",
"resolved": "https://registry.npmjs.org/phaser/-/phaser-3.55.2.tgz",
"integrity": "sha512-amKXsbb2Ht29dGPKvt1edq3yGGYKtq8373GpJYGKPNPnneYY6MtVTOgjHDuZwtmUyK4v86FugkT3hzW/N4tjxQ==",
"requires": {
"eventemitter3": "^4.0.7",
"path": "^0.12.7"
}
},
"process": {
"version": "0.11.10",
"resolved": "https://registry.npmjs.org/process/-/process-0.11.10.tgz",
"integrity": "sha1-czIwDoQBYb2j5podHZGn1LwW8YI="
},
"regenerator-runtime": { "regenerator-runtime": {
"version": "0.13.5", "version": "0.13.9",
"resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.13.5.tgz", "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.13.9.tgz",
"integrity": "sha512-ZS5w8CpKFinUzOwW3c83oPeVXoNsrLsaCoLtJvAClH135j/R77RuymhiSErhm2lKcwSCIpmvIWSbDkIfAqKQlA==" "integrity": "sha512-p3VT+cOEgxFsRRA9X4lkI1E+k2/CtnKtU4gcxyaCUreilL/vqI6CdZ3wxVUx3UOUg+gnUOQQcRI7BmSI656MYA=="
}, },
"svelte": { "svelte": {
"version": "3.38.2", "version": "3.46.4",
"resolved": "https://registry.npmjs.org/svelte/-/svelte-3.38.2.tgz", "resolved": "https://registry.npmjs.org/svelte/-/svelte-3.46.4.tgz",
"integrity": "sha512-q5Dq0/QHh4BLJyEVWGe7Cej5NWs040LWjMbicBGZ+3qpFWJ1YObRmUDZKbbovddLC9WW7THTj3kYbTOFmU9fbg==" "integrity": "sha512-qKJzw6DpA33CIa+C/rGp4AUdSfii0DOTCzj/2YpSKKayw5WGSS624Et9L1nU1k2OVRS9vaENQXp2CVZNU+xvIg=="
}, },
"type-detect": { "type-detect": {
"version": "4.0.8", "version": "4.0.8",
@@ -1530,13 +1476,11 @@
"integrity": "sha512-0fr/mIH1dlO+x7TlcMy+bIDqKPsw/70tVyeHW787goQjhmqaZe10uwLujubK9q9Lg6Fiho1KUKDYz0Z7k7g5/g==", "integrity": "sha512-0fr/mIH1dlO+x7TlcMy+bIDqKPsw/70tVyeHW787goQjhmqaZe10uwLujubK9q9Lg6Fiho1KUKDYz0Z7k7g5/g==",
"dev": true "dev": true
}, },
"util": { "ws": {
"version": "0.10.4", "version": "8.4.2",
"resolved": "https://registry.npmjs.org/util/-/util-0.10.4.tgz", "resolved": "https://registry.npmjs.org/ws/-/ws-8.4.2.tgz",
"integrity": "sha512-0Pm9hTQ3se5ll1XihRic3FDIku70C+iHUdT/W926rSgHV5QgXsYbKZN8MSC3tJtSkhuROzvsQjAaFENRXr+19A==", "integrity": "sha512-Kbk4Nxyq7/ZWqr/tarI9yIt/+iNNFOjBXEWgTb4ydaNHBNGgvf2QHbS9fdfsndfjFlFwEd4Al+mw83YkaD10ZA==",
"requires": { "requires": {}
"inherits": "2.0.3"
}
} }
} }
} }

View File

@@ -9,12 +9,12 @@
"visualize": "meteor --production --extra-packages bundle-visualizer" "visualize": "meteor --production --extra-packages bundle-visualizer"
}, },
"dependencies": { "dependencies": {
"@babel/runtime": "^7.8.3", "@babel/runtime": "^7.16.7",
"connect-route": "^0.1.5", "connect-route": "^0.1.5",
"jquery": "^3.4.1", "jquery": "^3.6.0",
"meteor-node-stubs": "^1.0.0", "meteor-node-stubs": "^1.0.0",
"phaser": "3.55.2", "svelte": "^3.46.4",
"svelte": "^3.31.2" "ws": "^8.4.2"
}, },
"meteor": { "meteor": {
"mainModule": { "mainModule": {

10
readme.md Normal file
View File

@@ -0,0 +1,10 @@
#Login
##Google
This app is using the Google (oauth2) API to manage logins. To do that you have to have a service configuration in the database. Place the following in the XXX collection:
```
{
service: 'google',
clientId: 'xxx',
secret: 'xxx'
}
```

View File

@@ -5,8 +5,18 @@
*/ */
try { try {
let settingsFile = process.env.SETTINGS; let settings = Assets.getText('settings.json');
let settings = JSON.parse(Assets.getText(settingsFile));
if(settings) {
try {
settings = JSON.parse(settings);
}
catch(err) {
console.error("Failed to load the /private/settings.json file as a JSON object.");
console.error(err);
settings = null;
}
}
if (settings) { if (settings) {
ServiceConfiguration.configurations.upsert({ ServiceConfiguration.configurations.upsert({
@@ -25,3 +35,16 @@ try {
} catch (err) { } catch (err) {
console.log(err); console.log(err);
} }
/*
ServiceConfiguration.configurations.upsert(
{ service: 'google' },
{
$set: {
clientId: '651343079360-hm5vvji109lphnavft8vej5pp1ruek5q.apps.googleusercontent.com',
loginStyle: 'popup',
secret: 'VAQFr6UBkZ0ZMQJ7tb471BmW'
}
}
);
*/

View File

@@ -1,12 +1,39 @@
import '../imports/api/'; import '../imports/api/';
import './google-oauth.js'; import './google-oauth.js';
import url from 'url';
//import './google-oauth.js';
import connectRoute from 'connect-route'; import connectRoute from 'connect-route';
// Got the below code from: /* Did not work at all.. not sure why.
// https://docs.meteor.com/packages/webapp.html let WebSocketServer = require("ws").Server;
WebApp.connectHandlers.use(connectRoute((router) => { //var wss = new WebSocketServer({ port: env.PORT });
router.get('/ping', (req, res, next) => { let wss = new WebSocketServer({host: '192.168.3.101', port: 3001});
//TODO: Change ping / pong to something appropriate for a browser plugin reporting user/machine data and requesting updates.
res.end("pong"); console.log("Starting WS");
});
})); wss.on("connection", function (ws) {
console.log("WS Open");
ws.on("message", function(data) {
console.log(data);
ws.send("Pong");
}).on("error", (err) => {
console.log(err);
})
}).on('error', (err) => {
console.error(err);
});
// const net = require('net');
//
// const server = net.createServer((socket) => {
// socket.on('data', (data) => {
// console.log(data.toString());
// socket.write("Pong");
// });
// }).on('error', (err) => {
// console.error(err);
// });
*/