@stacksjs/defaults 0.75.14 → 0.75.16
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.
|
@@ -35,8 +35,9 @@ const head = getAnalyticsHead(analytics)
|
|
|
35
35
|
```
|
|
36
36
|
|
|
37
37
|
The registry is loud on purpose. A `driver` value with no implementation throws,
|
|
38
|
-
and so does a
|
|
39
|
-
the exact key to set).
|
|
38
|
+
and so does a selected third-party driver missing its config (the message names
|
|
39
|
+
the exact key to set). An app with no `driver` defaults to AnalyticsHQ. It emits
|
|
40
|
+
nothing until `drivers.analyticshq.siteId` is set.
|
|
40
41
|
|
|
41
42
|
Nothing injects the script for you - a framework that silently posted pageviews
|
|
42
43
|
to a third party would be the wrong default. Render it yourself in the layout
|
|
@@ -142,9 +143,9 @@ interface SelfHostedConfig {
|
|
|
142
143
|
|
|
143
144
|
```typescript
|
|
144
145
|
{
|
|
145
|
-
driver: '
|
|
146
|
+
driver: 'analyticshq', // 'analyticshq' | 'fathom' | 'plausible' | 'google-analytics' | 'self-hosted'
|
|
146
147
|
drivers: {
|
|
147
|
-
analyticshq: { siteId: '' },
|
|
148
|
+
analyticshq: { siteId: '' }, // empty means no tracking tags
|
|
148
149
|
googleAnalytics: { trackingId: '' },
|
|
149
150
|
fathom: { siteId: '' },
|
|
150
151
|
plausible: { domain: '' },
|
|
@@ -169,7 +170,8 @@ Analytics dashboard at `/dashboard/analytics` displays:
|
|
|
169
170
|
|
|
170
171
|
## Gotchas
|
|
171
172
|
- Selecting a driver does not inject anything - call `generateAnalyticsScript()` in your layout
|
|
172
|
-
- A misconfigured driver throws rather than emitting nothing; the message names the config key
|
|
173
|
+
- A misconfigured third-party driver throws rather than emitting nothing; the message names the config key
|
|
174
|
+
- AnalyticsHQ is the first-party default and emits nothing until its site id is set
|
|
173
175
|
- `honorDnt: true` respects browser Do Not Track settings
|
|
174
176
|
- Attribute values are escaped, and inline script values are JS-escaped, to prevent XSS
|
|
175
177
|
- Fathom is a paid service - self-hosted is free but requires infrastructure
|
|
@@ -75,7 +75,8 @@ The `PersonalAccessToken` model maps the same table, so `owner.with('tokenable')
|
|
|
75
75
|
lists exactly what `createToken` minted. It deliberately generates no CRUD
|
|
76
76
|
routes: minting and revoking both carry semantics a generic route does not.
|
|
77
77
|
- `Auth.once(credentials: AuthCredentials): Promise<boolean>` — one-time auth without token
|
|
78
|
-
- `Auth.
|
|
78
|
+
- `Auth.requestUserTokenWithClient(credentials, clientId, clientSecret): Promise<{ token } | null>` authenticates both a legacy OAuth client and an end user password, then issues a user token. It is not the client credentials grant.
|
|
79
|
+
- `Auth.requestToken(...)` is the deprecated compatibility alias for that same legacy exchange. New delegated integrations use the authorization-code provider.
|
|
79
80
|
|
|
80
81
|
### User State
|
|
81
82
|
- `Auth.user(): Promise<UserModel | undefined>` — get authenticated user from bearer token
|
|
@@ -155,6 +156,19 @@ routes: minting and revoking both carry semantics a generic route does not.
|
|
|
155
156
|
- `createClient(options: CreateClientOptions): Promise<CreateClientResult>`
|
|
156
157
|
- `revokeClient(clientId): Promise<void>`
|
|
157
158
|
|
|
159
|
+
### OAuth Provider and PKCE
|
|
160
|
+
|
|
161
|
+
The authorization server is opt-in through `config/auth.ts` under
|
|
162
|
+
`oauthProvider`. It is separate from social sign-in, where Stacks is the OAuth
|
|
163
|
+
client. The provider profile is Authorization Code with S256 PKCE and rotating
|
|
164
|
+
refresh tokens. It does not support implicit or password grants.
|
|
165
|
+
|
|
166
|
+
- `resolveOAuthProviderConfig(options)` returns `null` unless explicitly enabled
|
|
167
|
+
- `generatePkceVerifier()` creates a 256-bit RFC 7636 verifier
|
|
168
|
+
- `createS256CodeChallenge(verifier)` derives its S256 challenge
|
|
169
|
+
- `verifyS256CodeChallenge(verifier, challenge)` validates without a plain fallback
|
|
170
|
+
- `isValidPkceVerifier(value)` checks the required 43 to 128 character syntax
|
|
171
|
+
|
|
158
172
|
## Two-Factor Authentication (authenticator.ts)
|
|
159
173
|
|
|
160
174
|
- `generateTwoFactorSecret(): string`
|
package/ide/vscode/package.json
CHANGED
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@stacksjs/defaults",
|
|
3
3
|
"type": "module",
|
|
4
4
|
"sideEffects": false,
|
|
5
|
-
"version": "0.75.
|
|
5
|
+
"version": "0.75.16",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
8
8
|
"url": "git+https://github.com/stacksjs/stacks.git",
|
|
@@ -55,7 +55,7 @@
|
|
|
55
55
|
"dependencies": {
|
|
56
56
|
"@iconify-json/f7": "^1.2.2",
|
|
57
57
|
"@iconify-json/hugeicons": "^1.2.27",
|
|
58
|
-
"@stacksjs/mobile": "^0.75.
|
|
58
|
+
"@stacksjs/mobile": "^0.75.16",
|
|
59
59
|
"@stacksjs/sanitizer": "^0.2.113",
|
|
60
60
|
"ts-qr-codes": "^0.1.8"
|
|
61
61
|
}
|
|
@@ -8,10 +8,19 @@
|
|
|
8
8
|
*/
|
|
9
9
|
import { isLocalDeployment } from '@stacksjs/env'
|
|
10
10
|
|
|
11
|
+
/*
|
|
12
|
+
* Handed in by TestErrorAction's renderTemplate call, which spreads its
|
|
13
|
+
* `context` into the template scope - there is no `context` variable here.
|
|
14
|
+
* Undefined when the view fallback serves this file on its own. Read into a
|
|
15
|
+
* differently named list: a local `const scenarios = ...` shadows the injected
|
|
16
|
+
* one and the page lists nothing.
|
|
17
|
+
*/
|
|
18
|
+
declare const scenarios: Array<{ title: string, description: string, status: number, href: string }> | undefined
|
|
19
|
+
|
|
11
20
|
if (!isLocalDeployment())
|
|
12
21
|
notFound()
|
|
13
22
|
|
|
14
|
-
const
|
|
23
|
+
const scenarioList = typeof scenarios !== 'undefined' && Array.isArray(scenarios) ? scenarios : []
|
|
15
24
|
</script>
|
|
16
25
|
|
|
17
26
|
<div class="mx-auto px-6 py-12 max-w-3xl">
|
|
@@ -21,7 +30,7 @@ const scenarios = typeof context !== 'undefined' && Array.isArray(context?.scena
|
|
|
21
30
|
</p>
|
|
22
31
|
|
|
23
32
|
<div class="grid gap-3">
|
|
24
|
-
@foreach(
|
|
33
|
+
@foreach(scenarioList as scenario)
|
|
25
34
|
<a
|
|
26
35
|
href="{{ scenario.href }}"
|
|
27
36
|
class="block p-4 bg-white dark:bg-white/[2%] border border-neutral-200 rounded-lg dark:border-white/10 hover:border-rose-500 transition-colors"
|