brightspace-mcp-server 3.6.0 → 3.6.1

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.
@@ -11,6 +11,19 @@ function safeHostname(url) {
11
11
  return null;
12
12
  }
13
13
  }
14
+ /** True if `host` is exactly `domain` or a subdomain of it, e.g. "www.youtube.com" matches "youtube.com". */
15
+ function isDomainOrSubdomain(host, domain) {
16
+ return host === domain || host.endsWith(`.${domain}`);
17
+ }
18
+ /**
19
+ * True if `label` appears as one of `host`'s dot-separated segments, e.g.
20
+ * "mediaspace.kaltura.com" has the label "kaltura". Used instead of a bare
21
+ * substring test so a lookalike host like "fakekaltura.com" or
22
+ * "notyuja.example.com" doesn't get misclassified as the real platform.
23
+ */
24
+ function hasHostLabel(host, label) {
25
+ return host.split(".").includes(label);
26
+ }
14
27
  /**
15
28
  * Kaltura's KAF "browseAndEmbed" front end (what a school's own branded
16
29
  * domain, e.g. BoilerCast, typically uses) puts params as path segments
@@ -28,17 +41,17 @@ export function detectVideoPlatform(url) {
28
41
  // mediaspace.kaltura.com) or from a school's own KAF front end (e.g.
29
42
  // BoilerCast at Purdue), which is why entry_id/wid are also checked as
30
43
  // query params or path segments before falling back to "unknown".
31
- if (/kaltura/.test(host))
44
+ if (hasHostLabel(host, "kaltura"))
32
45
  return "kaltura";
33
- if (/youtube\.com$|youtu\.be$/.test(host))
46
+ if (isDomainOrSubdomain(host, "youtube.com") || isDomainOrSubdomain(host, "youtu.be"))
34
47
  return "youtube";
35
- if (/panopto/.test(host))
48
+ if (hasHostLabel(host, "panopto"))
36
49
  return "panopto";
37
- if (/yuja/.test(host))
50
+ if (hasHostLabel(host, "yuja"))
38
51
  return "yuja";
39
- if (/echo360/.test(host))
52
+ if (hasHostLabel(host, "echo360"))
40
53
  return "echo360";
41
- if (/vimeo/.test(host))
54
+ if (hasHostLabel(host, "vimeo"))
42
55
  return "vimeo";
43
56
  if (extractKalturaIds(url))
44
57
  return "kaltura";
@@ -82,10 +95,10 @@ export function extractYouTubeVideoId(url) {
82
95
  return null;
83
96
  }
84
97
  const host = parsed.hostname.toLowerCase();
85
- if (host === "youtu.be" || host.endsWith(".youtu.be")) {
98
+ if (isDomainOrSubdomain(host, "youtu.be")) {
86
99
  return parsed.pathname.slice(1).split("/")[0] || null;
87
100
  }
88
- if (host.endsWith("youtube.com") || host.endsWith("youtube-nocookie.com")) {
101
+ if (isDomainOrSubdomain(host, "youtube.com") || isDomainOrSubdomain(host, "youtube-nocookie.com")) {
89
102
  const v = parsed.searchParams.get("v");
90
103
  if (v)
91
104
  return v;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "brightspace-mcp-server",
3
- "version": "3.6.0",
3
+ "version": "3.6.1",
4
4
  "mcpName": "io.github.rohanmuppa/brightspace",
5
5
  "description": "MCP server for Brightspace (D2L). Check grades, due dates, assignments, announcements, syllabus, rosters and more via Claude, ChatGPT, Cursor, Windsurf, or any MCP client.",
6
6
  "type": "module",