@ofidj/generator-fidj 1.0.4 → 1.0.6
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/generators/app/templates/typescript/server/index.ts +1 -1
- package/generators/app/templates/typescript/src/content.ts +2 -0
- package/generators/app/templates/typescript/src/main.ts +3 -0
- package/generators/app/templates/typescript/src/style.css +15 -0
- package/generators/app/templates/typescript/src/version.ts +8 -0
- package/lib/scaffold.cjs +1 -0
- package/package.json +1 -1
|
@@ -285,7 +285,7 @@ export function createApp(
|
|
|
285
285
|
"Content-Type": file[1],
|
|
286
286
|
"X-Content-Type-Options": "nosniff",
|
|
287
287
|
"Referrer-Policy": "no-referrer",
|
|
288
|
-
"Content-Security-Policy": `default-src 'self'; style-src 'self' 'unsafe-inline'; img-src 'self' https
|
|
288
|
+
"Content-Security-Policy": `default-src 'self'; style-src 'self' 'unsafe-inline'; img-src 'self' https: ${apiOrigin}; connect-src 'self' ${apiOrigin}; object-src 'none'; base-uri 'none'; frame-ancestors 'none'`,
|
|
289
289
|
});
|
|
290
290
|
res.end(req.method === "HEAD" ? undefined : content);
|
|
291
291
|
} catch (error) {
|
|
@@ -2,10 +2,12 @@ import {agreementMarkup, bindAgreement, acceptedAgreement, signInErrorMessage} f
|
|
|
2
2
|
import { FidjNodeService, FidjOidcClient } from "@ofidj/node";
|
|
3
3
|
import config from "../app.config.json";
|
|
4
4
|
import "./style.css";
|
|
5
|
+
import { showVersionBadge } from "./version";
|
|
5
6
|
|
|
6
7
|
const sdk = new FidjNodeService();
|
|
7
8
|
const oidc = config.oidcIssuer ? new FidjOidcClient({issuer: config.oidcIssuer, clientId: config.appId, redirectUri: window.location.origin + window.location.pathname, apiEndpoint: config.apiEndpoint, storage: sessionStorage}) : null;
|
|
8
9
|
const root = document.querySelector<HTMLDivElement>("#app")!;
|
|
10
|
+
showVersionBadge(config.releaseVersion);
|
|
9
11
|
const appPath = `/me/apps/${encodeURIComponent(config.appId)}`;
|
|
10
12
|
let signedIn = false;
|
|
11
13
|
let emailVerified = false;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import {agreementMarkup, bindAgreement, acceptedAgreement, signInErrorMessage} from "./service-agreement";
|
|
2
2
|
import { FidjNodeService } from "@ofidj/node";
|
|
3
3
|
import "./style.css";
|
|
4
|
+
import { showVersionBadge } from "./version";
|
|
4
5
|
|
|
5
6
|
type Session = { username: string; roles: string[] };
|
|
6
7
|
type Note = { id: string; title: string; body: string; createdAt: string };
|
|
@@ -10,6 +11,7 @@ type Settings = {
|
|
|
10
11
|
apiEndpoint: string;
|
|
11
12
|
dashboardUrl: string;
|
|
12
13
|
localDemo: boolean;
|
|
14
|
+
releaseVersion: string;
|
|
13
15
|
};
|
|
14
16
|
const root = document.querySelector<HTMLDivElement>("#app")!;
|
|
15
17
|
const sdk = new FidjNodeService();
|
|
@@ -248,6 +250,7 @@ function render() {
|
|
|
248
250
|
async function start() {
|
|
249
251
|
try {
|
|
250
252
|
settings = await (await fetch("/api/config")).json();
|
|
253
|
+
showVersionBadge(settings.releaseVersion);
|
|
251
254
|
await sdk.init(settings.appId, {
|
|
252
255
|
apiEndpoint: settings.apiEndpoint,
|
|
253
256
|
prod: !settings.localDemo,
|
|
@@ -419,6 +419,21 @@ footer {
|
|
|
419
419
|
border-top: 1px solid var(--fidj-line-soft);
|
|
420
420
|
padding: 28px 0 10px;
|
|
421
421
|
}
|
|
422
|
+
.fidj-version {
|
|
423
|
+
position: fixed;
|
|
424
|
+
right: 10px;
|
|
425
|
+
bottom: 8px;
|
|
426
|
+
z-index: 1000;
|
|
427
|
+
padding: 4px 7px;
|
|
428
|
+
border: 1px solid var(--fidj-line-soft);
|
|
429
|
+
border-radius: var(--fidj-radius);
|
|
430
|
+
background: var(--fidj-paper);
|
|
431
|
+
color: var(--fidj-text-faint);
|
|
432
|
+
font-family: var(--fidj-font-mono);
|
|
433
|
+
font-size: 10px;
|
|
434
|
+
line-height: 1;
|
|
435
|
+
opacity: 0.9;
|
|
436
|
+
}
|
|
422
437
|
|
|
423
438
|
@media (max-width: 760px) {
|
|
424
439
|
main {
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export function showVersionBadge(version: string): void {
|
|
2
|
+
if (!/^\d{2}\.\d{2}\.\d{2}$/.test(version || "")) return;
|
|
3
|
+
const badge = document.createElement("div");
|
|
4
|
+
badge.className = "fidj-version";
|
|
5
|
+
badge.setAttribute("aria-label", `App version ${version}`);
|
|
6
|
+
badge.textContent = `v${version}`;
|
|
7
|
+
document.body.append(badge);
|
|
8
|
+
}
|
package/lib/scaffold.cjs
CHANGED
|
@@ -136,6 +136,7 @@ function scaffold(destination, options) {
|
|
|
136
136
|
apiEndpoint: localApi,
|
|
137
137
|
dashboardUrl: options.local ? "http://localhost:4200" : "https://fidj.ovh",
|
|
138
138
|
title,
|
|
139
|
+
releaseVersion: new Date().toISOString().slice(2, 10).replaceAll("-", "."),
|
|
139
140
|
localDemo: Boolean(options.local),
|
|
140
141
|
allowAnonymous: anonymous === true || anonymous === "true",
|
|
141
142
|
welcome: options.welcome || title,
|