Allow addon page URL on AddonsDialog (#3467)

* 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
This commit is contained in:
박현우 2024-10-04 14:02:29 +09:00 committed by GitHub
parent 9ced6be03e
commit 761fb76ba7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 7 additions and 1 deletions

View file

@ -195,6 +195,7 @@ Taylor Obyen <162023405+taylorobyen@users.noreply.github.com>
Kris Cherven <krischerven@gmail.com>
twwn <github.com/twwn>
Shirish Pokhrel <singurty@gmail.com>
Park Hyunwoo <phu54321@naver.com>
********************

View file

@ -1066,7 +1066,12 @@ class GetAddons(QDialog):
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