Compare commits

...

2 commits

Author SHA1 Message Date
themancalledjakob
2ba83ea3fe updater
- introduce updater.host
- allow dev branch
- minor improvements
2024-11-21 14:32:29 +01:00
themancalledjakob
cd6457352b fix updater zipball 2024-11-16 15:13:34 +01:00
2 changed files with 13 additions and 5 deletions

View file

@ -1740,11 +1740,15 @@ class ForgejoEngine:
"""Integration to Forgejo/Gitea API""" """Integration to Forgejo/Gitea API"""
def __init__(self): def __init__(self):
self.api_url = 'https://git.pointer.click' # the api_url may be overwritten by form_repo_url
# if updater.host is set
self.api_url = 'https://codeberg.org'
self.token = None self.token = None
self.name = "forgejo" self.name = "forgejo"
def form_repo_url(self, updater): def form_repo_url(self, updater):
if updater.host:
self.api_url = "https://" + updater.host
return "{}/api/v1/repos/{}/{}".format(self.api_url, updater.user, updater.repo) return "{}/api/v1/repos/{}/{}".format(self.api_url, updater.user, updater.repo)
def form_tags_url(self, updater): def form_tags_url(self, updater):
@ -1775,7 +1779,7 @@ class ForgejoEngine:
return [ return [
{ {
"name": tag["name"], "name": tag["name"],
"zipball_url": self.get_zip_url(tag["commit"]["id"], updater) "zipball_url": self.get_zip_url(tag["commit"]["sha"], updater)
} for tag in response] } for tag in response]

View file

@ -72,7 +72,7 @@ except Exception as e:
# not match and have errors. Must be all lowercase and no spaces! Should also # not match and have errors. Must be all lowercase and no spaces! Should also
# be unique among any other addons that could exist (using this updater code), # be unique among any other addons that could exist (using this updater code),
# to avoid clashes in operator registration. # to avoid clashes in operator registration.
updater.addon = "addon_updater_demo" updater.addon = "abc3d"
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
@ -1346,6 +1346,10 @@ def register(bl_info):
# updater.engine = "GitLab" # updater.engine = "GitLab"
# updater.engine = "Bitbucket" # updater.engine = "Bitbucket"
# set your host.
# only Forgejo. (codeberg.org is default if not specified).
updater.host = "git.pointer.click"
# If using private repository, indicate the token here. # If using private repository, indicate the token here.
# Must be set after assigning the engine. # Must be set after assigning the engine.
# **WARNING** Depending on the engine, this token can act like a password!! # **WARNING** Depending on the engine, this token can act like a password!!
@ -1392,7 +1396,7 @@ def register(bl_info):
updater.backup_current = True # True by default updater.backup_current = True # True by default
# Sample ignore patterns for when creating backup of current during update. # Sample ignore patterns for when creating backup of current during update.
updater.backup_ignore_patterns = ["__pycache__"] updater.backup_ignore_patterns = [".git", "__pycache__", "*.bat", ".gitignore", "*.exe"]
# Alternate example patterns: # Alternate example patterns:
# updater.backup_ignore_patterns = [".git", "__pycache__", "*.bat", ".gitignore", "*.exe"] # updater.backup_ignore_patterns = [".git", "__pycache__", "*.bat", ".gitignore", "*.exe"]
@ -1461,7 +1465,7 @@ def register(bl_info):
# Note: updater.include_branch_list defaults to ['master'] branch if set to # Note: updater.include_branch_list defaults to ['master'] branch if set to
# none. Example targeting another multiple branches allowed to pull from: # none. Example targeting another multiple branches allowed to pull from:
# updater.include_branch_list = ['master', 'dev'] # updater.include_branch_list = ['master', 'dev']
updater.include_branch_list = ['main'] # None is the equivalent = ['master'] updater.include_branch_list = ['main', 'dev'] # None is the equivalent = ['master']
# Only allow manual install, thus prompting the user to open # Only allow manual install, thus prompting the user to open
# the addon's web page to download, specifically: updater.website # the addon's web page to download, specifically: updater.website