From 4c49ba906075056e15d6bd2725cce934b9c97e8f Mon Sep 17 00:00:00 2001 From: James Daniels Date: Thu, 20 Feb 2025 15:03:57 -0500 Subject: [PATCH 1/2] Fix -staging links, fix lint --- frontend/components/HeaderBar.vue | 6 +++- frontend/components/Project/Detail.vue | 3 +- frontend/components/SearchInput.vue | 30 ++++++++++++---- frontend/components/WelcomeCard.vue | 6 +++- frontend/nuxt.config.ts | 12 +++---- .../projects/[org]/[repo]/[...parts].vue | 32 ++++++++++++++--- .../pages/projects/[org]/[repo]/index.vue | 36 ------------------- 7 files changed, 68 insertions(+), 57 deletions(-) delete mode 100644 frontend/pages/projects/[org]/[repo]/index.vue diff --git a/frontend/components/HeaderBar.vue b/frontend/components/HeaderBar.vue index 69d2abb..7fee640 100644 --- a/frontend/components/HeaderBar.vue +++ b/frontend/components/HeaderBar.vue @@ -15,7 +15,11 @@ to="/" class="logo" > - + Firebase Open Source diff --git a/frontend/components/Project/Detail.vue b/frontend/components/Project/Detail.vue index 74fc117..775f232 100644 --- a/frontend/components/Project/Detail.vue +++ b/frontend/components/Project/Detail.vue @@ -98,9 +98,8 @@ const info = { stars: projectConfig.stars, } -const projectPath = `/projects/${org}/${repo}`.toLowerCase() - const isStaging = env === Env.STAGING +const projectPath = `/projects${isStaging ? '-staging' : ''}/${org}/${repo}`.toLowerCase() function getSubheaderTabs() { const tabs = [ diff --git a/frontend/components/SearchInput.vue b/frontend/components/SearchInput.vue index 754d8a8..2a461ad 100644 --- a/frontend/components/SearchInput.vue +++ b/frontend/components/SearchInput.vue @@ -1,10 +1,26 @@ From 930a16e147fa663440ceecf5ef95afba37f5ed34 Mon Sep 17 00:00:00 2001 From: James Daniels Date: Wed, 9 Apr 2025 10:41:13 -0500 Subject: [PATCH 2/2] Support subpath, add app hosting adapters --- config/additional_projects.json | 6 ++++++ firebase.json | 2 +- frontend/components/HomePage.vue | 1 + frontend/utils/db.ts | 7 +++++++ functions/src/index.ts | 18 ++++++++++++------ functions/src/project.ts | 5 +++-- 6 files changed, 30 insertions(+), 9 deletions(-) diff --git a/config/additional_projects.json b/config/additional_projects.json index ab02784..f1c9b03 100644 --- a/config/additional_projects.json +++ b/config/additional_projects.json @@ -1,5 +1,11 @@ { "projects": [ + "FirebaseExtended::firebase-framework-tools::docs::angular", + "FirebaseExtended::firebase-framework-tools::docs::nextjs", + "FirebaseExtended::firebase-framework-tools::docs::astro", + "FirebaseExtended::firebase-framework-tools::docs::nitro", + "FirebaseExtended::firebase-framework-tools::docs::nuxt", + "angular::angularfire2", "angular::angularfire2", "googlesamples::easypermissions", "tylermcginnis::re-base", diff --git a/firebase.json b/firebase.json index dc482e6..c525b93 100644 --- a/firebase.json +++ b/firebase.json @@ -13,7 +13,7 @@ }, { "source": "**", - "destination": "/404.html" + "destination": "/index.html" } ] }, diff --git a/frontend/components/HomePage.vue b/frontend/components/HomePage.vue index 35f28f0..c1c13a4 100644 --- a/frontend/components/HomePage.vue +++ b/frontend/components/HomePage.vue @@ -61,6 +61,7 @@ const subheaderTabs = [ { title: 'Web', href: '/platform/web' }, { title: 'Admin', href: '/platform/admin' }, { title: 'Games', href: '/platform/games' }, + { title: 'App Hosting', href: '/platform/app_hosting' }, ] as const const { diff --git a/frontend/utils/db.ts b/frontend/utils/db.ts index 40c4ff6..d65f7cd 100644 --- a/frontend/utils/db.ts +++ b/frontend/utils/db.ts @@ -79,6 +79,13 @@ export class Util { // Categories used for the subheader const ALL_CATEGORIES = [ + { + title: 'App Hosting', + icon: 'web', + platform: 'app_hosting', + projects: [], + featured: [], + }, { title: 'Android', icon: 'android', diff --git a/functions/src/index.ts b/functions/src/index.ts index c289711..65f3dce 100644 --- a/functions/src/index.ts +++ b/functions/src/index.ts @@ -42,23 +42,29 @@ const DEFAULT_PARAMS: GetParams = { exports.stageProject = functions .runWith(RUNTIME_OPTS) .https.onRequest(async (request, response) => { - const org = request.params.org; - const repo = request.params.repo; - const branch = request.params.branch || "master"; - console.log(`stageProject(${org}, ${repo}, ${branch})`); + const org = request.query.org as string; + const repo = request.query.repo as string; + const branch = (request.query.branch as string | undefined) || "master"; + const path = request.query.path as string | undefined; + console.log(`stageProject(${org}, ${repo}, ${branch}, ${path || "/"})`); const p = new Project({ env: Env.STAGING, branch }); - const id = Util.normalizeId(`${org}::${repo}`); + const pathParts = path?.split("/"); + const id = Util.normalizeId( + `${org}::${repo}${pathParts ? "::" + pathParts.join("::") : ""}` + ); try { await p.recursiveStoreProject(id); response .status(200) .send( - `Visit https://firebaseopensource.com/projects-staging/${org}/${repo}` + `Visit https://firebaseopensource.com/projects-staging/${org}/${repo}${ + path ? `::${pathParts.join("::")}` : "" + } to see the staged project.\n` ); } catch (e) { console.warn(e); diff --git a/functions/src/project.ts b/functions/src/project.ts index 9e0127d..0d04138 100644 --- a/functions/src/project.ts +++ b/functions/src/project.ts @@ -28,6 +28,7 @@ import { } from "../../shared/types"; import * as admin from "firebase-admin"; +import { Timestamp } from "firebase-admin/firestore"; const cjson = require("comment-json"); @@ -199,7 +200,7 @@ export class Project { return this.github .getRepoMetadata(idParsed.owner, idParsed.repo) .then(meta => { - if (meta.description) { + if (meta.description && !config.description) { config.description = meta.description; } @@ -223,7 +224,7 @@ export class Project { const docId = Util.normalizeId(id); // Add server timestamp - data.last_fetched = admin.firestore.FieldValue.serverTimestamp(); + data.last_fetched = Timestamp.now(); // Get path to the config document in the database const configPath = Util.configPath(docId, this.params.env);