Skip to content

Commit

Permalink
Fixed import assumed codeDisplay always present.
Browse files Browse the repository at this point in the history
Fixed replace any occurrence of sha string instead of only in param.
Use name if issuer is not present.
Add logger warning to output to stderr for Alfred debugging.
Add import file into workflow configuration and 'ente import' alfred command to run the import.
Make username in subtitle and username in title configurable option in the workflow (useful when you have many totp from the same Issuer).
Added github action to auto release workflow on push of tag matching v*
  • Loading branch information
duckworth committed Sep 14, 2024
1 parent 81cd4fd commit 71f7477
Show file tree
Hide file tree
Showing 6 changed files with 210 additions and 80 deletions.
26 changes: 26 additions & 0 deletions .github/workflows/alfred.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Create Alfred Workflow

on:
push:
tags:
- 'v*'

jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Build Alfred workflow
id: builder
uses: almibarss/build-alfred-workflow@v1
with:
workflow_dir: ente-totp
exclude_patterns: '*.pyc *__pycache__/*'
custom_version: ${{ github.ref_name }}

- name: Release
uses: softprops/action-gh-release@v1
with:
files: ${{ steps.builder.outputs.workflow_file }}
5 changes: 5 additions & 0 deletions ente-totp/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,9 @@ venv/
ENV/
env.bak/
venv.bak/
.envrc

# ide files
.idea/


1 change: 1 addition & 0 deletions ente-totp/.tool-versions
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
python 3.12.3
26 changes: 11 additions & 15 deletions ente-totp/README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
# An Alfred Workflow that uses your Ente Exports

Ente Auth does [not support](https://github.com/ente-io/ente/discussions/716) exporting TOTP codes. To use this project, please export from the Ente app and then manually import them into the workflow's database using the `import` parameter.
Ente Auth CLI does [not support](https://github.com/ente-io/ente/discussions/716) exporting TOTP codes. To use this project, please export from the Ente app and then
and then import them into the workflow's database by choosing the export file using the "Configure Workflow" button
in the workflow setup and then import using the 'ente import' Alfred command.

> [!NOTE] **Note**: In the future, the workflow will take care of the import.
The file can be deleted once imported.

> [!NOTE]
> In the future, the workflow will take care of the import.
> In addtion, once support for exporting codes via CLI is supported, we will use that instead.
## Setup

Expand All @@ -13,16 +19,6 @@ Ente Auth does [not support](https://github.com/ente-io/ente/discussions/716) ex

1. Open Alfred
2. Go to workflows
3. Right click the Ente 2FA workflow and press Open In Finder.
4. Export in plain text your Ente 2FA codes
5. Rename that file to secrets.txt and put it in the folder that got opened previously

![image](https://github.com/user-attachments/assets/0964cb6c-e453-4be9-a8a8-2891001f2762)

It should look something like this

6. Open a terminal
7. Navigate to the folder that got contains the `main.py` file
8. Run `python main.py import secrets.txt`
9. Run `ente` in Alfred and let the database populate

3. Click the Ente 2FA workflow and click the Configure Workflow button
4. Click the file button next to the Ente Export File and browse to the Ente Auth plain text export of your two factor codes
5. Run the alfred command 'ente import'
177 changes: 127 additions & 50 deletions ente-totp/info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,8 @@
<dict>
<key>bundleid</key>
<string></string>
<key>category</key>
<string>Tools</string>
<key>connections</key>
<dict>
<key>0E38FB93-F4AB-4414-AFE5-E10B80176C38</key>
<array>
<dict>
<key>destinationuid</key>
<string>61342121-5F6E-4340-A89B-F4DC5D5A7965</string>
<key>modifiers</key>
<integer>0</integer>
<key>modifiersubtext</key>
<string></string>
<key>vitoclose</key>
<false/>
</dict>
</array>
<key>548A4F34-31FF-4E4B-AD7C-1CA4D8391AAA</key>
<array>
<dict>
Expand Down Expand Up @@ -58,27 +43,6 @@
<string>Ente TOTP Codes</string>
<key>objects</key>
<array>
<dict>
<key>config</key>
<dict>
<key>argumenttype</key>
<integer>0</integer>
<key>keyword</key>
<string>{var:keyword}</string>
<key>subtext</key>
<string>Getting TOTP Codes...</string>
<key>text</key>
<string>{const:alfred_workflow_name}</string>
<key>withspace</key>
<true/>
</dict>
<key>type</key>
<string>alfred.workflow.input.keyword</string>
<key>uid</key>
<string>0E38FB93-F4AB-4414-AFE5-E10B80176C38</string>
<key>version</key>
<integer>1</integer>
</dict>
<dict>
<key>config</key>
<dict>
Expand All @@ -95,11 +59,11 @@
<key>escaping</key>
<integer>102</integer>
<key>keyword</key>
<string>ente</string>
<string>{var:keyword}</string>
<key>queuedelaycustom</key>
<integer>3</integer>
<key>queuedelayimmediatelyinitially</key>
<false/>
<true/>
<key>queuedelaymode</key>
<integer>0</integer>
<key>queuemode</key>
Expand Down Expand Up @@ -159,11 +123,11 @@
<key>focusedappvariablename</key>
<string></string>
<key>hotkey</key>
<integer>0</integer>
<integer>14</integer>
<key>hotmod</key>
<integer>0</integer>
<integer>1703936</integer>
<key>hotstring</key>
<string></string>
<string>E</string>
<key>leftcursor</key>
<false/>
<key>modsmode</key>
Expand All @@ -178,31 +142,83 @@
<key>version</key>
<integer>2</integer>
</dict>
<dict>
<key>config</key>
<dict>
<key>alfredfiltersresults</key>
<false/>
<key>alfredfiltersresultsmatchmode</key>
<integer>0</integer>
<key>argumenttreatemptyqueryasnil</key>
<true/>
<key>argumenttrimmode</key>
<integer>0</integer>
<key>argumenttype</key>
<integer>1</integer>
<key>escaping</key>
<integer>102</integer>
<key>keyword</key>
<string>ente import</string>
<key>queuedelaycustom</key>
<integer>10</integer>
<key>queuedelayimmediatelyinitially</key>
<true/>
<key>queuedelaymode</key>
<integer>2</integer>
<key>queuemode</key>
<integer>1</integer>
<key>runningsubtext</key>
<string>importing....</string>
<key>script</key>
<string>python3 main.py import $export_file_path</string>
<key>scriptargtype</key>
<integer>1</integer>
<key>scriptfile</key>
<string></string>
<key>subtext</key>
<string></string>
<key>title</key>
<string>import your ente data</string>
<key>type</key>
<integer>0</integer>
<key>withspace</key>
<true/>
</dict>
<key>type</key>
<string>alfred.workflow.input.scriptfilter</string>
<key>uid</key>
<string>3101A957-02C3-4D0C-8B13-1C3721459261</string>
<key>version</key>
<integer>3</integer>
</dict>
</array>
<key>readme</key>
<string></string>
<string>An Alfred Workflow that uses your Ente Exports
Ente Auth CLI does not support exporting TOTP codes. To use this project, please export from the Ente app and then import them into the workflow's database by choosing the export file using the "Configure Workflow" button in the workflow setup and then import using the 'ente import' Alfred command.
The file can be deleted once imported.</string>
<key>uidata</key>
<dict>
<key>0E38FB93-F4AB-4414-AFE5-E10B80176C38</key>
<key>3101A957-02C3-4D0C-8B13-1C3721459261</key>
<dict>
<key>xpos</key>
<real>40</real>
<real>250</real>
<key>ypos</key>
<real>75</real>
<real>330</real>
</dict>
<key>548A4F34-31FF-4E4B-AD7C-1CA4D8391AAA</key>
<dict>
<key>xpos</key>
<real>40</real>
<real>30</real>
<key>ypos</key>
<real>220</real>
<real>305</real>
</dict>
<key>61342121-5F6E-4340-A89B-F4DC5D5A7965</key>
<dict>
<key>xpos</key>
<real>310</real>
<real>240</real>
<key>ypos</key>
<real>140</real>
<real>105</real>
</dict>
<key>89FF22C4-362B-4675-AEFA-B15E67898E1B</key>
<dict>
Expand All @@ -218,7 +234,7 @@
<key>config</key>
<dict>
<key>default</key>
<string>code||totp||en</string>
<string>code||totp||en||ea</string>
<key>placeholder</key>
<string>en</string>
<key>required</key>
Expand All @@ -235,7 +251,68 @@
<key>variable</key>
<string>keyword</string>
</dict>
<dict>
<key>config</key>
<dict>
<key>default</key>
<string></string>
<key>filtermode</key>
<integer>2</integer>
<key>placeholder</key>
<string>plain text Ente Auth export</string>
<key>required</key>
<true/>
</dict>
<key>description</key>
<string>Point this to the plain text export file from Ente Auth containing your 2FA data. It can be deleted after initial import.</string>
<key>label</key>
<string>Ente Export File</string>
<key>type</key>
<string>filepicker</string>
<key>variable</key>
<string>export_file_path</string>
</dict>
<dict>
<key>config</key>
<dict>
<key>default</key>
<false/>
<key>required</key>
<false/>
<key>text</key>
<string></string>
</dict>
<key>description</key>
<string></string>
<key>label</key>
<string>include username in results title</string>
<key>type</key>
<string>checkbox</string>
<key>variable</key>
<string>username_in_title</string>
</dict>
<dict>
<key>config</key>
<dict>
<key>default</key>
<true/>
<key>required</key>
<false/>
<key>text</key>
<string></string>
</dict>
<key>description</key>
<string></string>
<key>label</key>
<string>include username in results subtitle</string>
<key>type</key>
<string>checkbox</string>
<key>variable</key>
<string>username_in_subtitle</string>
</dict>
</array>
<key>variablesdontexport</key>
<array/>
<key>version</key>
<string></string>
<key>webaddress</key>
Expand Down
Loading

0 comments on commit 71f7477

Please sign in to comment.