Skip to content

Commit

Permalink
feat: support additional bookmark source (#75)
Browse files Browse the repository at this point in the history
A secondary (optional) bookmark source can be defined.
If it has been set up then both sources must be reachable in order for
bookmark synchronization to succeed. Each source can be either
GitHub.com or a GitHub Enterprise Server (GHES) instance.

A possible use case would be to load bookmarks from a repo in GHES (job
related bookmarks) as well from GitHub.com (personal bookmarks).
  • Loading branch information
frederikb authored Apr 22, 2024
1 parent 20422b1 commit 0998f1d
Show file tree
Hide file tree
Showing 8 changed files with 296 additions and 112 deletions.
Binary file modified docs/screenshot-options.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 3 additions & 2 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,12 @@ Store bookmarks in a simple JSON structure in your organization's GitHub reposit

## 🚀 Features

- 🔄 **Automatic Synchronization**: Sync bookmarks every hour and shortly after the browser starts.
- ⏱️ **Automatic Synchronization**: Sync bookmarks every hour and shortly after the browser starts.
-**Manual Sync**: Need the latest bookmarks immediately? Trigger a sync manually.
- 🎯 **Selective Sync**: Syncs only the folders contained in the remote bookmark files without touching others you might have.
- 🔄 **Multi-Source Synchronization**: Seamlessly integrate bookmarks from two separate sources, such as personal and work repositories.
- 📁 **Multi-File Support**: Organize your organizations bookmarks into separate JSON files, for example by project.
- 📢 **Notifications**: Stay informed about successful syncs or if any issues arise.
- 🔔 **Notifications**: Stay informed about successful syncs or if any issues arise.
- 🔒 **Secure**: Uses GitHub's Personal Access Token (PAT) for authentication, ensuring secure access.
- 🌐 **GitHub Enterprise Support**: Synchronize bookmarks from GitHub or GitHub Enterprise Server (GHES).

Expand Down
119 changes: 83 additions & 36 deletions src/entrypoints/options/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,47 +11,94 @@

<body>
<form id="options-form" class="detail-view-container">
<details id="source" role="term" open>
<details role="term" open>
<summary><strong>🔄 Bookmarks source</strong></summary>
</details>
<div role="definition" class="content">
<div>
<p>
<label>
<input type="checkbox" name="useCustomHost">
Use GitHub Enterprise Server
</label>
</p>
<p id="customHostContainer">
<label class="text-input">
<span>GitHub API URL</span>
<input type="url" name="githubApiUrl" required placeholder="https://github.yourdomain.com/api/v3">
</label>
</p>
<p>
<label class="text-input">
<span>GitHub Personal Access Token</span>
<input type="password" name="pat" required>
</label>
</p>
<hr />
<p class="repo-source">
<label class="text-input">
<span>Repository</span>
<input type="text" name="owner" required placeholder="Owner">
<span class="divider">/</span>
<input type="text" name="repo" required placeholder="Repository">
</label>
</p>
<p>
<label class="text-input">
<span>Path</span>
<input type="text" name="sourcePath" required placeholder="File or folder">
</label>
</p>
<button id="check-connection-btn">Check Connection</button>
<div id="source1">
<p>
<label>
<input type="checkbox" name="source1_useCustomHost">
Use GitHub Enterprise Server
</label>
</p>
<p class="custom-host-container">
<label class="text-input">
<span>GitHub API URL</span>
<input type="url" name="source1_githubApiUrl" required placeholder="https://github.yourdomain.com/api/v3">
</label>
</p>
<p>
<label class="text-input">
<span>GitHub Personal Access Token</span>
<input type="password" name="source1_pat" required>
</label>
</p>
<p class="repo-source">
<label class="text-input">
<span>Repository</span>
<input type="text" name="source1_owner" required placeholder="Owner">
<span class="divider">/</span>
<input type="text" name="source1_repo" required placeholder="Repository">
</label>
</p>
<p>
<label class="text-input">
<span>Path</span>
<input type="text" name="source1_sourcePath" required placeholder="File or folder">
</label>
</p>
</div>
<div>
<hr/>
<p>
<label>
<input type="checkbox" name="source2_active">
Activate additional bookmark source
</label>
</p>
</div>
<div id="source2">
<p>
<label>
<input type="checkbox" name="source2_useCustomHost">
Use GitHub Enterprise Server
</label>
</p>
<p class="custom-host-container">
<label class="text-input">
<span>GitHub API URL</span>
<input type="url" name="source2_githubApiUrl" required placeholder="https://github.yourdomain.com/api/v3">
</label>
</p>
<p>
<label class="text-input">
<span>GitHub Personal Access Token</span>
<input type="password" name="source2_pat" required>
</label>
</p>
<p class="repo-source">
<label class="text-input">
<span>Repository</span>
<input type="text" name="source2_owner" required placeholder="Owner">
<span class="divider">/</span>
<input type="text" name="source2_repo" required placeholder="Repository">
</label>
</p>
<p>
<label class="text-input">
<span>Path</span>
<input type="text" name="source2_sourcePath" required placeholder="File or folder">
</label>
</p>
</div>
<div>
<p id="connection-message"></p>
<hr/>
<button class="check-connection-btn">Check Connection(s)</button>
<div>
<p class="connection-message"></p>
</div>
</div>
</div>
</div>
Expand Down
40 changes: 31 additions & 9 deletions src/entrypoints/options/options.css
Original file line number Diff line number Diff line change
Expand Up @@ -129,52 +129,74 @@ hr {
margin-bottom: 15px;
}

#customHostContainer {
.custom-host-container, #source2 {
visibility: visible;
transition: max-height 0.5s ease-in-out;
max-height: 10rem;
overflow: hidden;
}

#customHostContainer.hidden {
.custom-host-container.hidden, #source2.hidden {
visibility: hidden;
max-height: 0;
transition: max-height 0.5s ease-in-out, visibility 0s 0.5s;
}
#check-connection-btn {

#source2 {
visibility: visible;
transition: max-height 0.5s ease-in-out;
max-height: 15rem;
overflow: hidden;
}

#source2.hidden {
visibility: hidden;
max-height: 0;
transition: max-height 0.5s ease-in-out, visibility 0s 0.5s;
}

.check-connection-btn {
width: 11rem;
cursor: pointer;
display: inline-block;
}

#check-connection-btn:disabled {
.check-connection-btn:disabled {
cursor: not-allowed;
}

#check-connection-btn.in-progress {
.check-connection-btn.in-progress {
cursor: progress;
}

#connection-message {
.connection-message {
border-radius: 4px;
padding: 10px 15px;
margin: 10px 0;
display: block;
box-sizing: border-box;
}

#connection-message.hidden {
.connection-message.hidden {
display: none;
}

#connection-message.success {
.connection-message.success {
color: #003300;
background-color: #ccffcc;
border: 1px solid #004400;
}

#connection-message.error {
.connection-message.error {
color: #330000;
background-color: #ffcccc;
border: 1px solid #440000;
}

/* Firefox specific styling overrides */
@-moz-document url-prefix('') {
input[type='checkbox'] {
/* override webext-base-css style to better align checkboxes with single line labels */
vertical-align: -0.1em;
}
}
Loading

0 comments on commit 0998f1d

Please sign in to comment.