Skip to content

Commit

Permalink
added a manual sync overwrite and a login with token
Browse files Browse the repository at this point in the history
  • Loading branch information
kinabalu committed Jun 10, 2024
1 parent b2ebe79 commit 5b77aff
Show file tree
Hide file tree
Showing 2 changed files with 55 additions and 0 deletions.
18 changes: 18 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,24 @@ transcript and any AI generated summaries or actions become sections in the note
- Optional mode to delete synced notes from the voicenotes.com server
- Destructive action which requires double opt-in toggles

### Login via Apple, Google, Twitter (X)
Steps to login with the above services (quite manual but doable).

1. Open up voicenotes.com in a browser like Chrome
2. After logging in open up Developer Tools
3. Navigate to the "Network" tab
4. Click on Fetch/XHR to see those calls specifically
5. Hit refresh on the voicenotes.com page
6. One of the entries should say "me" click on it and navigate to the Headers section
7. Scroll down to "Request Headers" and find the line that says "Authorization"
8. The right side of this entry will say "Bearer x" where x is a longish string of text. This is your authorization / login key
9. Copy that value for the next step

## Back in Obsidian
1. Enter the token into the "Auth Token" field in settings
4. Click Login with Token


### Installation
The VoiceNotes.com Sync Plugin is available in the Obsidian Community Plugins area.

Expand Down
37 changes: 37 additions & 0 deletions main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -323,6 +323,35 @@ class VoiceNotesSettingTab extends PluginSettingTab {
new Notice("Login to voicenotes.com was successful")
await this.plugin.saveSettings()
await this.display()
} else {
new Notice("Login to voicenotes.com was unsuccessful")
}
})
)

new Setting(containerEl)
.setName('Auth Token')
.addText(text => text
.setPlaceholder('12345|abcdefghijklmnopqrstuvwxyz')
.setValue(this.plugin.settings.token)
.onChange(async (value) => {
this.plugin.settings.token = value;
await this.plugin.saveSettings();
}));
new Setting(containerEl)
.addButton(button => button
.setButtonText("Login with token")
.onClick(async (evt) => {
this.vnApi.setToken(this.plugin.settings.token)
const response = await this.vnApi.getUserInfo()
this.plugin.settings.password = null

if (response) {
new Notice("Login to voicenotes.com was successful")
await this.plugin.saveSettings()
await this.display()
} else {
new Notice("Login to voicenotes.com was unsuccessful")
}
})
)
Expand Down Expand Up @@ -358,8 +387,16 @@ class VoiceNotesSettingTab extends PluginSettingTab {
)

new Setting(containerEl)
.setName("Force Sync")
.setDesc("Manual synchronization -- only use the overwrite manual sync if you're ok with overwriting already synced notes")
.addButton(button => button
.setButtonText("Manual sync")
.onClick(async (evt) => {
await this.plugin.sync();
})
)
.addButton(button => button
.setButtonText("Manual sync (overwrite)")
.onClick(async (evt) => {
// Upon a manual sync we are going to forget about existing data so we can sync all again
this.plugin.syncedRecordingIds = [];
Expand Down

0 comments on commit 5b77aff

Please sign in to comment.