From 5cb5b04b98624138daf8f21b8a30c165c246b898 Mon Sep 17 00:00:00 2001
From: David
Date: Mon, 13 Oct 2014 14:26:59 -0700
Subject: [PATCH 01/12] Gulpfile.
---
gulpfile.js | 53 +++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 53 insertions(+)
create mode 100644 gulpfile.js
diff --git a/gulpfile.js b/gulpfile.js
new file mode 100644
index 0000000..537726e
--- /dev/null
+++ b/gulpfile.js
@@ -0,0 +1,53 @@
+var gulp = require('gulp'),
+ connect = require('gulp-connect'),
+ open = require('gulp-open'),
+ port = process.env.port || 3001;
+
+gulp.task('open', function(){
+ var options = {
+ url: 'http://localhost:' + port,
+ };
+ gulp.src('./www/index.html')
+ .pipe(open('', options));
+});
+
+gulp.task('connect', function() {
+ connect.server({
+ root: 'www',
+ port: port,
+ livereload: true
+ });
+});
+
+gulp.task('test', function() {
+ connect.server({
+ root: '.',
+ port: port - 1,
+ livereload: true
+ });
+
+ var options = {
+ url: 'http://localhost:' + (port - 1),
+ };
+ gulp.src('./test/index.html')
+ .pipe(open('', options))
+});
+
+gulp.task('js', function () {
+ gulp.src('./www/**/*.js')
+ .pipe(connect.reload());
+});
+
+gulp.task('html', function () {
+ gulp.src('./www/*.html')
+ .pipe(connect.reload());
+});
+
+gulp.task('watch', function() {
+ gulp.watch('www/dist/js/*.js', ['js']);
+ gulp.watch('www/index.html', ['html']);
+});
+
+gulp.task('default', ['connect', 'watch']);
+
+gulp.task('serve', ['connect', 'watch', 'open']);
\ No newline at end of file
From b1e8f5482f5bd0c130b494fba70510a1037c47a0 Mon Sep 17 00:00:00 2001
From: David
Date: Mon, 13 Oct 2014 14:27:17 -0700
Subject: [PATCH 02/12] Updated rules for v2.
---
rules.json | 23 +++++++++++------------
1 file changed, 11 insertions(+), 12 deletions(-)
diff --git a/rules.json b/rules.json
index e56e042..337cdf5 100644
--- a/rules.json
+++ b/rules.json
@@ -6,15 +6,15 @@
// A list of users with their names on the site.
"$userid": {
// Only the user can write their own entry into this list.
- ".write": "$userid == auth.id"
+ ".write": "$userid == auth.id || $userid == auth.uid"
}
},
"users": {
"$userid": {
// The user is allowed to write everything in their bucket.
- ".write": "$userid == auth.id",
+ ".write": "$userid == auth.id || $userid == auth.uid",
"following": {
- // The following list should only contain actual ids from the "people" list.
+ // The following list should only contain actual ids from the "people" list.
"$followingid": {
".validate": "root.child('people').hasChild($followingid)"
}
@@ -22,13 +22,13 @@
"followers": {
// Anyone can add themself to to this user's followers list.
"$followerid": {
- ".write": "$followerid == auth.id"
+ ".write": "$followerid == auth.id || $followerid == auth.uid"
}
},
"feed": {
"$sparkid": {
// User A can write in user B's feed, but only if A is following B, and only for sparks for which they are the author.
- ".write": "root.child('users/' + $userid + '/following').hasChild(auth.id) && root.child('sparks/' + $sparkid + '/author').val() == auth.id"
+ ".write": "(root.child('users/' + $userid + '/following').hasChild(auth.id) && root.child('sparks/' + $sparkid + '/author').val() == auth.id) || (root.child('users/' + $userid + '/following').hasChild(auth.uid) && root.child('sparks/' + $sparkid + '/author').val() == auth.uid)"
}
}
}
@@ -42,7 +42,7 @@
".validate": "newData.hasChildren(['author', 'content'])",
// A user can attribute a spark only to themselves.
"author": {
- ".validate": "newData.val() == auth.id"
+ ".validate": "newData.val() == auth.id || newData.val() == auth.uid"
},
"content": {
".validate": "newData.isString()"
@@ -52,27 +52,26 @@
"recent-users": {
// Users can add themselves to the list of users with recent activity.
"$userid": {
- ".write": "$userid == auth.id"
+ ".write": "$userid == auth.id || $userid == auth.uid"
}
},
"recent-sparks": {
// Authors of sparks can add their sparks to this list.
"$sparkid": {
- ".write": "root.child('sparks/' + $sparkid + '/author').val() == auth.id"
+ ".write": "root.child('sparks/' + $sparkid + '/author').val() == auth.id || root.child('sparks/' + $sparkid + '/author').val() == auth.uid"
}
},
"search": {
"firstName": {
"$searchKey": {
- ".write": "auth != null && (root.child('people/' + auth.id + '/firstName').val() + '|' + root.child('people/' + auth.id + '/lastName').val() + '|' + auth.id) == $searchKey && newData.val() == auth.id"
+ ".write": "auth != null && ((root.child('people/' + auth.id + '/firstName').val() + '|' + root.child('people/' + auth.id + '/lastName').val() + '|' + auth.id) == $searchKey || (root.child('people/' + auth.uid + '/firstName').val() + '|' + root.child('people/' + auth.uid + '/lastName').val() + '|' + auth.uid) == $searchKey) && (newData.val() == auth.id || newData.val() == auth.uid)"
}
},
"lastName": {
"$searchKey": {
- ".write": "auth != null && (root.child('people/' + auth.id + '/lastName').val() + '|' + root.child('people/' + auth.id + '/firstName').val() + '|' + auth.id) == $searchKey && newData.val() == auth.id"
+ ".write": "auth != null && ((root.child('people/' + auth.id + '/lastName').val() + '|' + root.child('people/' + auth.id + '/firstName').val() + '|' + auth.id) == $searchKey || (root.child('people/' + auth.uid + '/lastName').val() + '|' + root.child('people/' + auth.uid + '/firstName').val() + '|' + auth.uid) == $searchKey) && (newData.val() == auth.id || newData.val() == auth.uid)"
}
}
}
}
-}
-
+}
\ No newline at end of file
From 9c1ab14ddcbb1ebd87f263ecc30cc5c11e67b865 Mon Sep 17 00:00:00 2001
From: David
Date: Mon, 13 Oct 2014 14:27:43 -0700
Subject: [PATCH 03/12] Start and build commands.
---
package.json | 28 ++++++++++++++++++++++++++++
1 file changed, 28 insertions(+)
create mode 100644 package.json
diff --git a/package.json b/package.json
new file mode 100644
index 0000000..fb3951b
--- /dev/null
+++ b/package.json
@@ -0,0 +1,28 @@
+{
+ "name": "firefeed",
+ "version": "0.1.0",
+ "description": "Firefeed is a web app that lets users post small messages called sparks to their feed. You can follow other users, and their sparks will appear on your feed.",
+ "main": "gulpfile.js",
+ "directories": {
+ "test": "test"
+ },
+ "scripts": {
+ "start": "gulp serve",
+ "build": "gulp"
+ },
+ "repository": {
+ "type": "git",
+ "url": "https://github.com/firebase/firefeed.git"
+ },
+ "keywords": [
+ "firebase",
+ "twitter clone"
+ ],
+ "author": "Firebase",
+ "license": "MIT",
+ "bugs": {
+ "url": "https://github.com/firebase/firefeed/issues"
+ },
+ "homepage": "https://github.com/firebase/firefeed",
+ "dependencies": {}
+}
From 89f0a34acafd3613999983278516063f166789d1 Mon Sep 17 00:00:00 2001
From: David
Date: Mon, 13 Oct 2014 14:29:38 -0700
Subject: [PATCH 04/12] Updated auth.id to auth.uid. Added bind polyfill.
---
www/index.html | 14 +++----
www/js/firefeed-ui.js | 18 +++++----
www/js/firefeed.js | 80 ++++++++++++++++++++++++---------------
www/libs/bind-polyfill.js | 30 +++++++++++++++
4 files changed, 98 insertions(+), 44 deletions(-)
create mode 100644 www/libs/bind-polyfill.js
diff --git a/www/index.html b/www/index.html
index 6945319..47113ce 100644
--- a/www/index.html
+++ b/www/index.html
@@ -254,7 +254,7 @@ {{fullName}}
{{fullName}}
{{bio}}
- Follow
+ Follow
@@ -272,6 +272,7 @@ {{fullName}}
+
@@ -281,25 +282,24 @@ {{fullName}}
-
-
+
-
-
+
+
+