-
Notifications
You must be signed in to change notification settings - Fork 87
chore: support lucien deeplink in registry page #191
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
JoJoJoJoJoJoJo
merged 5 commits into
main
from
jonathan/chore-support-lucien-install-deeplink
Jun 30, 2025
Merged
Changes from 4 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
42fef1d
chore: support lucien deeplink in registry page
JoJoJoJoJoJoJo 623ef9b
Update pages/registry/index.html
JoJoJoJoJoJoJo ab8c89a
Update pages/_includes/lucien-servers.js
JoJoJoJoJoJoJo 104e7c6
fix: encode url with tool
JoJoJoJoJoJoJo be88c89
fix: comment
JoJoJoJoJoJoJo File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| const lucienSpecifiedServers = [ | ||
| 'materials-project', | ||
| 'web-fetch' | ||
| ]; | ||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -284,6 +284,7 @@ | |
| flex-direction: column; | ||
| border: 1px solid var(--border); | ||
| cursor: pointer; | ||
| position: relative; | ||
| } | ||
|
|
||
| .server-card:hover { | ||
|
|
@@ -392,6 +393,35 @@ | |
| margin-top: auto; | ||
| margin-bottom: 0; | ||
| } | ||
|
|
||
| .install-button { | ||
| background-color: var(--button-bg); | ||
| color: white; | ||
| border: none; | ||
| border-radius: 4px; | ||
| padding: 6px 12px; | ||
| font-size: 0.8rem; | ||
| cursor: pointer; | ||
| display: flex; | ||
| align-items: center; | ||
| gap: 4px; | ||
| transition: background-color 0.2s; | ||
| text-decoration: none; | ||
| width: fit-content; | ||
| position: absolute; | ||
| bottom: 10px; | ||
| right: 1.25rem; | ||
| z-index: 10; | ||
| } | ||
|
|
||
| .install-button:hover { | ||
| background-color: var(--button-hover); | ||
| } | ||
|
|
||
| .install-button svg { | ||
| width: 14px; | ||
| height: 14px; | ||
| } | ||
|
|
||
| .server-card .meta .author { | ||
| color: var(--accent-highlight); | ||
|
|
@@ -1473,13 +1503,48 @@ <h3>Raw Manifest:</h3> | |
| </div> | ||
| </div> | ||
|
|
||
| <!-- Load Lucien servers configuration --> | ||
|
|
||
| <script> | ||
| {% include lucien-servers.js %} | ||
| // Server data - to be loaded from the combined JSON file (as a map with server names as keys) | ||
| let serversMap = {}; | ||
| let serversArray = []; // Also keep an array version for rendering | ||
|
|
||
| // Fetch all servers data | ||
| const serverDataUrl = '/api/servers.json'; | ||
| const searchParams = new URLSearchParams(window.location.search); | ||
| const sortRule = { | ||
| 'isPinned': 0, | ||
| 'isOfficial': 1, | ||
| 'others': 2, | ||
| } | ||
| const isLucien = searchParams.get('source') === 'lucien' | ||
| const sourceProtocol = searchParams.get('protocol') || 'lucien' | ||
|
|
||
| // Use the Lucien specified servers from the external JS file | ||
| const defaultSpecifiedServers = [] | ||
| if (isLucien) { | ||
| // Get servers based on whether we're in staging or production | ||
| defaultSpecifiedServers.push(...lucienSpecifiedServers); | ||
| } | ||
|
|
||
| function serverSortRule(serverA, serverB) { | ||
|
|
||
| function determineServerType(server) { | ||
| if (defaultSpecifiedServers.includes(server.name)) { | ||
| return 'isPinned'; | ||
| } | ||
| if (server.is_official) { | ||
| return 'isOfficial'; | ||
| } | ||
| return 'others'; | ||
| } | ||
|
|
||
| const serverAType = determineServerType(serverA); | ||
| const serverBType = determineServerType(serverB); | ||
| return sortRule[serverAType] - sortRule[serverBType]; | ||
| } | ||
|
|
||
| // First load GitHub star counts, then fetch server data | ||
| loadGitHubStarCounts() | ||
|
|
@@ -1493,6 +1558,8 @@ <h3>Raw Manifest:</h3> | |
| .then(data => { | ||
| serversMap = data; | ||
| serversArray = Object.values(serversMap); | ||
| // sort servers by sortRule | ||
| serversArray.sort(serverSortRule); | ||
|
|
||
| // Generate tag filters dynamically from server data | ||
| generateTagFilters(serversArray); | ||
|
|
@@ -2006,6 +2073,48 @@ <h3>Raw Manifest:</h3> | |
| // Use the star count element created in the header | ||
|
|
||
| serverContent.appendChild(meta); | ||
|
|
||
| // Add install button with click function for deeplink | ||
| if (isLucien) { | ||
JoJoJoJoJoJoJo marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| const installButton = document.createElement('button'); | ||
| installButton.className = 'install-button'; | ||
| installButton.type = 'button'; | ||
|
|
||
| // Add download icon | ||
| installButton.innerHTML = ` | ||
| <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"> | ||
| <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"></path> | ||
| <polyline points="7 10 12 15 17 10"></polyline> | ||
| <line x1="12" y1="15" x2="12" y2="3"></line> | ||
| </svg> | ||
| Install | ||
| `; | ||
| } | ||
|
|
||
| // Handle click event to build search params and trigger deeplink | ||
| installButton.addEventListener('click', (event) => { | ||
| // Prevent the modal from opening | ||
| event.stopPropagation(); | ||
|
|
||
| // Build search params with server install info | ||
| const params = new URLSearchParams(); | ||
| params.append('name', server.name); | ||
| params.append('action', 'install'); | ||
|
|
||
| const installInfo = Object.values(server.installations)[0]; | ||
| // No remote for now, only stdio | ||
| params.append('command', installInfo.command); | ||
| params.append('args', encodeURIComponent(installInfo.args.join(' '))); | ||
| if (installInfo.env) { | ||
| params.append('env', JSON.stringify(installInfo.env)); | ||
| } | ||
|
|
||
| // Create and trigger the deeplink | ||
| const deeplink = `${sourceProtocol}://mcpm?${params.toString()}`; | ||
|
||
| window.location.href = deeplink; | ||
| }); | ||
|
|
||
| serverContent.appendChild(installButton); | ||
|
|
||
| const linksContainer = document.createElement('div'); | ||
| linksContainer.className = 'server-links'; | ||
|
|
||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.