fix: dynamic absolute path and instruction

This commit is contained in:
Richard Tang
2026-04-06 13:21:06 -07:00
parent 420d703138
commit cd9a625041
+11 -4
View File
@@ -229,13 +229,12 @@
<span class="step-number">3</span>
<span class="step-title">Select the extension folder</span>
</div>
<p>In the folder picker, navigate to (or paste) the following path:</p>
<p>In the folder picker, paste the path below. Click <strong style="color:var(--text)">Copy</strong> to copy it to your clipboard.</p>
<div class="path-box">
<span id="extension-path">tools/browser-extension</span>
<button class="copy-btn" id="copy-path-btn">Copy</button>
</div>
<div class="note">The quickstart script copies this path to your clipboard — just paste it in the folder picker.</div>
<div class="note">If pasting doesn't work, navigate manually: open the folder where you cloned the Hive repo, then go into <code>tools</code><code>browser-extension</code>. For example, if you cloned to <code>~/projects/hive</code>, the full path would be <code>~/projects/hive/tools/browser-extension</code>.</div>
<div class="note">Alternatively, you can navigate there manually: open the folder where you cloned the Hive repo, then go into <code>tools</code><code>browser-extension</code>.</div>
<img width="1236" height="921" alt="Image" src="https://github.com/user-attachments/assets/119b8794-d956-4278-9284-3f122597b34c" style="max-width:100%;height:auto;border-radius:6px;margin-top:0.75rem;" />
</div>
@@ -256,11 +255,19 @@
</div>
<script>
// Populate extension path from URL parameter if provided
// Populate extension path from URL parameter, or derive from this file's location
const params = new URLSearchParams(window.location.search);
const extPath = params.get('path');
if (extPath) {
document.getElementById('extension-path').textContent = extPath;
} else if (window.location.protocol === 'file:') {
// Derive absolute path from this HTML file's own location:
// this file is at <repo>/docs/browser-extension-setup.html
// the extension is at <repo>/tools/browser-extension
const filePath = decodeURIComponent(window.location.pathname);
const docsDir = filePath.substring(0, filePath.lastIndexOf('/'));
const repoDir = docsDir.substring(0, docsDir.lastIndexOf('/'));
document.getElementById('extension-path').textContent = repoDir + '/tools/browser-extension';
}
// Copy chrome://extensions/ button