@aglyn/aglyn 1.7.0 → 1.8.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/package.json +11 -11
- package/src/lib/app-utils/docs-index.generated.js +16 -16
- package/src/lib/app-utils/docs-index.generated.js.map +1 -1
- package/src/lib/app-utils/error-beacon.d.ts +25 -1
- package/src/lib/app-utils/error-beacon.js +55 -4
- package/src/lib/app-utils/error-beacon.js.map +1 -1
- package/src/lib/app-utils/foreign-script.d.ts +1 -1
- package/src/lib/app-utils/foreign-script.js +1 -1
- package/src/lib/app-utils/foreign-script.js.map +1 -1
- package/src/lib/plugin-manager/first-party-plugins.generated.d.ts +0 -6
- package/src/lib/plugin-manager/first-party-plugins.generated.js +0 -51
- package/src/lib/plugin-manager/first-party-plugins.generated.js.map +1 -1
- package/src/lib/plugin-manager/video-embed-provider.d.ts +29 -0
- package/src/lib/plugin-manager/video-embed-provider.js +26 -7
- package/src/lib/plugin-manager/video-embed-provider.js.map +1 -1
- package/src/lib/plugin-manager/video-embed-providers.generated.d.ts +11 -0
- package/src/lib/plugin-manager/video-embed-providers.generated.js +161 -0
- package/src/lib/plugin-manager/video-embed-providers.generated.js.map +1 -0
|
@@ -33,6 +33,11 @@ export type VideoEmbedPlayerOptions = Partial<Record<VideoEmbedPlayerOption, boo
|
|
|
33
33
|
* One query parameter of a player address, in the order the declaration
|
|
34
34
|
* lists them. Either `value`, sent on every address, or an `option` whose
|
|
35
35
|
* state picks `on` or `off`; a state with no value leaves the parameter out.
|
|
36
|
+
*
|
|
37
|
+
* A value may name the media id as `{id}` (AGL-4140), for a player that
|
|
38
|
+
* repeats it in its query, such as one that loops a single film only as a
|
|
39
|
+
* playlist of itself. The id has passed both patterns by then, so it
|
|
40
|
+
* carries nothing a query could be widened with.
|
|
36
41
|
*/
|
|
37
42
|
export type VideoEmbedPlayerParam = {
|
|
38
43
|
param: string;
|
|
@@ -43,6 +48,28 @@ export type VideoEmbedPlayerParam = {
|
|
|
43
48
|
on?: string;
|
|
44
49
|
off?: string;
|
|
45
50
|
};
|
|
51
|
+
/**
|
|
52
|
+
* A link shape {@link VideoEmbedProviderDeclaration.mediaIdPaths} cannot
|
|
53
|
+
* describe (AGL-4140): one that names its media id in the QUERY rather than
|
|
54
|
+
* the path (`/watch?v={id}`), or one only some of the host's domains use (a
|
|
55
|
+
* short-link domain whose whole path is the id, a shape that would misread a
|
|
56
|
+
* page on the host's main domain).
|
|
57
|
+
*/
|
|
58
|
+
export interface VideoEmbedMediaIdLink {
|
|
59
|
+
/**
|
|
60
|
+
* A regular expression over the link's PATH, anchored at both ends. Without
|
|
61
|
+
* {@link param}, its first capture group is the media id.
|
|
62
|
+
*/
|
|
63
|
+
path: string;
|
|
64
|
+
/** The query parameter that holds the media id, for a path that names none. */
|
|
65
|
+
param?: string;
|
|
66
|
+
/**
|
|
67
|
+
* The declared domains this shape is read on, each matched as
|
|
68
|
+
* {@link VideoEmbedProviderDeclaration.domains} are; every declared domain
|
|
69
|
+
* when absent.
|
|
70
|
+
*/
|
|
71
|
+
domains?: readonly string[];
|
|
72
|
+
}
|
|
46
73
|
export interface VideoEmbedProviderDeclaration {
|
|
47
74
|
/** Stable id, unique across plugins. */
|
|
48
75
|
id: string;
|
|
@@ -59,6 +86,8 @@ export interface VideoEmbedProviderDeclaration {
|
|
|
59
86
|
* against {@link domains}.
|
|
60
87
|
*/
|
|
61
88
|
mediaIdPaths: readonly string[];
|
|
89
|
+
/** The link shapes the paths cannot describe, tried after them. */
|
|
90
|
+
mediaIdLinks?: readonly VideoEmbedMediaIdLink[];
|
|
62
91
|
/** A regular expression, anchored at both ends, a media id must match. */
|
|
63
92
|
mediaIdPattern: string;
|
|
64
93
|
/** The one origin the host's player is framed from. */
|
|
@@ -65,7 +65,7 @@
|
|
|
65
65
|
* any other link is. Removing a declaration therefore turns its links back
|
|
66
66
|
* into plain URLs, which play nothing — so the declaring plugin's spec holds
|
|
67
67
|
* the declaration to the links it must keep reading.
|
|
68
|
-
*/ import { FIRST_PARTY_VIDEO_EMBED_PROVIDERS } from "./
|
|
68
|
+
*/ import { FIRST_PARTY_VIDEO_EMBED_PROVIDERS } from "./video-embed-providers.generated.js";
|
|
69
69
|
export const VIDEO_EMBED_PLAYER_OPTIONS = [
|
|
70
70
|
'autoPlay',
|
|
71
71
|
'doNotTrack',
|
|
@@ -84,14 +84,27 @@ const compiled = new WeakMap();
|
|
|
84
84
|
function compile(provider) {
|
|
85
85
|
let answer = compiled.get(provider);
|
|
86
86
|
if (!answer) {
|
|
87
|
+
var _provider_mediaIdLinks;
|
|
87
88
|
answer = {
|
|
88
89
|
paths: provider.mediaIdPaths.map((source)=>new RegExp(source)),
|
|
90
|
+
links: ((_provider_mediaIdLinks = provider.mediaIdLinks) != null ? _provider_mediaIdLinks : []).map((link)=>({
|
|
91
|
+
path: new RegExp(link.path),
|
|
92
|
+
param: link.param,
|
|
93
|
+
domains: link.domains
|
|
94
|
+
})),
|
|
89
95
|
mediaId: new RegExp(provider.mediaIdPattern)
|
|
90
96
|
};
|
|
91
97
|
compiled.set(provider, answer);
|
|
92
98
|
}
|
|
93
99
|
return answer;
|
|
94
100
|
}
|
|
101
|
+
/** The media id a link shape reads from this URL, unchecked. */ function linkMediaId(link, url) {
|
|
102
|
+
var _url_searchParams_get;
|
|
103
|
+
if (link.domains && !onDomain(url.hostname, link.domains)) return undefined;
|
|
104
|
+
const match = link.path.exec(url.pathname);
|
|
105
|
+
if (!match) return undefined;
|
|
106
|
+
return link.param ? (_url_searchParams_get = url.searchParams.get(link.param)) != null ? _url_searchParams_get : undefined : match[1];
|
|
107
|
+
}
|
|
95
108
|
function onDomain(hostname, domains) {
|
|
96
109
|
return domains.some((domain)=>hostname === domain || hostname.endsWith(`.${domain}`));
|
|
97
110
|
}
|
|
@@ -110,10 +123,15 @@ function onDomain(hostname, domains) {
|
|
|
110
123
|
if (url.protocol !== 'https:' && url.protocol !== 'http:') return undefined;
|
|
111
124
|
for (const provider of providers){
|
|
112
125
|
if (!onDomain(url.hostname, provider.domains)) continue;
|
|
113
|
-
const { paths, mediaId } = compile(provider);
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
126
|
+
const { paths, links, mediaId } = compile(provider);
|
|
127
|
+
const candidates = [
|
|
128
|
+
...paths.map((pattern)=>{
|
|
129
|
+
var _pattern_exec;
|
|
130
|
+
return (_pattern_exec = pattern.exec(url.pathname)) == null ? void 0 : _pattern_exec[1];
|
|
131
|
+
}),
|
|
132
|
+
...links.map((link)=>linkMediaId(link, url))
|
|
133
|
+
];
|
|
134
|
+
for (const id of candidates){
|
|
117
135
|
if (id && mediaId.test(id) && SAFE_MEDIA_ID.test(id)) {
|
|
118
136
|
return {
|
|
119
137
|
provider,
|
|
@@ -138,14 +156,15 @@ function onDomain(hostname, domains) {
|
|
|
138
156
|
const embed = videoEmbedOf(value, providers);
|
|
139
157
|
if (!embed) return undefined;
|
|
140
158
|
const params = new URLSearchParams();
|
|
159
|
+
const withId = (value)=>value.split(ID_PLACEHOLDER).join(embed.mediaId);
|
|
141
160
|
for (const entry of (_embed_provider_playerQuery = embed.provider.playerQuery) != null ? _embed_provider_playerQuery : []){
|
|
142
161
|
if ('value' in entry) {
|
|
143
|
-
params.set(entry.param, entry.value);
|
|
162
|
+
params.set(entry.param, withId(entry.value));
|
|
144
163
|
continue;
|
|
145
164
|
}
|
|
146
165
|
const on = entry.option === 'autoPlay' ? options.autoPlay !== false : Boolean(options[entry.option]);
|
|
147
166
|
const sent = on ? entry.on : entry.off;
|
|
148
|
-
if (sent !== undefined) params.set(entry.param, sent);
|
|
167
|
+
if (sent !== undefined) params.set(entry.param, withId(sent));
|
|
149
168
|
}
|
|
150
169
|
const query = params.toString();
|
|
151
170
|
return query ? `${embed.embedUrl}?${query}` : embed.embedUrl;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../libs/aglyn/src/lib/plugin-manager/video-embed-provider.ts"],"sourcesContent":["/**\n * @license\n * Copyright 2026 Aglyn LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/**\n * A VIDEO HOST WHOSE OWN PLAYER A VIDEO PLAYS IN (AGL-3080).\n *\n * Some video hosts hand an author a link to a page, not to a file: the film\n * plays only inside the host's player, framed from the host's origin. The\n * Video element recognizes such a link, keeps only the media id it names,\n * and frames the host's player for it. Core never names a host. A plugin\n * DECLARES one — the domains its links live on, where in the path the media\n * id sits, the one origin its player is framed from, and the query that\n * player reads — and core's resolvers answer from the declarations alone.\n *\n * This sits beside `media-delivery-provider.ts` and is not that seam. A\n * delivery provider is where the platform serves ITS OWN copy of a file\n * from; an embed provider is a host whose player the author chose, which the\n * platform never serves a byte of.\n *\n * ## Only the media id survives\n *\n * The string an author pasted never reaches a frame. {@link videoEmbedOf}\n * reads the media id out of it, and every address below is rebuilt from the\n * declaration and that id alone, so a declared player is framed from its\n * declared origin and nowhere else. That closed set is what lets a published\n * page's `frame-src` name the origin for every site\n * ({@link videoEmbedPlayerOrigins}). The id must match the declaration's own\n * pattern AND {@link SAFE_MEDIA_ID}, so no declaration can widen the path it\n * is put into.\n *\n * ## Compiled, and deliberately without a runtime registrar\n *\n * The readers are the published page and its policy: the Video element that\n * plays the link, the `VideoObject` a crawler reads, the built-in entry page\n * that decides whether a featured film can play, and the tenant middleware\n * whose `frame-src` must admit the player. None of them loads a plugin's\n * console code, and the middleware loads no plugin at all. A registry one of\n * them had not filled would render a customer's link as a `<video>` pointed\n * at an HTML page, or refuse the frame, and nothing would go red — the\n * AGL-3025 shape, on the customer's own film. So a first-party plugin\n * declares its hosts under `videoEmbedProviders` in `plugins.config.json`,\n * `tools/scripts/generate-plugin-manifests.mjs` validates and compiles them,\n * and this module reads the compiled list.\n *\n * A marketplace plugin cannot add a host this way, and that is the point\n * rather than a gap: a declaration widens every published page's\n * `frame-src`, which is a platform decision, not one a plugin's own code\n * makes at runtime.\n *\n * ## What \"absent\" means\n *\n * A link no declaration recognizes is an ordinary URL, rendered exactly as\n * any other link is. Removing a declaration therefore turns its links back\n * into plain URLs, which play nothing — so the declaring plugin's spec holds\n * the declaration to the links it must keep reading.\n */\n\nimport { FIRST_PARTY_VIDEO_EMBED_PROVIDERS } from './first-party-plugins.generated'\n\n/**\n * A choice the Video element makes for each player it frames. A declaration\n * says how its player spells each one it supports; one it does not name is\n * never sent.\n *\n * - `autoPlay` — start as soon as the player is ready. ON unless the caller\n * passes exactly `false`: the usual frame is the one a visitor's press\n * loads, and a second play button inside it would ask them twice.\n * - `doNotTrack` — ask the host not to record the viewing session.\n * - `muted` — start without sound.\n * - `loop` — restart at the end.\n */\nexport type VideoEmbedPlayerOption = 'autoPlay' | 'doNotTrack' | 'muted' | 'loop'\n\nexport const VIDEO_EMBED_PLAYER_OPTIONS: readonly VideoEmbedPlayerOption[] = [\n 'autoPlay',\n 'doNotTrack',\n 'muted',\n 'loop',\n]\n\nexport type VideoEmbedPlayerOptions = Partial<\n Record<VideoEmbedPlayerOption, boolean>\n>\n\n/**\n * One query parameter of a player address, in the order the declaration\n * lists them. Either `value`, sent on every address, or an `option` whose\n * state picks `on` or `off`; a state with no value leaves the parameter out.\n */\nexport type VideoEmbedPlayerParam =\n | { param: string; value: string }\n | {\n param: string\n option: VideoEmbedPlayerOption\n on?: string\n off?: string\n }\n\nexport interface VideoEmbedProviderDeclaration {\n /** Stable id, unique across plugins. */\n id: string\n /** The host's name as an author knows it, for labels and help text. */\n label: string\n /**\n * The domains a link's host must equal or end in (after a dot). Exact or\n * dot-anchored only, so a domain that merely contains one is refused.\n */\n domains: readonly string[]\n /**\n * Regular expressions over a link's PATH, anchored at both ends, whose\n * first capture group is the media id. The host is checked separately,\n * against {@link domains}.\n */\n mediaIdPaths: readonly string[]\n /** A regular expression, anchored at both ends, a media id must match. */\n mediaIdPattern: string\n /** The one origin the host's player is framed from. */\n playerOrigin: string\n /** The player page's path on {@link playerOrigin}; `{id}` is the media id. */\n playerPath: string\n /** The query every player address carries, in this order. */\n playerQuery?: readonly VideoEmbedPlayerParam[]\n}\n\n/** A declaration, with the plugin that made it. */\nexport interface ResolvedVideoEmbedProvider\n extends VideoEmbedProviderDeclaration {\n pluginId: string\n}\n\n/** A link a declared host recognized. */\nexport interface VideoEmbed {\n provider: ResolvedVideoEmbedProvider\n /** The media id the link named, and nothing else of it. */\n mediaId: string\n /**\n * The player page with no per-visit options — what a `VideoObject`\n * publishes as `embedUrl`.\n */\n embedUrl: string\n}\n\n/**\n * The floor every media id stands on, whatever a declaration's own pattern\n * admits: no separator, dot, query or fragment can reach the player path.\n */\nconst SAFE_MEDIA_ID = /^[A-Za-z0-9_-]{1,64}$/\n\n/** The placeholder a `playerPath` names the media id with. */\nconst ID_PLACEHOLDER = '{id}'\n\n/** Every host a first-party plugin declares. */\nexport function videoEmbedProviders(): readonly ResolvedVideoEmbedProvider[] {\n return FIRST_PARTY_VIDEO_EMBED_PROVIDERS\n}\n\ninterface CompiledProvider {\n paths: RegExp[]\n mediaId: RegExp\n}\n\nconst compiled = new WeakMap<VideoEmbedProviderDeclaration, CompiledProvider>()\n\nfunction compile(provider: VideoEmbedProviderDeclaration): CompiledProvider {\n let answer = compiled.get(provider)\n if (!answer) {\n answer = {\n paths: provider.mediaIdPaths.map((source) => new RegExp(source)),\n mediaId: new RegExp(provider.mediaIdPattern),\n }\n compiled.set(provider, answer)\n }\n return answer\n}\n\nfunction onDomain(hostname: string, domains: readonly string[]): boolean {\n return domains.some(\n (domain) => hostname === domain || hostname.endsWith(`.${domain}`),\n )\n}\n\n/**\n * The declared host a link belongs to, with the media id it names, or\n * `undefined` for anything else: a value that is not an http(s) URL, a host\n * nothing declares, or a path that names no id the host's pattern accepts.\n */\nexport function videoEmbedOf(\n value: unknown,\n providers: readonly ResolvedVideoEmbedProvider[] = videoEmbedProviders(),\n): VideoEmbed | undefined {\n if (typeof value !== 'string' || !providers.length) return undefined\n let url: URL\n try {\n url = new URL(value.trim())\n } catch {\n return undefined\n }\n if (url.protocol !== 'https:' && url.protocol !== 'http:') return undefined\n for (const provider of providers) {\n if (!onDomain(url.hostname, provider.domains)) continue\n const { paths, mediaId } = compile(provider)\n for (const pattern of paths) {\n const id = pattern.exec(url.pathname)?.[1]\n if (id && mediaId.test(id) && SAFE_MEDIA_ID.test(id)) {\n return {\n provider,\n mediaId: id,\n embedUrl: `${provider.playerOrigin}${provider.playerPath.replace(ID_PLACEHOLDER, id)}`,\n }\n }\n }\n }\n return undefined\n}\n\n/** The player page for a declared host's link, with no per-visit options. */\nexport function videoEmbedUrl(\n value: unknown,\n providers?: readonly ResolvedVideoEmbedProvider[],\n): string | undefined {\n return videoEmbedOf(value, providers)?.embedUrl\n}\n\n/**\n * The address of a declared host's player frame for this visit, carrying the\n * declaration's query in its own order. See {@link VideoEmbedPlayerOption}\n * for what each option means and which way it defaults.\n */\nexport function videoEmbedPlayerSrc(\n value: unknown,\n options: VideoEmbedPlayerOptions = {},\n providers?: readonly ResolvedVideoEmbedProvider[],\n): string | undefined {\n const embed = videoEmbedOf(value, providers)\n if (!embed) return undefined\n const params = new URLSearchParams()\n for (const entry of embed.provider.playerQuery ?? []) {\n if ('value' in entry) {\n params.set(entry.param, entry.value)\n continue\n }\n const on =\n entry.option === 'autoPlay'\n ? options.autoPlay !== false\n : Boolean(options[entry.option])\n const sent = on ? entry.on : entry.off\n if (sent !== undefined) params.set(entry.param, sent)\n }\n const query = params.toString()\n return query ? `${embed.embedUrl}?${query}` : embed.embedUrl\n}\n\n/**\n * Every origin a declared player is framed from: what a published page's\n * `frame-src` admits for the Video element.\n */\nexport function videoEmbedPlayerOrigins(\n providers: readonly ResolvedVideoEmbedProvider[] = videoEmbedProviders(),\n): string[] {\n return [...new Set(providers.map((provider) => provider.playerOrigin))]\n}\n\n/** The declared hosts' names, as an author knows them. */\nexport function videoEmbedProviderLabels(\n providers: readonly ResolvedVideoEmbedProvider[] = videoEmbedProviders(),\n): string[] {\n return providers.map((provider) => provider.label)\n}\n"],"names":["FIRST_PARTY_VIDEO_EMBED_PROVIDERS","VIDEO_EMBED_PLAYER_OPTIONS","SAFE_MEDIA_ID","ID_PLACEHOLDER","videoEmbedProviders","compiled","WeakMap","compile","provider","answer","get","paths","mediaIdPaths","map","source","RegExp","mediaId","mediaIdPattern","set","onDomain","hostname","domains","some","domain","endsWith","videoEmbedOf","value","providers","length","undefined","url","URL","trim","protocol","pattern","id","exec","pathname","test","embedUrl","playerOrigin","playerPath","replace","videoEmbedUrl","videoEmbedPlayerSrc","options","embed","params","URLSearchParams","entry","playerQuery","param","on","option","autoPlay","Boolean","sent","off","query","toString","videoEmbedPlayerOrigins","Set","videoEmbedProviderLabels","label"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC,GAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAoDC,GAED,SAASA,iCAAiC,QAAQ,qCAAiC;AAgBnF,OAAO,MAAMC,6BAAgE;IAC3E;IACA;IACA;IACA;CACD,CAAA;AAgED;;;CAGC,GACD,MAAMC,gBAAgB;AAEtB,4DAA4D,GAC5D,MAAMC,iBAAiB;AAEvB,8CAA8C,GAC9C,OAAO,SAASC;IACd,OAAOJ;AACT;AAOA,MAAMK,WAAW,IAAIC;AAErB,SAASC,QAAQC,QAAuC;IACtD,IAAIC,SAASJ,SAASK,GAAG,CAACF;IAC1B,IAAI,CAACC,QAAQ;QACXA,SAAS;YACPE,OAAOH,SAASI,YAAY,CAACC,GAAG,CAAC,CAACC,SAAW,IAAIC,OAAOD;YACxDE,SAAS,IAAID,OAAOP,SAASS,cAAc;QAC7C;QACAZ,SAASa,GAAG,CAACV,UAAUC;IACzB;IACA,OAAOA;A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K7BmB;IAHpB,MAAMA,QAAQrB,aAAaC,OAAOC;IAClC,IAAI,CAACmB,OAAO,OAAOjB;IACnB,MAAMkB,SAAS,IAAIC;IACnB,KAAK,MAAMC,UAASH,8BAAAA,MAAMtC,QAAQ,CAAC0C,WAAW,YAA1BJ,8BAA8B,EAAE,CAAE;QACpD,IAAI,WAAWG,OAAO;YACpBF,OAAO7B,GAAG,CAAC+B,MAAME,KAAK,EAAEF,MAAMvB,KAAK;YACnC;QACF;QACA,MAAM0B,KACJH,MAAMI,MAAM,KAAK,aACbR,QAAQS,QAAQ,KAAK,QACrBC,QAAQV,OAAO,CAACI,MAAMI,MAAM,CAAC;QACnC,MAAMG,OAAOJ,KAAKH,MAAMG,EAAE,GAAGH,MAAMQ,GAAG;QACtC,IAAID,SAAS3B,WAAWkB,OAAO7B,GAAG,CAAC+B,MAAME,KAAK,EAAEK;IAClD;IACA,MAAME,QAAQX,OAAOY,QAAQ;IAC7B,OAAOD,QAAQ,GAAGZ,MAAMP,QAAQ,CAAC,CAAC,EAAEmB,OAAO,GAAGZ,MAAMP,QAAQ;AAC9D;AAEA;;;CAGC,GACD,OAAO,SAASqB,wBACdjC,YAAmDvB,qBAAqB;IAExE,OAAO;WAAI,IAAIyD,IAAIlC,UAAUd,GAAG,CAAC,CAACL,WAAaA,SAASgC,YAAY;KAAG;AACzE;AAEA,wDAAwD,GACxD,OAAO,SAASsB,yBACdnC,YAAmDvB,qBAAqB;IAExE,OAAOuB,UAAUd,GAAG,CAAC,CAACL,WAAaA,SAASuD,KAAK;AACnD"}
|
|
1
|
+
{"version":3,"sources":["../../../../../../libs/aglyn/src/lib/plugin-manager/video-embed-provider.ts"],"sourcesContent":["/**\n * @license\n * Copyright 2026 Aglyn LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/**\n * A VIDEO HOST WHOSE OWN PLAYER A VIDEO PLAYS IN (AGL-3080).\n *\n * Some video hosts hand an author a link to a page, not to a file: the film\n * plays only inside the host's player, framed from the host's origin. The\n * Video element recognizes such a link, keeps only the media id it names,\n * and frames the host's player for it. Core never names a host. A plugin\n * DECLARES one — the domains its links live on, where in the path the media\n * id sits, the one origin its player is framed from, and the query that\n * player reads — and core's resolvers answer from the declarations alone.\n *\n * This sits beside `media-delivery-provider.ts` and is not that seam. A\n * delivery provider is where the platform serves ITS OWN copy of a file\n * from; an embed provider is a host whose player the author chose, which the\n * platform never serves a byte of.\n *\n * ## Only the media id survives\n *\n * The string an author pasted never reaches a frame. {@link videoEmbedOf}\n * reads the media id out of it, and every address below is rebuilt from the\n * declaration and that id alone, so a declared player is framed from its\n * declared origin and nowhere else. That closed set is what lets a published\n * page's `frame-src` name the origin for every site\n * ({@link videoEmbedPlayerOrigins}). The id must match the declaration's own\n * pattern AND {@link SAFE_MEDIA_ID}, so no declaration can widen the path it\n * is put into.\n *\n * ## Compiled, and deliberately without a runtime registrar\n *\n * The readers are the published page and its policy: the Video element that\n * plays the link, the `VideoObject` a crawler reads, the built-in entry page\n * that decides whether a featured film can play, and the tenant middleware\n * whose `frame-src` must admit the player. None of them loads a plugin's\n * console code, and the middleware loads no plugin at all. A registry one of\n * them had not filled would render a customer's link as a `<video>` pointed\n * at an HTML page, or refuse the frame, and nothing would go red — the\n * AGL-3025 shape, on the customer's own film. So a first-party plugin\n * declares its hosts under `videoEmbedProviders` in `plugins.config.json`,\n * `tools/scripts/generate-plugin-manifests.mjs` validates and compiles them,\n * and this module reads the compiled list.\n *\n * A marketplace plugin cannot add a host this way, and that is the point\n * rather than a gap: a declaration widens every published page's\n * `frame-src`, which is a platform decision, not one a plugin's own code\n * makes at runtime.\n *\n * ## What \"absent\" means\n *\n * A link no declaration recognizes is an ordinary URL, rendered exactly as\n * any other link is. Removing a declaration therefore turns its links back\n * into plain URLs, which play nothing — so the declaring plugin's spec holds\n * the declaration to the links it must keep reading.\n */\n\nimport { FIRST_PARTY_VIDEO_EMBED_PROVIDERS } from './video-embed-providers.generated'\n\n/**\n * A choice the Video element makes for each player it frames. A declaration\n * says how its player spells each one it supports; one it does not name is\n * never sent.\n *\n * - `autoPlay` — start as soon as the player is ready. ON unless the caller\n * passes exactly `false`: the usual frame is the one a visitor's press\n * loads, and a second play button inside it would ask them twice.\n * - `doNotTrack` — ask the host not to record the viewing session.\n * - `muted` — start without sound.\n * - `loop` — restart at the end.\n */\nexport type VideoEmbedPlayerOption = 'autoPlay' | 'doNotTrack' | 'muted' | 'loop'\n\nexport const VIDEO_EMBED_PLAYER_OPTIONS: readonly VideoEmbedPlayerOption[] = [\n 'autoPlay',\n 'doNotTrack',\n 'muted',\n 'loop',\n]\n\nexport type VideoEmbedPlayerOptions = Partial<\n Record<VideoEmbedPlayerOption, boolean>\n>\n\n/**\n * One query parameter of a player address, in the order the declaration\n * lists them. Either `value`, sent on every address, or an `option` whose\n * state picks `on` or `off`; a state with no value leaves the parameter out.\n *\n * A value may name the media id as `{id}` (AGL-4140), for a player that\n * repeats it in its query, such as one that loops a single film only as a\n * playlist of itself. The id has passed both patterns by then, so it\n * carries nothing a query could be widened with.\n */\nexport type VideoEmbedPlayerParam =\n | { param: string; value: string }\n | {\n param: string\n option: VideoEmbedPlayerOption\n on?: string\n off?: string\n }\n\n/**\n * A link shape {@link VideoEmbedProviderDeclaration.mediaIdPaths} cannot\n * describe (AGL-4140): one that names its media id in the QUERY rather than\n * the path (`/watch?v={id}`), or one only some of the host's domains use (a\n * short-link domain whose whole path is the id, a shape that would misread a\n * page on the host's main domain).\n */\nexport interface VideoEmbedMediaIdLink {\n /**\n * A regular expression over the link's PATH, anchored at both ends. Without\n * {@link param}, its first capture group is the media id.\n */\n path: string\n /** The query parameter that holds the media id, for a path that names none. */\n param?: string\n /**\n * The declared domains this shape is read on, each matched as\n * {@link VideoEmbedProviderDeclaration.domains} are; every declared domain\n * when absent.\n */\n domains?: readonly string[]\n}\n\nexport interface VideoEmbedProviderDeclaration {\n /** Stable id, unique across plugins. */\n id: string\n /** The host's name as an author knows it, for labels and help text. */\n label: string\n /**\n * The domains a link's host must equal or end in (after a dot). Exact or\n * dot-anchored only, so a domain that merely contains one is refused.\n */\n domains: readonly string[]\n /**\n * Regular expressions over a link's PATH, anchored at both ends, whose\n * first capture group is the media id. The host is checked separately,\n * against {@link domains}.\n */\n mediaIdPaths: readonly string[]\n /** The link shapes the paths cannot describe, tried after them. */\n mediaIdLinks?: readonly VideoEmbedMediaIdLink[]\n /** A regular expression, anchored at both ends, a media id must match. */\n mediaIdPattern: string\n /** The one origin the host's player is framed from. */\n playerOrigin: string\n /** The player page's path on {@link playerOrigin}; `{id}` is the media id. */\n playerPath: string\n /** The query every player address carries, in this order. */\n playerQuery?: readonly VideoEmbedPlayerParam[]\n}\n\n/** A declaration, with the plugin that made it. */\nexport interface ResolvedVideoEmbedProvider\n extends VideoEmbedProviderDeclaration {\n pluginId: string\n}\n\n/** A link a declared host recognized. */\nexport interface VideoEmbed {\n provider: ResolvedVideoEmbedProvider\n /** The media id the link named, and nothing else of it. */\n mediaId: string\n /**\n * The player page with no per-visit options — what a `VideoObject`\n * publishes as `embedUrl`.\n */\n embedUrl: string\n}\n\n/**\n * The floor every media id stands on, whatever a declaration's own pattern\n * admits: no separator, dot, query or fragment can reach the player path.\n */\nconst SAFE_MEDIA_ID = /^[A-Za-z0-9_-]{1,64}$/\n\n/** The placeholder a `playerPath` names the media id with. */\nconst ID_PLACEHOLDER = '{id}'\n\n/** Every host a first-party plugin declares. */\nexport function videoEmbedProviders(): readonly ResolvedVideoEmbedProvider[] {\n return FIRST_PARTY_VIDEO_EMBED_PROVIDERS\n}\n\ninterface CompiledLink {\n path: RegExp\n param?: string\n domains?: readonly string[]\n}\n\ninterface CompiledProvider {\n paths: RegExp[]\n links: CompiledLink[]\n mediaId: RegExp\n}\n\nconst compiled = new WeakMap<VideoEmbedProviderDeclaration, CompiledProvider>()\n\nfunction compile(provider: VideoEmbedProviderDeclaration): CompiledProvider {\n let answer = compiled.get(provider)\n if (!answer) {\n answer = {\n paths: provider.mediaIdPaths.map((source) => new RegExp(source)),\n links: (provider.mediaIdLinks ?? []).map((link) => ({\n path: new RegExp(link.path),\n param: link.param,\n domains: link.domains,\n })),\n mediaId: new RegExp(provider.mediaIdPattern),\n }\n compiled.set(provider, answer)\n }\n return answer\n}\n\n/** The media id a link shape reads from this URL, unchecked. */\nfunction linkMediaId(link: CompiledLink, url: URL): string | undefined {\n if (link.domains && !onDomain(url.hostname, link.domains)) return undefined\n const match = link.path.exec(url.pathname)\n if (!match) return undefined\n return link.param ? (url.searchParams.get(link.param) ?? undefined) : match[1]\n}\n\nfunction onDomain(hostname: string, domains: readonly string[]): boolean {\n return domains.some(\n (domain) => hostname === domain || hostname.endsWith(`.${domain}`),\n )\n}\n\n/**\n * The declared host a link belongs to, with the media id it names, or\n * `undefined` for anything else: a value that is not an http(s) URL, a host\n * nothing declares, or a path that names no id the host's pattern accepts.\n */\nexport function videoEmbedOf(\n value: unknown,\n providers: readonly ResolvedVideoEmbedProvider[] = videoEmbedProviders(),\n): VideoEmbed | undefined {\n if (typeof value !== 'string' || !providers.length) return undefined\n let url: URL\n try {\n url = new URL(value.trim())\n } catch {\n return undefined\n }\n if (url.protocol !== 'https:' && url.protocol !== 'http:') return undefined\n for (const provider of providers) {\n if (!onDomain(url.hostname, provider.domains)) continue\n const { paths, links, mediaId } = compile(provider)\n const candidates = [\n ...paths.map((pattern) => pattern.exec(url.pathname)?.[1]),\n ...links.map((link) => linkMediaId(link, url)),\n ]\n for (const id of candidates) {\n if (id && mediaId.test(id) && SAFE_MEDIA_ID.test(id)) {\n return {\n provider,\n mediaId: id,\n embedUrl: `${provider.playerOrigin}${provider.playerPath.replace(ID_PLACEHOLDER, id)}`,\n }\n }\n }\n }\n return undefined\n}\n\n/** The player page for a declared host's link, with no per-visit options. */\nexport function videoEmbedUrl(\n value: unknown,\n providers?: readonly ResolvedVideoEmbedProvider[],\n): string | undefined {\n return videoEmbedOf(value, providers)?.embedUrl\n}\n\n/**\n * The address of a declared host's player frame for this visit, carrying the\n * declaration's query in its own order. See {@link VideoEmbedPlayerOption}\n * for what each option means and which way it defaults.\n */\nexport function videoEmbedPlayerSrc(\n value: unknown,\n options: VideoEmbedPlayerOptions = {},\n providers?: readonly ResolvedVideoEmbedProvider[],\n): string | undefined {\n const embed = videoEmbedOf(value, providers)\n if (!embed) return undefined\n const params = new URLSearchParams()\n const withId = (value: string) =>\n value.split(ID_PLACEHOLDER).join(embed.mediaId)\n for (const entry of embed.provider.playerQuery ?? []) {\n if ('value' in entry) {\n params.set(entry.param, withId(entry.value))\n continue\n }\n const on =\n entry.option === 'autoPlay'\n ? options.autoPlay !== false\n : Boolean(options[entry.option])\n const sent = on ? entry.on : entry.off\n if (sent !== undefined) params.set(entry.param, withId(sent))\n }\n const query = params.toString()\n return query ? `${embed.embedUrl}?${query}` : embed.embedUrl\n}\n\n/**\n * Every origin a declared player is framed from: what a published page's\n * `frame-src` admits for the Video element.\n */\nexport function videoEmbedPlayerOrigins(\n providers: readonly ResolvedVideoEmbedProvider[] = videoEmbedProviders(),\n): string[] {\n return [...new Set(providers.map((provider) => provider.playerOrigin))]\n}\n\n/** The declared hosts' names, as an author knows them. */\nexport function videoEmbedProviderLabels(\n providers: readonly ResolvedVideoEmbedProvider[] = videoEmbedProviders(),\n): string[] {\n return providers.map((provider) => provider.label)\n}\n"],"names":["FIRST_PARTY_VIDEO_EMBED_PROVIDERS","VIDEO_EMBED_PLAYER_OPTIONS","SAFE_MEDIA_ID","ID_PLACEHOLDER","videoEmbedProviders","compiled","WeakMap","compile","provider","answer","get","paths","mediaIdPaths","map","source","RegExp","links","mediaIdLinks","link","path","param","domains","mediaId","mediaIdPattern","set","linkMediaId","url","onDomain","hostname","undefined","match","exec","pathname","searchParams","some","domain","endsWith","videoEmbedOf","value","providers","length","URL","trim","protocol","candidates","pattern","id","test","embedUrl","playerOrigin","playerPath","replace","videoEmbedUrl","videoEmbedPlayerSrc","options","embed","params","URLSearchParams","withId","split","join","entry","playerQuery","on","option","autoPlay","Boolean","sent","off","query","toString","videoEmbedPlayerOrigins","Set","videoEmbedProviderLabels","label"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC,GAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAoDC,GAED,SAASA,iCAAiC,QAAQ,uCAAmC;AAgBrF,OAAO,MAAMC,6BAAgE;IAC3E;IACA;IACA;IACA;CACD,CAAA;AA8FD;;;CAGC,GACD,MAAMC,gBAAgB;AAEtB,4DAA4D,GAC5D,MAAMC,iBAAiB;AAEvB,8CAA8C,GAC9C,OAAO,SAASC;IACd,OAAOJ;AACT;AAcA,MAAMK,WAAW,IAAIC;AAErB,SAASC,QAAQC,QAAuC;IACtD,IAAIC,SAASJ,SAASK,GAAG,CAACF;IAC1B,IAAI,CAACC,QAAQ;YAGDD;QAFVC,SAAS;YACPE,OAAOH,SAASI,YAAY,CAACC,GAAG,CAAC,CAACC,SAAW,IAAIC,OAAOD;YACxDE,OAAO,EAACR,yBAAAA,SAASS,YAAY,YAArBT,yBAAyB,EAAE,EAAEK,GAAG,CAAC,CAACK,OAAU,CAAA;oBAClDC,MAAM,IAAIJ,OAAOG,KAAKC,IAAI;oBAC1BC,OAAOF,KAAKE,KAAK;oBACjBC,SAASH,KAAKG,OAAO;gBACvB,CAAA;YACAC,SAAS,IAAIP,OAAOP,SAASe,cAAc;QAC7C;QACAlB,SAASmB,GAAG,CAAChB,UAAUC;IACzB;IACA,OAAOA;AACT;AAEA,8DAA8D,GAC9D,SAASgB,YAAYP,IAAkB,EAAEQ,GAAQ;QAI1BA;IAHrB,IAAIR,KAAKG,OAAO,IAAI,CAACM,SAAS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hC,YAAmDnC,qBAAqB;IAExE,OAAO;WAAI,IAAIoE,IAAIjC,UAAU1B,GAAG,CAAC,CAACL,WAAaA,SAASyC,YAAY;KAAG;AACzE;AAEA,wDAAwD,GACxD,OAAO,SAASwB,yBACdlC,YAAmDnC,qBAAqB;IAExE,OAAOmC,UAAU1B,GAAG,CAAC,CAACL,WAAaA,SAASkE,KAAK;AACnD"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* GENERATED FILE — do not edit. Regenerate with:
|
|
3
|
+
* node tools/scripts/generate-plugin-manifests.mjs
|
|
4
|
+
*
|
|
5
|
+
* Every video host whose own player the Video element frames, declared by
|
|
6
|
+
* the plugin that plays it (AGL-3080). Core names no host. Its own file,
|
|
7
|
+
* not the catalog's, so a published page with no video downloads none of
|
|
8
|
+
* it (AGL-4140).
|
|
9
|
+
*/
|
|
10
|
+
import type { ResolvedVideoEmbedProvider } from './video-embed-provider';
|
|
11
|
+
export declare const FIRST_PARTY_VIDEO_EMBED_PROVIDERS: readonly ResolvedVideoEmbedProvider[];
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* GENERATED FILE — do not edit. Regenerate with:
|
|
3
|
+
* node tools/scripts/generate-plugin-manifests.mjs
|
|
4
|
+
*
|
|
5
|
+
* Every video host whose own player the Video element frames, declared by
|
|
6
|
+
* the plugin that plays it (AGL-3080). Core names no host. Its own file,
|
|
7
|
+
* not the catalog's, so a published page with no video downloads none of
|
|
8
|
+
* it (AGL-4140).
|
|
9
|
+
*/ export const FIRST_PARTY_VIDEO_EMBED_PROVIDERS = [
|
|
10
|
+
{
|
|
11
|
+
"pluginId": "mui",
|
|
12
|
+
"id": "vimeo",
|
|
13
|
+
"label": "Vimeo",
|
|
14
|
+
"domains": [
|
|
15
|
+
"vimeo.com"
|
|
16
|
+
],
|
|
17
|
+
"mediaIdPaths": [
|
|
18
|
+
"^\\/([0-9]+)\\/?$",
|
|
19
|
+
"^\\/video\\/([0-9]+)\\/?$",
|
|
20
|
+
"^\\/channels\\/[^/]+\\/([0-9]+)\\/?$",
|
|
21
|
+
"^\\/groups\\/[^/]+\\/videos\\/([0-9]+)\\/?$",
|
|
22
|
+
"^\\/showcase\\/[^/]+\\/video\\/([0-9]+)\\/?$",
|
|
23
|
+
"^\\/album\\/[^/]+\\/video\\/([0-9]+)\\/?$",
|
|
24
|
+
"^\\/manage\\/videos\\/([0-9]+)\\/?$"
|
|
25
|
+
],
|
|
26
|
+
"mediaIdPattern": "^[0-9]{6,12}$",
|
|
27
|
+
"playerOrigin": "https://player.vimeo.com",
|
|
28
|
+
"playerPath": "/video/{id}",
|
|
29
|
+
"playerQuery": [
|
|
30
|
+
{
|
|
31
|
+
"param": "autoplay",
|
|
32
|
+
"option": "autoPlay",
|
|
33
|
+
"on": "1",
|
|
34
|
+
"off": "0"
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
"param": "dnt",
|
|
38
|
+
"value": "1"
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
"param": "muted",
|
|
42
|
+
"option": "muted",
|
|
43
|
+
"on": "1"
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
"param": "loop",
|
|
47
|
+
"option": "loop",
|
|
48
|
+
"on": "1"
|
|
49
|
+
}
|
|
50
|
+
]
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
"pluginId": "mui",
|
|
54
|
+
"id": "wistia",
|
|
55
|
+
"label": "Wistia",
|
|
56
|
+
"domains": [
|
|
57
|
+
"wistia.com",
|
|
58
|
+
"wistia.net",
|
|
59
|
+
"wi.st"
|
|
60
|
+
],
|
|
61
|
+
"mediaIdPaths": [
|
|
62
|
+
"^\\/medias\\/([^/]+)(?:\\/manage)?\\/?$",
|
|
63
|
+
"^\\/m\\/([^/]+)\\/?$",
|
|
64
|
+
"^\\/embed\\/iframe\\/([^/]+)\\/?$",
|
|
65
|
+
"^\\/embed\\/medias\\/([^/.]+)(?:\\.jsonp?)?\\/?$"
|
|
66
|
+
],
|
|
67
|
+
"mediaIdPattern": "^[a-z0-9]{10}$",
|
|
68
|
+
"playerOrigin": "https://fast.wistia.net",
|
|
69
|
+
"playerPath": "/embed/iframe/{id}",
|
|
70
|
+
"playerQuery": [
|
|
71
|
+
{
|
|
72
|
+
"param": "autoPlay",
|
|
73
|
+
"option": "autoPlay",
|
|
74
|
+
"on": "true",
|
|
75
|
+
"off": "false"
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
"param": "roundedPlayer",
|
|
79
|
+
"value": "false"
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
"param": "doNotTrack",
|
|
83
|
+
"option": "doNotTrack",
|
|
84
|
+
"on": "true"
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
"param": "muted",
|
|
88
|
+
"option": "muted",
|
|
89
|
+
"on": "true"
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
"param": "endVideoBehavior",
|
|
93
|
+
"option": "loop",
|
|
94
|
+
"on": "loop"
|
|
95
|
+
}
|
|
96
|
+
]
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
"pluginId": "mui",
|
|
100
|
+
"id": "youtube",
|
|
101
|
+
"label": "YouTube",
|
|
102
|
+
"domains": [
|
|
103
|
+
"youtube.com",
|
|
104
|
+
"youtube-nocookie.com",
|
|
105
|
+
"youtu.be"
|
|
106
|
+
],
|
|
107
|
+
"mediaIdPaths": [
|
|
108
|
+
"^\\/embed\\/([^/]+)\\/?$",
|
|
109
|
+
"^\\/shorts\\/([^/]+)\\/?$",
|
|
110
|
+
"^\\/live\\/([^/]+)\\/?$",
|
|
111
|
+
"^\\/v\\/([^/]+)\\/?$"
|
|
112
|
+
],
|
|
113
|
+
"mediaIdLinks": [
|
|
114
|
+
{
|
|
115
|
+
"path": "^\\/watch\\/?$",
|
|
116
|
+
"param": "v",
|
|
117
|
+
"domains": [
|
|
118
|
+
"youtube.com"
|
|
119
|
+
]
|
|
120
|
+
},
|
|
121
|
+
{
|
|
122
|
+
"path": "^\\/([^/]+)\\/?$",
|
|
123
|
+
"domains": [
|
|
124
|
+
"youtu.be"
|
|
125
|
+
]
|
|
126
|
+
}
|
|
127
|
+
],
|
|
128
|
+
"mediaIdPattern": "^(?!videoseries$)[A-Za-z0-9_-]{11}$",
|
|
129
|
+
"playerOrigin": "https://www.youtube-nocookie.com",
|
|
130
|
+
"playerPath": "/embed/{id}",
|
|
131
|
+
"playerQuery": [
|
|
132
|
+
{
|
|
133
|
+
"param": "autoplay",
|
|
134
|
+
"option": "autoPlay",
|
|
135
|
+
"on": "1",
|
|
136
|
+
"off": "0"
|
|
137
|
+
},
|
|
138
|
+
{
|
|
139
|
+
"param": "playsinline",
|
|
140
|
+
"value": "1"
|
|
141
|
+
},
|
|
142
|
+
{
|
|
143
|
+
"param": "mute",
|
|
144
|
+
"option": "muted",
|
|
145
|
+
"on": "1"
|
|
146
|
+
},
|
|
147
|
+
{
|
|
148
|
+
"param": "loop",
|
|
149
|
+
"option": "loop",
|
|
150
|
+
"on": "1"
|
|
151
|
+
},
|
|
152
|
+
{
|
|
153
|
+
"param": "playlist",
|
|
154
|
+
"option": "loop",
|
|
155
|
+
"on": "{id}"
|
|
156
|
+
}
|
|
157
|
+
]
|
|
158
|
+
}
|
|
159
|
+
];
|
|
160
|
+
|
|
161
|
+
//# sourceMappingURL=video-embed-providers.generated.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../../libs/aglyn/src/lib/plugin-manager/video-embed-providers.generated.ts"],"sourcesContent":["/**\n * GENERATED FILE — do not edit. Regenerate with:\n * node tools/scripts/generate-plugin-manifests.mjs\n *\n * Every video host whose own player the Video element frames, declared by\n * the plugin that plays it (AGL-3080). Core names no host. Its own file,\n * not the catalog's, so a published page with no video downloads none of\n * it (AGL-4140).\n */\n\nimport type { ResolvedVideoEmbedProvider } from './video-embed-provider'\n\nexport const FIRST_PARTY_VIDEO_EMBED_PROVIDERS: readonly ResolvedVideoEmbedProvider[] = [\n {\n \"pluginId\": \"mui\",\n \"id\": \"vimeo\",\n \"label\": \"Vimeo\",\n \"domains\": [\n \"vimeo.com\"\n ],\n \"mediaIdPaths\": [\n \"^\\\\/([0-9]+)\\\\/?$\",\n \"^\\\\/video\\\\/([0-9]+)\\\\/?$\",\n \"^\\\\/channels\\\\/[^/]+\\\\/([0-9]+)\\\\/?$\",\n \"^\\\\/groups\\\\/[^/]+\\\\/videos\\\\/([0-9]+)\\\\/?$\",\n \"^\\\\/showcase\\\\/[^/]+\\\\/video\\\\/([0-9]+)\\\\/?$\",\n \"^\\\\/album\\\\/[^/]+\\\\/video\\\\/([0-9]+)\\\\/?$\",\n \"^\\\\/manage\\\\/videos\\\\/([0-9]+)\\\\/?$\"\n ],\n \"mediaIdPattern\": \"^[0-9]{6,12}$\",\n \"playerOrigin\": \"https://player.vimeo.com\",\n \"playerPath\": \"/video/{id}\",\n \"playerQuery\": [\n {\n \"param\": \"autoplay\",\n \"option\": \"autoPlay\",\n \"on\": \"1\",\n \"off\": \"0\"\n },\n {\n \"param\": \"dnt\",\n \"value\": \"1\"\n },\n {\n \"param\": \"muted\",\n \"option\": \"muted\",\n \"on\": \"1\"\n },\n {\n \"param\": \"loop\",\n \"option\": \"loop\",\n \"on\": \"1\"\n }\n ]\n },\n {\n \"pluginId\": \"mui\",\n \"id\": \"wistia\",\n \"label\": \"Wistia\",\n \"domains\": [\n \"wistia.com\",\n \"wistia.net\",\n \"wi.st\"\n ],\n \"mediaIdPaths\": [\n \"^\\\\/medias\\\\/([^/]+)(?:\\\\/manage)?\\\\/?$\",\n \"^\\\\/m\\\\/([^/]+)\\\\/?$\",\n \"^\\\\/embed\\\\/iframe\\\\/([^/]+)\\\\/?$\",\n \"^\\\\/embed\\\\/medias\\\\/([^/.]+)(?:\\\\.jsonp?)?\\\\/?$\"\n ],\n \"mediaIdPattern\": \"^[a-z0-9]{10}$\",\n \"playerOrigin\": \"https://fast.wistia.net\",\n \"playerPath\": \"/embed/iframe/{id}\",\n \"playerQuery\": [\n {\n \"param\": \"autoPlay\",\n \"option\": \"autoPlay\",\n \"on\": \"true\",\n \"off\": \"false\"\n },\n {\n \"param\": \"roundedPlayer\",\n \"value\": \"false\"\n },\n {\n \"param\": \"doNotTrack\",\n \"option\": \"doNotTrack\",\n \"on\": \"true\"\n },\n {\n \"param\": \"muted\",\n \"option\": \"muted\",\n \"on\": \"true\"\n },\n {\n \"param\": \"endVideoBehavior\",\n \"option\": \"loop\",\n \"on\": \"loop\"\n }\n ]\n },\n {\n \"pluginId\": \"mui\",\n \"id\": \"youtube\",\n \"label\": \"YouTube\",\n \"domains\": [\n \"youtube.com\",\n \"youtube-nocookie.com\",\n \"youtu.be\"\n ],\n \"mediaIdPaths\": [\n \"^\\\\/embed\\\\/([^/]+)\\\\/?$\",\n \"^\\\\/shorts\\\\/([^/]+)\\\\/?$\",\n \"^\\\\/live\\\\/([^/]+)\\\\/?$\",\n \"^\\\\/v\\\\/([^/]+)\\\\/?$\"\n ],\n \"mediaIdLinks\": [\n {\n \"path\": \"^\\\\/watch\\\\/?$\",\n \"param\": \"v\",\n \"domains\": [\n \"youtube.com\"\n ]\n },\n {\n \"path\": \"^\\\\/([^/]+)\\\\/?$\",\n \"domains\": [\n \"youtu.be\"\n ]\n }\n ],\n \"mediaIdPattern\": \"^(?!videoseries$)[A-Za-z0-9_-]{11}$\",\n \"playerOrigin\": \"https://www.youtube-nocookie.com\",\n \"playerPath\": \"/embed/{id}\",\n \"playerQuery\": [\n {\n \"param\": \"autoplay\",\n \"option\": \"autoPlay\",\n \"on\": \"1\",\n \"off\": \"0\"\n },\n {\n \"param\": \"playsinline\",\n \"value\": \"1\"\n },\n {\n \"param\": \"mute\",\n \"option\": \"muted\",\n \"on\": \"1\"\n },\n {\n \"param\": \"loop\",\n \"option\": \"loop\",\n \"on\": \"1\"\n },\n {\n \"param\": \"playlist\",\n \"option\": \"loop\",\n \"on\": \"{id}\"\n }\n ]\n },\n]\n"],"names":["FIRST_PARTY_VIDEO_EMBED_PROVIDERS"],"mappings":"AAAA;;;;;;;;CAQC,GAID,OAAO,MAAMA,oCAA2E;IACtF;QACE,YAAY;QACZ,MAAM;QACN,SAAS;QACT,WAAW;YACT;SACD;QACD,gBAAgB;YACd;YACA;YACA;YACA;YACA;YACA;YACA;SACD;QACD,kBAAkB;QAClB,gBAAgB;QAChB,cAAc;QACd,eAAe;YACb;gBACE,SAAS;gBACT,UAAU;gBACV,MAAM;gBACN,OAAO;YACT;YACA;gBACE,SAAS;gBACT,SAAS;YACX;YACA;gBACE,SAAS;gBACT,UAAU;gBACV,MAAM;YACR;YACA;gBACE,SAAS;gBACT,UAAU;gBACV,MAAM;YACR;SACD;IACH;IACA;QACE,YAAY;QACZ,MAAM;QACN,SAAS;QACT,WAAW;YACT;YACA;YACA;SACD;QACD,gBAAgB;YACd;YACA;YACA;YACA;SACD;QACD,kBAAkB;QAClB,gBAAgB;QAChB,cAAc;QACd,eAAe;YACb;gBACE,SAAS;gBACT,UAAU;gBACV,MAAM;gBACN,OAAO;YACT;YACA;gBACE,SAAS;gBACT,SAAS;YACX;YACA;gBACE,SAAS;gBACT,UAAU;gBACV,MAAM;YACR;YACA;gBACE,SAAS;gBACT,UAAU;gBACV,MAAM;YACR;YACA;gBACE,SAAS;gBACT,UAAU;gBACV,MAAM;YACR;SACD;IACH;IACA;QACE,YAAY;QACZ,MAAM;QACN,SAAS;QACT,WAAW;YACT;YACA;YACA;SACD;QACD,gBAAgB;YACd;YACA;YACA;YACA;SACD;QACD,gBAAgB;YACd;gBACE,QAAQ;gBACR,SAAS;gBACT,WAAW;oBACT;iBACD;YACH;YACA;gBACE,QAAQ;gBACR,WAAW;oBACT;iBACD;YACH;SACD;QACD,kBAAkB;QAClB,gBAAgB;QAChB,cAAc;QACd,eAAe;YACb;gBACE,SAAS;gBACT,UAAU;gBACV,MAAM;gBACN,OAAO;YACT;YACA;gBACE,SAAS;gBACT,SAAS;YACX;YACA;gBACE,SAAS;gBACT,UAAU;gBACV,MAAM;YACR;YACA;gBACE,SAAS;gBACT,UAAU;gBACV,MAAM;YACR;YACA;gBACE,SAAS;gBACT,UAAU;gBACV,MAAM;YACR;SACD;IACH;CACD,CAAA"}
|