Skip to content

Commit

Permalink
Allow addon page URL on AddonsDialog (#3467)
Browse files Browse the repository at this point in the history
* Allow users to just copy&paste addon page URL to addon 'code' field.

https://forums.ankiweb.net/t/get-addons-allow-url-on-code-section/36370
  • Loading branch information
phu54321 authored Oct 4, 2024
1 parent 9ced6be commit 761fb76
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
1 change: 1 addition & 0 deletions CONTRIBUTORS
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,7 @@ Taylor Obyen <[email protected]>
Kris Cherven <[email protected]>
twwn <github.com/twwn>
Shirish Pokhrel <[email protected]>
Park Hyunwoo <[email protected]>

********************

Expand Down
7 changes: 6 additions & 1 deletion qt/aqt/addons.py
Original file line number Diff line number Diff line change
Expand Up @@ -1066,7 +1066,12 @@ def onBrowse(self) -> None:
def accept(self) -> None:
# get codes
try:
ids = [int(n) for n in self.form.code.text().split()]
sids = self.form.code.text().split()
sids = [
re.sub(r"^https://ankiweb.net/shared/info/(\d+)$", r"\1", id_)
for id_ in sids
]
ids = [int(id_) for id_ in sids]
except ValueError:
showWarning(tr.addons_invalid_code())
return
Expand Down

0 comments on commit 761fb76

Please sign in to comment.