From 1ee74d1b2b2f7fbd7a5a40190219a567935c46b6 Mon Sep 17 00:00:00 2001
From: wu nan yi <37365331+iambite@users.noreply.github.com>
Date: Mon, 19 Mar 2018 05:03:05 +0800
Subject: [PATCH 01/14] Set theme jekyll-theme-cayman
---
_config.yml | 1 +
1 file changed, 1 insertion(+)
create mode 100644 _config.yml
diff --git a/_config.yml b/_config.yml
new file mode 100644
index 0000000..c419263
--- /dev/null
+++ b/_config.yml
@@ -0,0 +1 @@
+theme: jekyll-theme-cayman
\ No newline at end of file
From 6d05b6e169d0b1dfb9ba7cf99f8edb0eafb3d912 Mon Sep 17 00:00:00 2001
From: wu nan yi <37365331+iambite@users.noreply.github.com>
Date: Mon, 19 Mar 2018 05:36:38 +0800
Subject: [PATCH 02/14] system.config.js
---
public/app/system.config.js | 1 +
1 file changed, 1 insertion(+)
create mode 100644 public/app/system.config.js
diff --git a/public/app/system.config.js b/public/app/system.config.js
new file mode 100644
index 0000000..8b13789
--- /dev/null
+++ b/public/app/system.config.js
@@ -0,0 +1 @@
+
From 1f084c537037f8d1d1e8cef68bc2e1d301851d3a Mon Sep 17 00:00:00 2001
From: wu nan yi <37365331+iambite@users.noreply.github.com>
Date: Mon, 19 Mar 2018 05:37:24 +0800
Subject: [PATCH 03/14] index.css
---
.../\346\207\211\347\224\250\347\250\213\345\272\217/index.css" | 1 +
1 file changed, 1 insertion(+)
create mode 100644 "\345\205\254\345\205\261/\346\207\211\347\224\250\347\250\213\345\272\217/index.css"
diff --git "a/\345\205\254\345\205\261/\346\207\211\347\224\250\347\250\213\345\272\217/index.css" "b/\345\205\254\345\205\261/\346\207\211\347\224\250\347\250\213\345\272\217/index.css"
new file mode 100644
index 0000000..8b13789
--- /dev/null
+++ "b/\345\205\254\345\205\261/\346\207\211\347\224\250\347\250\213\345\272\217/index.css"
@@ -0,0 +1 @@
+
From 08d407d391c408f0e7d2d92e6d5aa9021a5b6e73 Mon Sep 17 00:00:00 2001
From: wu nan yi <37365331+iambite@users.noreply.github.com>
Date: Mon, 19 Mar 2018 05:37:49 +0800
Subject: [PATCH 04/14] index.html
---
.../\346\207\211\347\224\250\347\250\213\345\272\217/index.html" | 1 +
1 file changed, 1 insertion(+)
create mode 100644 "\345\205\254\345\205\261/\346\207\211\347\224\250\347\250\213\345\272\217/index.html"
diff --git "a/\345\205\254\345\205\261/\346\207\211\347\224\250\347\250\213\345\272\217/index.html" "b/\345\205\254\345\205\261/\346\207\211\347\224\250\347\250\213\345\272\217/index.html"
new file mode 100644
index 0000000..dcaf716
--- /dev/null
+++ "b/\345\205\254\345\205\261/\346\207\211\347\224\250\347\250\213\345\272\217/index.html"
@@ -0,0 +1 @@
+index.html
From 3aed947aacc162a6030e9d019bb6d149d119a1d1 Mon Sep 17 00:00:00 2001
From: wu nan yi <37365331+iambite@users.noreply.github.com>
Date: Mon, 19 Mar 2018 05:38:12 +0800
Subject: [PATCH 05/14] package.json
---
.../package.json" | 1 +
1 file changed, 1 insertion(+)
create mode 100644 "\345\205\254\345\205\261/\346\207\211\347\224\250\347\250\213\345\272\217/package.json"
diff --git "a/\345\205\254\345\205\261/\346\207\211\347\224\250\347\250\213\345\272\217/package.json" "b/\345\205\254\345\205\261/\346\207\211\347\224\250\347\250\213\345\272\217/package.json"
new file mode 100644
index 0000000..ec6d3cd
--- /dev/null
+++ "b/\345\205\254\345\205\261/\346\207\211\347\224\250\347\250\213\345\272\217/package.json"
@@ -0,0 +1 @@
+package.json
From c79edfdaec189cddfd71386e8c9c92eba79740cd Mon Sep 17 00:00:00 2001
From: wu nan yi <37365331+iambite@users.noreply.github.com>
Date: Mon, 19 Mar 2018 05:38:31 +0800
Subject: [PATCH 06/14] server.js
---
.../\346\207\211\347\224\250\347\250\213\345\272\217/server.js" | 1 +
1 file changed, 1 insertion(+)
create mode 100644 "\345\205\254\345\205\261/\346\207\211\347\224\250\347\250\213\345\272\217/server.js"
diff --git "a/\345\205\254\345\205\261/\346\207\211\347\224\250\347\250\213\345\272\217/server.js" "b/\345\205\254\345\205\261/\346\207\211\347\224\250\347\250\213\345\272\217/server.js"
new file mode 100644
index 0000000..9417957
--- /dev/null
+++ "b/\345\205\254\345\205\261/\346\207\211\347\224\250\347\250\213\345\272\217/server.js"
@@ -0,0 +1 @@
+server.js
From c62bae4acc0bb9b34ab3f894e5148d3ebeaa6134 Mon Sep 17 00:00:00 2001
From: wu nan yi <37365331+iambite@users.noreply.github.com>
Date: Mon, 19 Mar 2018 05:42:36 +0800
Subject: [PATCH 07/14] Add files via upload
---
.../about.component.ts" | 27 ++++++
.../app-routing.module.ts" | 34 +++++++
.../app.component.ts" | 55 ++++++++++++
.../app.module.ts" | 45 ++++++++++
.../home.component.ts" | 49 ++++++++++
.../main.ts" | 22 +++++
.../rxjs-extensions.ts" | 29 ++++++
.../video-card.component.ts" | 90 +++++++++++++++++++
.../video-card.css" | 25 ++++++
9 files changed, 376 insertions(+)
create mode 100644 "\345\205\254\345\205\261/\346\207\211\347\224\250\347\250\213\345\272\217/about.component.ts"
create mode 100644 "\345\205\254\345\205\261/\346\207\211\347\224\250\347\250\213\345\272\217/app-routing.module.ts"
create mode 100644 "\345\205\254\345\205\261/\346\207\211\347\224\250\347\250\213\345\272\217/app.component.ts"
create mode 100644 "\345\205\254\345\205\261/\346\207\211\347\224\250\347\250\213\345\272\217/app.module.ts"
create mode 100644 "\345\205\254\345\205\261/\346\207\211\347\224\250\347\250\213\345\272\217/home.component.ts"
create mode 100644 "\345\205\254\345\205\261/\346\207\211\347\224\250\347\250\213\345\272\217/main.ts"
create mode 100644 "\345\205\254\345\205\261/\346\207\211\347\224\250\347\250\213\345\272\217/rxjs-extensions.ts"
create mode 100644 "\345\205\254\345\205\261/\346\207\211\347\224\250\347\250\213\345\272\217/video-card.component.ts"
create mode 100644 "\345\205\254\345\205\261/\346\207\211\347\224\250\347\250\213\345\272\217/video-card.css"
diff --git "a/\345\205\254\345\205\261/\346\207\211\347\224\250\347\250\213\345\272\217/about.component.ts" "b/\345\205\254\345\205\261/\346\207\211\347\224\250\347\250\213\345\272\217/about.component.ts"
new file mode 100644
index 0000000..80268be
--- /dev/null
+++ "b/\345\205\254\345\205\261/\346\207\211\347\224\250\347\250\213\345\272\217/about.component.ts"
@@ -0,0 +1,27 @@
+/**
+ * Copyright 2017, Google, Inc.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+'use strict';
+
+import { Component } from '@angular/core';
+
+@Component({
+ moduleId: module.id,
+ selector: 'about',
+ template: `
+ About
+ `
+})
+export class AboutComponent {}
diff --git "a/\345\205\254\345\205\261/\346\207\211\347\224\250\347\250\213\345\272\217/app-routing.module.ts" "b/\345\205\254\345\205\261/\346\207\211\347\224\250\347\250\213\345\272\217/app-routing.module.ts"
new file mode 100644
index 0000000..444b129
--- /dev/null
+++ "b/\345\205\254\345\205\261/\346\207\211\347\224\250\347\250\213\345\272\217/app-routing.module.ts"
@@ -0,0 +1,34 @@
+/**
+ * Copyright 2017, Google, Inc.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+'use strict';
+
+import { NgModule } from '@angular/core';
+import { RouterModule, Routes } from '@angular/router';
+
+import { HomeComponent } from './home.component';
+import { AboutComponent } from './about.component';
+
+const routes: Routes = [
+ { path: '', component: HomeComponent },
+ { path: 'about', component: AboutComponent },
+ { path: '**', redirectTo: '' }
+];
+
+@NgModule({
+ imports: [ RouterModule.forRoot(routes) ],
+ exports: [ RouterModule ]
+})
+export class AppRoutingModule {}
diff --git "a/\345\205\254\345\205\261/\346\207\211\347\224\250\347\250\213\345\272\217/app.component.ts" "b/\345\205\254\345\205\261/\346\207\211\347\224\250\347\250\213\345\272\217/app.component.ts"
new file mode 100644
index 0000000..aac5520
--- /dev/null
+++ "b/\345\205\254\345\205\261/\346\207\211\347\224\250\347\250\213\345\272\217/app.component.ts"
@@ -0,0 +1,55 @@
+/**
+ * Copyright 2017, Google, Inc.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+'use strict';
+
+import { Component } from '@angular/core';
+
+@Component({
+ moduleId: module.id,
+ selector: 'app',
+ styles: [`
+ .router-link-active {
+ text-decoration: underline;
+ }
+ `],
+ template: `
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ `
+})
+export class AppComponent {}
diff --git "a/\345\205\254\345\205\261/\346\207\211\347\224\250\347\250\213\345\272\217/app.module.ts" "b/\345\205\254\345\205\261/\346\207\211\347\224\250\347\250\213\345\272\217/app.module.ts"
new file mode 100644
index 0000000..c063ef5
--- /dev/null
+++ "b/\345\205\254\345\205\261/\346\207\211\347\224\250\347\250\213\345\272\217/app.module.ts"
@@ -0,0 +1,45 @@
+/**
+ * Copyright 2017, Google, Inc.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+'use strict';
+
+import './rxjs-extensions';
+
+import { NgModule } from '@angular/core';
+import { BrowserModule } from '@angular/platform-browser';
+import { HttpModule } from '@angular/http';
+
+import { AppRoutingModule } from './app-routing.module';
+
+import { AppComponent } from './app.component';
+import { HomeComponent } from './home.component';
+import { AboutComponent } from './about.component';
+import { VideoCardComponent } from './video-card.component';
+
+@NgModule({
+ imports: [
+ BrowserModule,
+ HttpModule,
+ AppRoutingModule
+ ],
+ declarations: [
+ AppComponent,
+ HomeComponent,
+ AboutComponent,
+ VideoCardComponent
+ ],
+ bootstrap: [ AppComponent ]
+})
+export class AppModule { }
diff --git "a/\345\205\254\345\205\261/\346\207\211\347\224\250\347\250\213\345\272\217/home.component.ts" "b/\345\205\254\345\205\261/\346\207\211\347\224\250\347\250\213\345\272\217/home.component.ts"
new file mode 100644
index 0000000..dffb9c3
--- /dev/null
+++ "b/\345\205\254\345\205\261/\346\207\211\347\224\250\347\250\213\345\272\217/home.component.ts"
@@ -0,0 +1,49 @@
+/**
+ * Copyright 2017, Google, Inc.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+'use strict';
+
+import { Component } from '@angular/core';
+import { Http } from '@angular/http';
+import { Video, VideoCardComponent } from './video-card.component';
+
+@Component({
+ moduleId: module.id,
+ selector: 'home',
+ template: `
+
3D Cardboard Videos
+
+ {{ resultsPerPage }} of {{ totalResults }} results
+
+
+
+ `
+})
+export class HomeComponent {
+ resultsPerPage: number;
+ totalResults: number;
+ videos = [];
+ constructor (public http: Http) {
+
+ }
+ ngOnInit () {
+ this.http.get('/data.json').subscribe((res) => {
+ const data = res.json();
+ this.resultsPerPage = data.pageInfo.resultsPerPage;
+ this.totalResults = data.pageInfo.totalResults;
+ this.videos = data.items.map((video) => new Video(video));
+ });
+ }
+}
diff --git "a/\345\205\254\345\205\261/\346\207\211\347\224\250\347\250\213\345\272\217/main.ts" "b/\345\205\254\345\205\261/\346\207\211\347\224\250\347\250\213\345\272\217/main.ts"
new file mode 100644
index 0000000..4c0aa26
--- /dev/null
+++ "b/\345\205\254\345\205\261/\346\207\211\347\224\250\347\250\213\345\272\217/main.ts"
@@ -0,0 +1,22 @@
+/**
+ * Copyright 2017, Google, Inc.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+'use strict';
+
+import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
+
+import { AppModule } from './app.module';
+
+platformBrowserDynamic().bootstrapModule(AppModule);
diff --git "a/\345\205\254\345\205\261/\346\207\211\347\224\250\347\250\213\345\272\217/rxjs-extensions.ts" "b/\345\205\254\345\205\261/\346\207\211\347\224\250\347\250\213\345\272\217/rxjs-extensions.ts"
new file mode 100644
index 0000000..e807dfe
--- /dev/null
+++ "b/\345\205\254\345\205\261/\346\207\211\347\224\250\347\250\213\345\272\217/rxjs-extensions.ts"
@@ -0,0 +1,29 @@
+/**
+ * Copyright 2017, Google, Inc.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+'use strict';
+
+// Observable class extensions
+import 'rxjs/add/observable/of';
+import 'rxjs/add/observable/throw';
+
+// Observable operators
+import 'rxjs/add/operator/catch';
+import 'rxjs/add/operator/debounceTime';
+import 'rxjs/add/operator/distinctUntilChanged';
+import 'rxjs/add/operator/do';
+import 'rxjs/add/operator/filter';
+import 'rxjs/add/operator/map';
+import 'rxjs/add/operator/switchMap';
diff --git "a/\345\205\254\345\205\261/\346\207\211\347\224\250\347\250\213\345\272\217/video-card.component.ts" "b/\345\205\254\345\205\261/\346\207\211\347\224\250\347\250\213\345\272\217/video-card.component.ts"
new file mode 100644
index 0000000..3c89c8b
--- /dev/null
+++ "b/\345\205\254\345\205\261/\346\207\211\347\224\250\347\250\213\345\272\217/video-card.component.ts"
@@ -0,0 +1,90 @@
+/**
+ * Copyright 2017, Google, Inc.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+'use strict';
+
+import { Component, Input } from '@angular/core';
+import { DomSanitizer, SafeResourceUrl } from '@angular/platform-browser';
+
+export class Video {
+ id: {
+ videoId: string
+ }
+ snippet: {
+ description: string
+ publishedAt: string|Date
+ title: string
+ thumbnails: {
+ high: {
+ url: string
+ }
+ }
+ }
+ constructor (props) {
+ for (var key in props) {
+ this[key] = props[key];
+ }
+ this.snippet.publishedAt = new Date(this.snippet.publishedAt);
+ }
+}
+
+/**
+ * Component for displaying a single search result.
+ */
+@Component({
+ moduleId: module.id,
+ selector: 'video-card',
+ styleUrls: ['src/app/video-card.css'],
+ template: `
+
+
+
{{ video.snippet.title }}
+
+ Published {{ video.snippet.publishedAt | date }}
+
+ {{ video.snippet.description }}
+
+
+
+
+
+
+
+
+
+
+ `
+})
+export class VideoCardComponent {
+ constructor(private sanitizer: DomSanitizer) {
+ this.sanitizer = sanitizer;
+ }
+ @Input() video: Video
+ show: boolean = false
+ videoUrl: SafeResourceUrl
+ updateVideoUrl(video: Video) {
+ // Appending an ID to a YouTube URL is safe.
+ // Always make sure to construct SafeValue objects as
+ // close as possible to the input data, so
+ // that it's easier to check if the value is safe.
+ const dangerousVideoUrl = `https://www.youtube.com/embed/${video.id.videoId}?autoplay=0`;
+ return this.sanitizer.bypassSecurityTrustResourceUrl(dangerousVideoUrl);
+ }
+}
diff --git "a/\345\205\254\345\205\261/\346\207\211\347\224\250\347\250\213\345\272\217/video-card.css" "b/\345\205\254\345\205\261/\346\207\211\347\224\250\347\250\213\345\272\217/video-card.css"
new file mode 100644
index 0000000..e9b84ae
--- /dev/null
+++ "b/\345\205\254\345\205\261/\346\207\211\347\224\250\347\250\213\345\272\217/video-card.css"
@@ -0,0 +1,25 @@
+/**
+ * Copyright 2017, Google, Inc.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+.video-card {
+ margin-bottom: 20px;
+}
+.video-card iframe {
+ border: 0;
+ height: 220px;
+}
+.video-card img {
+ cursor: pointer;
+}
From 54dcce546c1aaef8607a9abf7677373dcad81d1b Mon Sep 17 00:00:00 2001
From: wu nan yi <37365331+iambite@users.noreply.github.com>
Date: Mon, 19 Mar 2018 06:03:07 +0800
Subject: [PATCH 08/14] Update server.js
---
.../server.js" | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git "a/\345\205\254\345\205\261/\346\207\211\347\224\250\347\250\213\345\272\217/server.js" "b/\345\205\254\345\205\261/\346\207\211\347\224\250\347\250\213\345\272\217/server.js"
index 9417957..26548c8 100644
--- "a/\345\205\254\345\205\261/\346\207\211\347\224\250\347\250\213\345\272\217/server.js"
+++ "b/\345\205\254\345\205\261/\346\207\211\347\224\250\347\250\213\345\272\217/server.js"
@@ -1 +1,7 @@
-server.js
+if (process.env.NODE_ENV === "production") {
+ require("@google/cloud-trace").start();
+}
+
+if (process.env.GCLOUD_PROJECT) {
+ require("@google/cloud-debug").start();
+}
From 03e394c8684a31d8b085e71dc1d62b88a497da89 Mon Sep 17 00:00:00 2001
From: wu nan yi <37365331+iambite@users.noreply.github.com>
Date: Mon, 19 Mar 2018 18:45:18 +0800
Subject: [PATCH 09/14] Update server.js
From bd1ba681dd52f6834b28e231c50a9d4a1ae088ac Mon Sep 17 00:00:00 2001
From: wu nan yi <37365331+iambite@users.noreply.github.com>
Date: Mon, 19 Mar 2018 18:51:34 +0800
Subject: [PATCH 10/14] Update server.js
---
.../server.js" | 3 +++
1 file changed, 3 insertions(+)
diff --git "a/\345\205\254\345\205\261/\346\207\211\347\224\250\347\250\213\345\272\217/server.js" "b/\345\205\254\345\205\261/\346\207\211\347\224\250\347\250\213\345\272\217/server.js"
index 26548c8..3e554b8 100644
--- "a/\345\205\254\345\205\261/\346\207\211\347\224\250\347\250\213\345\272\217/server.js"
+++ "b/\345\205\254\345\205\261/\346\207\211\347\224\250\347\250\213\345\272\217/server.js"
@@ -5,3 +5,6 @@ if (process.env.NODE_ENV === "production") {
if (process.env.GCLOUD_PROJECT) {
require("@google/cloud-debug").start();
}
+git config --global user.email "wne@iambite.com"
+git config --global user.name "iambite"
+git config credential.helper gcloud.sh
From 721c2fb53c2a5cdb6c76db6748dfc4d090b2a801 Mon Sep 17 00:00:00 2001
From: wu nan yi <37365331+iambite@users.noreply.github.com>
Date: Mon, 19 Mar 2018 18:52:59 +0800
Subject: [PATCH 11/14] Update server.js
---
.../server.js" | 3 ---
1 file changed, 3 deletions(-)
diff --git "a/\345\205\254\345\205\261/\346\207\211\347\224\250\347\250\213\345\272\217/server.js" "b/\345\205\254\345\205\261/\346\207\211\347\224\250\347\250\213\345\272\217/server.js"
index 3e554b8..26548c8 100644
--- "a/\345\205\254\345\205\261/\346\207\211\347\224\250\347\250\213\345\272\217/server.js"
+++ "b/\345\205\254\345\205\261/\346\207\211\347\224\250\347\250\213\345\272\217/server.js"
@@ -5,6 +5,3 @@ if (process.env.NODE_ENV === "production") {
if (process.env.GCLOUD_PROJECT) {
require("@google/cloud-debug").start();
}
-git config --global user.email "wne@iambite.com"
-git config --global user.name "iambite"
-git config credential.helper gcloud.sh
From ba84ef9a05eacb928d8bbfbde50b34b0a18dd2d2 Mon Sep 17 00:00:00 2001
From: wu nan yi <37365331+iambite@users.noreply.github.com>
Date: Mon, 19 Mar 2018 22:20:15 +0800
Subject: [PATCH 12/14] Create server.js
---
public/server.js | 90 ++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 90 insertions(+)
create mode 100644 public/server.js
diff --git a/public/server.js b/public/server.js
new file mode 100644
index 0000000..b6e58b7
--- /dev/null
+++ b/public/server.js
@@ -0,0 +1,90 @@
+/**
+ * Copyright 2017, Google, Inc.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+'use strict';
+
+var errorHandler;
+
+if (process.env.NODE_ENV === 'production') {
+ require('@google/cloud-trace').start();
+ errorHandler = require('@google/cloud-errors').start();
+}
+
+if (process.env.GCLOUD_PROJECT) {
+ require('@google-cloud/debug-agent').start();
+}
+
+var path = require('path');
+var express = require('express');
+var bodyParser = require('body-parser');
+var google = require('googleapis');
+var youtube = google.youtube('v3');
+
+var app = express();
+
+app.use(bodyParser.json());
+app.use(express.static(path.join(__dirname, 'public')));
+
+app.get('/data.json', function (req, res, next) {
+ youtube.search.list({
+ part: 'snippet',
+ type: 'video',
+ q: 'google+cardboard+video+3d',
+ auth: process.env.API_KEY
+ }, function (err, result) {
+ if (err) {
+ return next(err);
+ }
+ res.json(result);
+ });
+});
+
+app.get('/search', function (req, res, next) {
+ youtube.search.list({
+ part: 'snippet',
+ type: 'video',
+ q: req.query.q
+ }, function (err, result) {
+ if (err) {
+ return next(new Error('Search error!'));
+ }
+ res.json(result);
+ });
+});
+
+app.use('*', function (req, res) {
+ return res.sendFile(path.join(__dirname, 'public/index.html'));
+});
+
+// Basic error logger/handler
+app.use(function (err, req, res, next) {
+ res.status(500).send(err.message || 'Something broke!');
+ next(err || new Error('Something broke!'));
+});
+if (process.env.NODE_ENV === 'production') {
+ app.use(errorHandler.express);
+}
+
+if (module === require.main) {
+ // Start the server
+ var server = app.listen(process.env.port || 8080, function () {
+ var port = server.address().port;
+
+ console.log('App listening on port %s', port);
+ console.log('Press Ctrl+C to quit.');
+ });
+}
+
+module.exports = app;
From 4556de8baf327886fd02812f628ea9e196628b61 Mon Sep 17 00:00:00 2001
From: wu nan yi <37365331+iambite@users.noreply.github.com>
Date: Mon, 19 Mar 2018 22:21:51 +0800
Subject: [PATCH 13/14] Create package.json
---
public/package.json | 26 ++++++++++++++++++++++++++
1 file changed, 26 insertions(+)
create mode 100644 public/package.json
diff --git a/public/package.json b/public/package.json
new file mode 100644
index 0000000..a910154
--- /dev/null
+++ b/public/package.json
@@ -0,0 +1,26 @@
+{
+ "name": "cloud-cardboard-viewer",
+ "description": "Angular2 and Node.js Cardboard video viewer.",
+ "version": "0.1.0",
+ "private": true,
+ "license": "Apache-2.0",
+ "author": "Google Inc.",
+ "repository": {
+ "type": "git",
+ "url": "https://github.com/googlecodelabs/cloud-cardboard-viewer.git"
+ },
+ "contributors": [
+ "Jason Dobry "
+ ],
+ "dependencies": {
+ "@google-cloud/debug-agent": "0.10.2",
+ "@google/cloud-errors": "0.1.1",
+ "@google/cloud-trace": "0.6.2",
+ "body-parser": "1.16.1",
+ "express": "4.14.1",
+ "googleapis": "16.1.0"
+ },
+ "engines": {
+ "node": "~6"
+ }
+}
From 34129b98d3cf20ae0b85a7d67ac3aa95c21ea3ef Mon Sep 17 00:00:00 2001
From: wu nan yi <37365331+iambite@users.noreply.github.com>
Date: Mon, 19 Mar 2018 22:26:39 +0800
Subject: [PATCH 14/14] Update server.js
---
public/server.js | 89 ++----------------------------------------------
1 file changed, 3 insertions(+), 86 deletions(-)
diff --git a/public/server.js b/public/server.js
index b6e58b7..26548c8 100644
--- a/public/server.js
+++ b/public/server.js
@@ -1,90 +1,7 @@
-/**
- * Copyright 2017, Google, Inc.
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-'use strict';
-
-var errorHandler;
-
-if (process.env.NODE_ENV === 'production') {
- require('@google/cloud-trace').start();
- errorHandler = require('@google/cloud-errors').start();
+if (process.env.NODE_ENV === "production") {
+ require("@google/cloud-trace").start();
}
if (process.env.GCLOUD_PROJECT) {
- require('@google-cloud/debug-agent').start();
+ require("@google/cloud-debug").start();
}
-
-var path = require('path');
-var express = require('express');
-var bodyParser = require('body-parser');
-var google = require('googleapis');
-var youtube = google.youtube('v3');
-
-var app = express();
-
-app.use(bodyParser.json());
-app.use(express.static(path.join(__dirname, 'public')));
-
-app.get('/data.json', function (req, res, next) {
- youtube.search.list({
- part: 'snippet',
- type: 'video',
- q: 'google+cardboard+video+3d',
- auth: process.env.API_KEY
- }, function (err, result) {
- if (err) {
- return next(err);
- }
- res.json(result);
- });
-});
-
-app.get('/search', function (req, res, next) {
- youtube.search.list({
- part: 'snippet',
- type: 'video',
- q: req.query.q
- }, function (err, result) {
- if (err) {
- return next(new Error('Search error!'));
- }
- res.json(result);
- });
-});
-
-app.use('*', function (req, res) {
- return res.sendFile(path.join(__dirname, 'public/index.html'));
-});
-
-// Basic error logger/handler
-app.use(function (err, req, res, next) {
- res.status(500).send(err.message || 'Something broke!');
- next(err || new Error('Something broke!'));
-});
-if (process.env.NODE_ENV === 'production') {
- app.use(errorHandler.express);
-}
-
-if (module === require.main) {
- // Start the server
- var server = app.listen(process.env.port || 8080, function () {
- var port = server.address().port;
-
- console.log('App listening on port %s', port);
- console.log('Press Ctrl+C to quit.');
- });
-}
-
-module.exports = app;