@altafusion/fugue-content 0.0.0-stage → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +36 -0
- package/LICENSE +21 -0
- package/README.md +352 -2
- package/app/components/FugueContent404Page.vue +48 -0
- package/app/components/FugueContentAuthSignOut.vue +16 -0
- package/app/components/FugueContentContentPage.vue +33 -0
- package/app/components/FugueContentEditContent.vue +76 -0
- package/app/components/FugueContentEditorMenu.vue +60 -0
- package/app/components/FugueContentFooterActions.vue +32 -0
- package/app/components/FugueContentFragment.vue +53 -0
- package/app/components/FugueContentHeaderActions.vue +37 -0
- package/app/components/FugueContentLandingPage.vue +69 -0
- package/app/components/FugueContentLayoutArticle.vue +22 -0
- package/app/components/FugueContentLayoutArticleAside.vue +88 -0
- package/app/components/FugueContentLayoutLanding.vue +5 -0
- package/app/components/LandingHeroMedia.vue +91 -0
- package/app/components/content/CallToAction.vue +35 -0
- package/app/components/content/Hero.vue +34 -0
- package/app/composables/useFugueContentCatchAllRoute.ts +91 -0
- package/app/composables/useFugueContentFragment.ts +70 -0
- package/app/composables/useFugueContentI18n.ts +77 -0
- package/app/composables/useFugueContentLanding.ts +24 -0
- package/app/composables/useFugueContentPage.ts +37 -0
- package/app/composables/useFugueContentSettings.ts +140 -0
- package/app/composables/useFugueContentStudioEdit.ts +38 -0
- package/app/pages/[...slug].vue +7 -0
- package/app/pages/fragments/[slug].vue +25 -0
- package/app/pages/index.vue +7 -0
- package/app/pages/login.vue +70 -0
- package/app/plugins/auth-session-sync.client.ts +33 -0
- package/app/plugins/landing-component-registry.ts +15 -0
- package/app/plugins/landing-nav.ts +26 -0
- package/app/plugins/qe-tools.client.ts +28 -0
- package/app/plugins/seo-defaults.ts +4 -0
- package/app/plugins/settings-bridge.ts +14 -0
- package/app/plugins/shell-display-name.ts +18 -0
- package/app/plugins/studio-auto-open.client.ts +30 -0
- package/app/plugins/studio-dev-shortcut.client.ts +24 -0
- package/app/plugins/studio-footer-actions.client.ts +27 -0
- package/app/plugins/studio-footer-actions.server.ts +11 -0
- package/app/plugins/studio-hash-cleanup.client.ts +12 -0
- package/app/plugins/studio-header-actions.client.ts +30 -0
- package/app/plugins/studio-header-actions.server.ts +13 -0
- package/app/utils/studio-mount.ts +72 -0
- package/composables/useFugueContentAuthMode.ts +16 -0
- package/composables/useFugueContentAuthSignOut.ts +82 -0
- package/composables/useFugueContentPeekSession.ts +31 -0
- package/composables/useFugueContentStudioEditorEntry.ts +112 -0
- package/composables/useFugueContentStudioSession.ts +81 -0
- package/content.config.ts +199 -0
- package/content.d.ts +25 -0
- package/eslint.config.mjs +4 -0
- package/lib/404-defaults.ts +41 -0
- package/lib/article-i18n.ts +10 -0
- package/lib/auth-resolve.ts +74 -0
- package/lib/auth-utils.ts +44 -0
- package/lib/define-site.ts +156 -0
- package/lib/header-actions-registration.ts +42 -0
- package/lib/i18n-locales.ts +22 -0
- package/lib/i18n-utils.ts +136 -0
- package/lib/i18n.ts +2 -0
- package/lib/landing.ts +129 -0
- package/lib/login-redirect.ts +12 -0
- package/lib/netlify-ssr.ts +113 -0
- package/lib/page-toc.ts +14 -0
- package/lib/qe-tools/index.ts +36 -0
- package/lib/qe-tools/studio-drafts.ts +315 -0
- package/lib/qe-tools/types.ts +14 -0
- package/lib/settings-state.ts +1 -0
- package/lib/site-config-registry.ts +80 -0
- package/lib/studio-activation-gated.d.ts +20 -0
- package/lib/studio-activation-gated.js +127 -0
- package/lib/studio-auto-open.ts +26 -0
- package/lib/studio-cookies.d.ts +10 -0
- package/lib/studio-cookies.js +11 -0
- package/lib/studio-document-edit.ts +61 -0
- package/lib/studio-editor-visibility.ts +54 -0
- package/lib/studio-open.ts +7 -0
- package/lib/studio-session.ts +91 -0
- package/modules/i18n.ts +80 -0
- package/modules/landing-components.ts +95 -0
- package/modules/studio-auth-gate.ts +48 -0
- package/modules/studio-entry.ts +23 -0
- package/nuxt.config.ts +90 -0
- package/package.json +75 -3
- package/schemas/site-settings.schema.json +127 -0
- package/server/middleware/studio-oauth-redirect.ts +36 -0
- package/server/middleware/studio-provider-check.ts +59 -0
- package/server/plugins/studio-hash-cleanup.ts +8 -0
- package/tsconfig.build.json +22 -0
- package/tsconfig.json +20 -0
- package/types/site.ts +79 -0
package/nuxt.config.ts
ADDED
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @altafusion/fugue-content — Nuxt layer
|
|
3
|
+
*
|
|
4
|
+
* Nuxt Content, MDC blocks, and content page routing for consumer marketing sites.
|
|
5
|
+
* Composes with @altafusion/shell (site chrome stays in shell).
|
|
6
|
+
*
|
|
7
|
+
* Styling: MDC blocks and layouts use Nuxt UI + Tailwind semantic tokens
|
|
8
|
+
* (`text-highlighted`, `UButton`, …). Apps must directly extend
|
|
9
|
+
* `@altafusion/fugue-theme` and pass `enableNuxtUI: true` in `createAppConfig`.
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
import { dirname, join } from 'node:path'
|
|
13
|
+
import { fileURLToPath } from 'node:url'
|
|
14
|
+
import { useNuxt } from '@nuxt/kit'
|
|
15
|
+
|
|
16
|
+
const layerDir = dirname(fileURLToPath(import.meta.url))
|
|
17
|
+
|
|
18
|
+
async function patchContentComponentsTs(buildDir: string) {
|
|
19
|
+
const { readFile, writeFile } = await import('node:fs/promises')
|
|
20
|
+
const componentsPath = join(buildDir, 'content/components.ts')
|
|
21
|
+
try {
|
|
22
|
+
let src = await readFile(componentsPath, 'utf8')
|
|
23
|
+
if (!src.includes('@ts-nocheck')) {
|
|
24
|
+
src = `// @ts-nocheck\n${src}`
|
|
25
|
+
await writeFile(componentsPath, src)
|
|
26
|
+
}
|
|
27
|
+
} catch {
|
|
28
|
+
// Content may not have generated component loaders yet.
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export default defineNuxtConfig({
|
|
33
|
+
extends: ['@altafusion/shell'],
|
|
34
|
+
|
|
35
|
+
typescript: {
|
|
36
|
+
nodeTsConfig: {
|
|
37
|
+
include: [
|
|
38
|
+
'../content.config.ts',
|
|
39
|
+
'../lib/**/*.ts',
|
|
40
|
+
'../types/**/*.ts',
|
|
41
|
+
'../types/**/*.d.ts'
|
|
42
|
+
]
|
|
43
|
+
}
|
|
44
|
+
},
|
|
45
|
+
|
|
46
|
+
modules: [
|
|
47
|
+
join(layerDir, 'modules/i18n'),
|
|
48
|
+
join(layerDir, 'modules/landing-components'),
|
|
49
|
+
join(layerDir, 'modules/studio-entry'),
|
|
50
|
+
join(layerDir, 'modules/studio-auth-gate'),
|
|
51
|
+
'@nuxt/content',
|
|
52
|
+
'nuxt-studio'
|
|
53
|
+
],
|
|
54
|
+
|
|
55
|
+
build: {
|
|
56
|
+
transpile: ['nuxt-studio']
|
|
57
|
+
},
|
|
58
|
+
|
|
59
|
+
content: {
|
|
60
|
+
experimental: { sqliteConnector: 'native' }
|
|
61
|
+
},
|
|
62
|
+
|
|
63
|
+
mdc: {
|
|
64
|
+
components: {
|
|
65
|
+
map: {
|
|
66
|
+
cta: 'CallToAction'
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
},
|
|
70
|
+
|
|
71
|
+
components: [
|
|
72
|
+
{
|
|
73
|
+
path: './components',
|
|
74
|
+
pathPrefix: false
|
|
75
|
+
}
|
|
76
|
+
],
|
|
77
|
+
|
|
78
|
+
hooks: {
|
|
79
|
+
'app:templatesGenerated': async () => {
|
|
80
|
+
await patchContentComponentsTs(useNuxt().options.buildDir)
|
|
81
|
+
},
|
|
82
|
+
'ready': async (nuxt) => {
|
|
83
|
+
await patchContentComponentsTs(nuxt.options.buildDir)
|
|
84
|
+
},
|
|
85
|
+
'nitro:config': (nitroConfig) => {
|
|
86
|
+
nitroConfig.plugins = nitroConfig.plugins ?? []
|
|
87
|
+
nitroConfig.plugins.push(join(layerDir, 'server/plugins/studio-hash-cleanup.ts'))
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
})
|
package/package.json
CHANGED
|
@@ -1,6 +1,78 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@altafusion/fugue-content",
|
|
3
|
-
"
|
|
4
|
-
"
|
|
5
|
-
"description": "
|
|
3
|
+
"type": "module",
|
|
4
|
+
"version": "0.3.0",
|
|
5
|
+
"description": "Nuxt layer for Fugue Content sites — editorial pages, Studio, and MDC, composed with shell.",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"homepage": "https://github.com/altafusion/fugue/tree/main/packages-consumer/fugue-content#readme",
|
|
8
|
+
"bugs": {
|
|
9
|
+
"url": "https://github.com/altafusion/fugue/issues"
|
|
10
|
+
},
|
|
11
|
+
"repository": {
|
|
12
|
+
"type": "git",
|
|
13
|
+
"url": "git+https://github.com/altafusion/fugue.git",
|
|
14
|
+
"directory": "packages-consumer/fugue-content"
|
|
15
|
+
},
|
|
16
|
+
"publishConfig": {
|
|
17
|
+
"access": "public"
|
|
18
|
+
},
|
|
19
|
+
"exports": {
|
|
20
|
+
".": "./nuxt.config.ts",
|
|
21
|
+
"./define-site": "./lib/define-site.ts",
|
|
22
|
+
"./site-config-registry": "./lib/site-config-registry.ts",
|
|
23
|
+
"./qe-tools": "./lib/qe-tools/index.ts",
|
|
24
|
+
"./qe-tools/studio-drafts": "./lib/qe-tools/studio-drafts.ts",
|
|
25
|
+
"./types": "./types/site.ts"
|
|
26
|
+
},
|
|
27
|
+
"main": "./nuxt.config.ts",
|
|
28
|
+
"peerDependencies": {
|
|
29
|
+
"@altafusion/fugue-theme": "0.3.0",
|
|
30
|
+
"better-sqlite3": "^12.11.1",
|
|
31
|
+
"h3": "^1.15.0",
|
|
32
|
+
"nuxt": "^4.6.4",
|
|
33
|
+
"vue": "^3.5.46",
|
|
34
|
+
"vue-router": "^5.5.1"
|
|
35
|
+
},
|
|
36
|
+
"dependencies": {
|
|
37
|
+
"@altafusion/fugue-simple-auth": "0.3.0",
|
|
38
|
+
"@altafusion/nuxt-base": "0.3.0",
|
|
39
|
+
"@altafusion/shell": "0.3.0",
|
|
40
|
+
"@nuxt/content": "^3.17.0",
|
|
41
|
+
"@nuxt/kit": "^4.6.4",
|
|
42
|
+
"@nuxtjs/i18n": "^10.6.0",
|
|
43
|
+
"defu": "^6.1.7",
|
|
44
|
+
"nuxt-studio": "^1.8.2",
|
|
45
|
+
"ufo": "^1.6.4"
|
|
46
|
+
},
|
|
47
|
+
"devDependencies": {
|
|
48
|
+
"@altafusion/eslint-config": "0.3.0",
|
|
49
|
+
"@altafusion/fugue-theme": "0.3.0",
|
|
50
|
+
"@iconify-json/lucide": "^1.2.157",
|
|
51
|
+
"@types/node": "^26.6.6",
|
|
52
|
+
"better-sqlite3": "^12.11.1",
|
|
53
|
+
"eslint": "^10.15.0",
|
|
54
|
+
"nuxt": "^4.6.4",
|
|
55
|
+
"typescript": "^6.0.3",
|
|
56
|
+
"vitest": "^5.1.1",
|
|
57
|
+
"vue": "^3.5.46",
|
|
58
|
+
"vue-router": "^5.5.1"
|
|
59
|
+
},
|
|
60
|
+
"files": [
|
|
61
|
+
"**",
|
|
62
|
+
"!**/*.test.ts",
|
|
63
|
+
"!**/.nuxt",
|
|
64
|
+
"!**/.output",
|
|
65
|
+
"!**/.data",
|
|
66
|
+
"!**/coverage",
|
|
67
|
+
"!**/node_modules"
|
|
68
|
+
],
|
|
69
|
+
"scripts": {
|
|
70
|
+
"prepare:types": "node ../../packages-platform/nuxt-base/dev/nuxt-cli.mjs prepare",
|
|
71
|
+
"clean": "rm -rf .output .nuxt node_modules/.cache dist && node ../../packages-platform/nuxt-base/dev/nuxt-cli.mjs prepare",
|
|
72
|
+
"lint": "eslint .",
|
|
73
|
+
"lint:fix": "eslint . --fix",
|
|
74
|
+
"test": "pnpm --dir ../.. exec vitest run --project fugue-content",
|
|
75
|
+
"prelint": "pnpm run prepare:types",
|
|
76
|
+
"prelint:fix": "pnpm run prepare:types"
|
|
77
|
+
}
|
|
6
78
|
}
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
3
|
+
"$id": "https://altafusion.com/schemas/site-settings.json",
|
|
4
|
+
"title": "Fugue Content settings",
|
|
5
|
+
"description": "Locale-aware site metadata and optional one-page landing manifest (@altafusion/fugue-content settings collection).",
|
|
6
|
+
"type": "object",
|
|
7
|
+
"additionalProperties": true,
|
|
8
|
+
"properties": {
|
|
9
|
+
"siteName": { "type": "string" },
|
|
10
|
+
"phone": { "type": "string" },
|
|
11
|
+
"email": { "type": "string", "format": "email" },
|
|
12
|
+
"address": {
|
|
13
|
+
"type": "object",
|
|
14
|
+
"additionalProperties": false,
|
|
15
|
+
"properties": {
|
|
16
|
+
"street": { "type": "string" },
|
|
17
|
+
"city": { "type": "string" },
|
|
18
|
+
"region": { "type": "string" },
|
|
19
|
+
"postalCode": { "type": "string" },
|
|
20
|
+
"country": { "type": "string" }
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
"hours": { "type": "string" },
|
|
24
|
+
"mapEmbedUrl": { "type": "string", "format": "uri" },
|
|
25
|
+
"social": {
|
|
26
|
+
"type": "object",
|
|
27
|
+
"additionalProperties": false,
|
|
28
|
+
"properties": {
|
|
29
|
+
"instagram": { "type": "string" },
|
|
30
|
+
"facebook": { "type": "string" }
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
"seo": {
|
|
34
|
+
"type": "object",
|
|
35
|
+
"additionalProperties": false,
|
|
36
|
+
"properties": {
|
|
37
|
+
"title": { "type": "string" },
|
|
38
|
+
"description": { "type": "string" },
|
|
39
|
+
"titleTemplate": { "type": "string" },
|
|
40
|
+
"ogImage": { "type": "string" },
|
|
41
|
+
"twitterCard": {
|
|
42
|
+
"type": "string",
|
|
43
|
+
"enum": ["summary", "summary_large_image"]
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
},
|
|
47
|
+
"theme": {
|
|
48
|
+
"type": "object",
|
|
49
|
+
"additionalProperties": false,
|
|
50
|
+
"properties": {
|
|
51
|
+
"darkCanvas": {
|
|
52
|
+
"type": "string",
|
|
53
|
+
"enum": ["gray", "black"],
|
|
54
|
+
"description": "Dark mode canvas — gray (default base) or pure black. Overrides palette.ts when set."
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
},
|
|
58
|
+
"landing": {
|
|
59
|
+
"type": "object",
|
|
60
|
+
"additionalProperties": false,
|
|
61
|
+
"properties": {
|
|
62
|
+
"sections": {
|
|
63
|
+
"type": "array",
|
|
64
|
+
"description": "Ordered one-page landing sections (FugueContentLandingPage).",
|
|
65
|
+
"items": {
|
|
66
|
+
"type": "object",
|
|
67
|
+
"additionalProperties": false,
|
|
68
|
+
"required": ["slug", "anchor"],
|
|
69
|
+
"properties": {
|
|
70
|
+
"slug": {
|
|
71
|
+
"type": "string",
|
|
72
|
+
"description": "Fragment file stem when component is FugueContentFragment."
|
|
73
|
+
},
|
|
74
|
+
"anchor": {
|
|
75
|
+
"type": "string",
|
|
76
|
+
"description": "HTML section id for hash navigation."
|
|
77
|
+
},
|
|
78
|
+
"component": {
|
|
79
|
+
"oneOf": [
|
|
80
|
+
{
|
|
81
|
+
"type": "string",
|
|
82
|
+
"default": "FugueContentFragment",
|
|
83
|
+
"description": "Vue component name shorthand (default FugueContentFragment)."
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
"type": "object",
|
|
87
|
+
"additionalProperties": false,
|
|
88
|
+
"required": ["name"],
|
|
89
|
+
"properties": {
|
|
90
|
+
"name": {
|
|
91
|
+
"type": "string",
|
|
92
|
+
"description": "Vue component name."
|
|
93
|
+
},
|
|
94
|
+
"props": {
|
|
95
|
+
"type": "object",
|
|
96
|
+
"description": "Props passed to the component. LandingHeroMedia: src, alt, optional contentComponent, slug, mobileHeight, desktopMinHeight, objectFit."
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
]
|
|
101
|
+
},
|
|
102
|
+
"sectionClass": {
|
|
103
|
+
"type": "string",
|
|
104
|
+
"description": "Optional wrapper section base class — overrides FugueContentLandingPage sectionClass for this row."
|
|
105
|
+
},
|
|
106
|
+
"variant": {
|
|
107
|
+
"type": "string",
|
|
108
|
+
"description": "Layout variant suffix, e.g. alt → {sectionClass}--alt."
|
|
109
|
+
},
|
|
110
|
+
"nav": {
|
|
111
|
+
"type": "object",
|
|
112
|
+
"additionalProperties": false,
|
|
113
|
+
"properties": {
|
|
114
|
+
"labelKey": { "type": "string" },
|
|
115
|
+
"label": { "type": "string" },
|
|
116
|
+
"icon": { "type": "string" },
|
|
117
|
+
"id": { "type": "string" },
|
|
118
|
+
"to": { "type": "string" }
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { defineEventHandler, getCookie, getQuery, getRequestURL, sendRedirect } from 'h3'
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Nuxt Studio's /_studio admin route redirects to OAuth without setting `studio-redirect`
|
|
5
|
+
* when only one provider is configured. After Google auth, users land on `/` with no editor.
|
|
6
|
+
*
|
|
7
|
+
* @see https://github.com/nuxt-content/nuxt-studio — admin.js + google.get.js
|
|
8
|
+
*/
|
|
9
|
+
export default defineEventHandler((event) => {
|
|
10
|
+
const studioRoute = useRuntimeConfig(event).public.studio?.route ?? '/_studio'
|
|
11
|
+
const { pathname } = getRequestURL(event)
|
|
12
|
+
|
|
13
|
+
if (pathname !== studioRoute)
|
|
14
|
+
return
|
|
15
|
+
|
|
16
|
+
const query = getQuery(event)
|
|
17
|
+
const postAuthPath = typeof query.redirect === 'string' && query.redirect.startsWith('/')
|
|
18
|
+
? query.redirect
|
|
19
|
+
: '/'
|
|
20
|
+
|
|
21
|
+
// Local `nuxt dev`: Studio opens via ⌘. / Ctrl+. — /_studio redirects home in dev.
|
|
22
|
+
if (import.meta.dev)
|
|
23
|
+
return sendRedirect(event, postAuthPath, 302)
|
|
24
|
+
|
|
25
|
+
// Production: /_studio is the Google OAuth entry (/login redirects here).
|
|
26
|
+
// Peek-gated sites redirect unauthenticated users to /login first.
|
|
27
|
+
if (getCookie(event, 'studio-session-check') === 'true')
|
|
28
|
+
return sendRedirect(event, postAuthPath, 302)
|
|
29
|
+
|
|
30
|
+
if (query.redirect)
|
|
31
|
+
return
|
|
32
|
+
|
|
33
|
+
const target = `${studioRoute}?redirect=${encodeURIComponent('/')}`
|
|
34
|
+
|
|
35
|
+
return sendRedirect(event, target, 302)
|
|
36
|
+
})
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import process from 'node:process'
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Clear operator error when Studio OAuth env vars are missing on `/_studio`.
|
|
5
|
+
* Without this, nuxt-studio's admin route returns an opaque 404.
|
|
6
|
+
*/
|
|
7
|
+
export default defineEventHandler((event) => {
|
|
8
|
+
const runtimeConfig = useRuntimeConfig(event)
|
|
9
|
+
const studioRoute = runtimeConfig.public.studio?.route ?? '/_studio'
|
|
10
|
+
const { pathname } = getRequestURL(event)
|
|
11
|
+
|
|
12
|
+
if (pathname !== studioRoute)
|
|
13
|
+
return
|
|
14
|
+
|
|
15
|
+
const providers = [
|
|
16
|
+
process.env.STUDIO_GITHUB_CLIENT_ID && 'GitHub',
|
|
17
|
+
process.env.STUDIO_GITLAB_APPLICATION_ID && 'GitLab',
|
|
18
|
+
process.env.STUDIO_GOOGLE_CLIENT_ID && 'Google',
|
|
19
|
+
process.env.STUDIO_SSO_URL
|
|
20
|
+
&& process.env.STUDIO_SSO_CLIENT_ID
|
|
21
|
+
&& process.env.STUDIO_SSO_CLIENT_SECRET
|
|
22
|
+
&& 'SSO'
|
|
23
|
+
].filter(Boolean)
|
|
24
|
+
|
|
25
|
+
if (providers.length > 0)
|
|
26
|
+
return
|
|
27
|
+
|
|
28
|
+
const authMode = runtimeConfig.public.fugueContent?.authMode ?? 'off'
|
|
29
|
+
const afterSetup = authMode === 'peek'
|
|
30
|
+
? 'After that, sign in at <code>/login</code> and use the footer <strong>Edit</strong> button.'
|
|
31
|
+
: 'After that, use the footer <strong>Edit</strong> button to sign in with Google.'
|
|
32
|
+
|
|
33
|
+
setResponseStatus(event, 503, 'Studio OAuth not configured')
|
|
34
|
+
setResponseHeader(event, 'content-type', 'text/html; charset=utf-8')
|
|
35
|
+
|
|
36
|
+
return `<!DOCTYPE html>
|
|
37
|
+
<html lang="en">
|
|
38
|
+
<head>
|
|
39
|
+
<meta charset="utf-8">
|
|
40
|
+
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
41
|
+
<title>Studio Not Configured</title>
|
|
42
|
+
<style>
|
|
43
|
+
body { font-family: system-ui, sans-serif; max-width: 40rem; margin: 3rem auto; padding: 0 1rem; line-height: 1.5; }
|
|
44
|
+
h1 { font-size: 1.25rem; }
|
|
45
|
+
code { background: #f4f4f5; padding: 0.1em 0.35em; border-radius: 4px; }
|
|
46
|
+
</style>
|
|
47
|
+
</head>
|
|
48
|
+
<body>
|
|
49
|
+
<h1>Studio OAuth Is Not Configured</h1>
|
|
50
|
+
<p>
|
|
51
|
+
This deploy is missing Studio editor credentials.
|
|
52
|
+
Set <code>STUDIO_GOOGLE_CLIENT_ID</code>, <code>STUDIO_GOOGLE_CLIENT_SECRET</code>,
|
|
53
|
+
and <code>STUDIO_GOOGLE_MODERATORS</code> on <strong>Netlify Functions</strong>
|
|
54
|
+
(plus <code>STUDIO_GITHUB_TOKEN</code> for publish), then redeploy.
|
|
55
|
+
</p>
|
|
56
|
+
<p>${afterSetup}</p>
|
|
57
|
+
</body>
|
|
58
|
+
</html>`
|
|
59
|
+
})
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
const CLEANUP_SCRIPT = '<script>if(location.hash===\'#_studio_scan\')history.replaceState(history.state,\'\',location.pathname+location.search)</script>'
|
|
2
|
+
|
|
3
|
+
export default defineNitroPlugin((nitroApp) => {
|
|
4
|
+
nitroApp.hooks.hook('render:html', (html) => {
|
|
5
|
+
// bodyPrepend runs before #__nuxt — must execute before Vue hydrates.
|
|
6
|
+
html.bodyPrepend.unshift(CLEANUP_SCRIPT)
|
|
7
|
+
})
|
|
8
|
+
})
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "ESNext",
|
|
4
|
+
"module": "ESNext",
|
|
5
|
+
"moduleResolution": "bundler",
|
|
6
|
+
"resolveJsonModule": true,
|
|
7
|
+
"types": ["node"],
|
|
8
|
+
"strict": true,
|
|
9
|
+
"noEmit": true,
|
|
10
|
+
"isolatedModules": true,
|
|
11
|
+
"skipLibCheck": true
|
|
12
|
+
},
|
|
13
|
+
"include": [
|
|
14
|
+
"content.config.ts",
|
|
15
|
+
"lib/**/*.ts",
|
|
16
|
+
"types/**/*.d.ts",
|
|
17
|
+
"types/**/*.ts"
|
|
18
|
+
],
|
|
19
|
+
"exclude": [
|
|
20
|
+
"**/*.test.ts"
|
|
21
|
+
]
|
|
22
|
+
}
|
package/tsconfig.json
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
{
|
|
2
|
+
"references": [
|
|
3
|
+
{
|
|
4
|
+
"path": "./.nuxt/tsconfig.app.json"
|
|
5
|
+
},
|
|
6
|
+
{
|
|
7
|
+
"path": "./.nuxt/tsconfig.server.json"
|
|
8
|
+
},
|
|
9
|
+
{
|
|
10
|
+
"path": "./.nuxt/tsconfig.shared.json"
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
"path": "./.nuxt/tsconfig.node.json"
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
"path": "./tsconfig.build.json"
|
|
17
|
+
}
|
|
18
|
+
],
|
|
19
|
+
"files": []
|
|
20
|
+
}
|
package/types/site.ts
ADDED
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import type { FugueSimpleAuthMode } from '@altafusion/fugue-simple-auth/types/config'
|
|
2
|
+
|
|
3
|
+
export type FugueContentStudioEditorProvider = 'google' | 'github' | 'both'
|
|
4
|
+
|
|
5
|
+
export interface FugueContentSiteStudioRepository {
|
|
6
|
+
provider?: 'github' | 'gitlab'
|
|
7
|
+
owner: string
|
|
8
|
+
repo: string
|
|
9
|
+
branch?: string
|
|
10
|
+
/** Monorepo subdirectory — e.g. `templates/fugue-content-site` or `apps/my-site` */
|
|
11
|
+
rootDir?: string
|
|
12
|
+
private?: boolean
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export interface FugueContentSiteStudioEditors {
|
|
16
|
+
/**
|
|
17
|
+
* Preferred Studio login for content editors.
|
|
18
|
+
* Wired via Nuxt Studio env vars — not a runtime module option.
|
|
19
|
+
*/
|
|
20
|
+
provider?: FugueContentStudioEditorProvider
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export interface FugueContentSiteStudioConfig {
|
|
24
|
+
route?: string
|
|
25
|
+
repository: FugueContentSiteStudioRepository
|
|
26
|
+
editors?: FugueContentSiteStudioEditors
|
|
27
|
+
git?: {
|
|
28
|
+
commit?: {
|
|
29
|
+
messagePrefix?: string
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Site auth strategy — resolved at build into `runtimeConfig.public.fugueContent.authMode`.
|
|
36
|
+
*
|
|
37
|
+
* - **`studio`** — Google OAuth via `STUDIO_GOOGLE_*` only; ignores peek env.
|
|
38
|
+
* - **`peek`** — `SITE_ACCESS_KEY` gate via fugue-simple-auth.
|
|
39
|
+
* - **`auto`** (default) — Studio Google env wins over peek when both are set.
|
|
40
|
+
* - **`off`** — no read gate; Studio OAuth only when env is configured.
|
|
41
|
+
*/
|
|
42
|
+
export type FugueContentSiteAuthMode = 'studio' | 'peek' | 'auto' | 'off'
|
|
43
|
+
|
|
44
|
+
export interface FugueContentSiteAuthConfig {
|
|
45
|
+
/** Env prefix — defaults to `SITE` → `SITE_ACCESS_KEY`, `SITE_AUTH_ENABLED` */
|
|
46
|
+
envPrefix: string
|
|
47
|
+
/** Peek gate scope — `routes` (Studio only) or `full` (whole site). Not the cms auth strategy. */
|
|
48
|
+
mode?: FugueSimpleAuthMode
|
|
49
|
+
cookieName?: string
|
|
50
|
+
sessionLabel?: string
|
|
51
|
+
loginDescription?: string
|
|
52
|
+
protectedRoutes?: string[]
|
|
53
|
+
/** Extra paths that bypass the read gate (Studio paths are added when `studio` is set) */
|
|
54
|
+
publicPrefixes?: string[]
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
export interface FugueContentSiteConfig extends Record<string, unknown> {
|
|
58
|
+
/**
|
|
59
|
+
* Auth strategy for this site — see **`FugueContentSiteAuthMode`**.
|
|
60
|
+
* Set in **`site.config.ts`** (manifest); exposed at runtime as **`fugueContent.authMode`**.
|
|
61
|
+
*/
|
|
62
|
+
authMode?: FugueContentSiteAuthMode
|
|
63
|
+
auth?: FugueContentSiteAuthConfig
|
|
64
|
+
studio?: FugueContentSiteStudioConfig
|
|
65
|
+
/**
|
|
66
|
+
* `@nuxtjs/i18n` options — when `locales` is set, fugue-content-site registers the module
|
|
67
|
+
* and builds per-locale Content collections (`pages_en`, `pages_es`, …).
|
|
68
|
+
*/
|
|
69
|
+
i18n?: Record<string, unknown> & {
|
|
70
|
+
locales?: Array<string | { code: string, name?: string, file?: string, isCatchallLocale?: boolean }>
|
|
71
|
+
defaultLocale?: string
|
|
72
|
+
langDir?: string
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Additional Nuxt layers after the default cms stack.
|
|
76
|
+
* Prefer this over `extends` in the spread rest — `defu` replaces `extends` arrays.
|
|
77
|
+
*/
|
|
78
|
+
extraExtends?: string[]
|
|
79
|
+
}
|