Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions locales/locales.csv
Original file line number Diff line number Diff line change
Expand Up @@ -236,3 +236,15 @@ settings-font-outline-color-settings-subtitle;Standardfarbe der Schriftumrandung
settings-font-outline-width-settings-header;Dicke der Schriftumrandung;Width of the outline;Taille du contour;Ancho del contorno;Largura do contorno
settings-font-outline-width-settings-subtitle;Standarddicke der Schriftumrandung;Default width of the outline;Taille par défaut du contour;Ancho predeterminado del contorno;Largura padrão do contorno
support;Unterstützen;Donate;Faites un don;Donar;Doar
store.info.source.title;Quelle;Source;Source;Fuente;Fonte
store.info.source.description;Wähle ob die Store-Version, ein Git-Branch oder ein Git-Tag verwendet werden soll;Choose to use the store version, a git branch, or a git tag;Choisissez d'utiliser la version du magasin, une branche git ou un tag git;Elija usar la versión de la tienda, una rama git o un tag git;Escolha usar a versão da loja, um branch ou uma tag git
store.info.source.branch-row.title;Quelle;Source;Source;Fuente;Fonte
store.info.source.branch-row.subtitle;Store-Version, Branch oder Tag auswählen;Select store version, branch, or tag;Sélectionnez la version du magasin, une branche ou un tag;Seleccione la versión de la tienda, rama o tag;Selecione a versão da loja, branch ou tag
store.info.source.refresh.tooltip;Branches und Tags von GitHub aktualisieren;Refresh branches and tags from GitHub;Actualiser les branches et tags depuis GitHub;Actualizar ramas y tags desde GitHub;Atualizar branches e tags do GitHub
store.info.source.status.title;Aktueller Status;Current Status;État actuel;Estado actual;Status atual
store.info.source.status.using-branch;Verwendet Git-Branch: {branch};Using git branch: {branch};Utilisation de la branche git: {branch};Usando rama git: {branch};Usando branch git: {branch}
store.info.source.status.using-ref;Verwendet Git-Ref: {ref};Using git ref: {ref};Utilisation de la ref git: {ref};Usando ref git: {ref};Usando ref git: {ref}
store.info.source.status.using-store;Verwendet Store-Version;Using store version;Utilisation de la version du magasin;Usando versión de la tienda;Usando versão da loja
store.info.source.store-version;Store-Version (empfohlen);Store Version (Recommended);Version du magasin (recommandée);Versión de la tienda (recomendada);Versão da Loja (Recomendada)
store.info.source.apply.title;Jetzt anwenden;Apply Now;Appliquer maintenant;Aplicar ahora;Aplicar Agora
store.info.source.apply.subtitle;Plugin mit der ausgewählten Quelle neu installieren;Reinstall plugin with the selected source;Réinstaller le plugin avec la source sélectionnée;Reinstalar el plugin con la fuente seleccionada;Reinstalar plugin com a fonte selecionada
129 changes: 118 additions & 11 deletions src/backend/Store/StoreBackend.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,83 @@ def get_custom_plugins(self) -> list[tuple[str, str]]:

return plugins

def get_plugin_git_override(self, plugin_id: str) -> dict | None:
"""
Get the git override settings for a plugin.
Returns dict with 'branch' key if override exists, None otherwise.
"""
if plugin_id is None:
return None

settings = gl.settings_manager.get_app_settings()
overrides = settings.get("store", {}).get("plugin-git-overrides", {})
return overrides.get(plugin_id)

def set_plugin_git_override(self, plugin_id: str, branch: str | None):
"""
Set a git override for a plugin. If branch is None or empty, removes the override.
"""
if plugin_id is None:
return

settings = gl.settings_manager.get_app_settings()
settings.setdefault("store", {})
settings["store"].setdefault("plugin-git-overrides", {})

if branch is None or branch.strip() == "":
if plugin_id in settings["store"]["plugin-git-overrides"]:
del settings["store"]["plugin-git-overrides"][plugin_id]
else:
settings["store"]["plugin-git-overrides"][plugin_id] = {"branch": branch.strip()}

gl.settings_manager.save_app_settings(settings)

def remove_plugin_git_override(self, plugin_id: str):
"""Remove git override for a plugin (use store version)."""
self.set_plugin_git_override(plugin_id, None)

async def get_repo_branches(self, repo_url: str) -> list[str] | None:
"""
Fetch available branches from a GitHub repository.
Returns list of branch names or None on error.
"""
try:
user_name = self.get_user_name(repo_url)
repo_name = self.get_repo_name(repo_url)
url = f"https://api.github.com/repos/{user_name}/{repo_name}/branches?per_page=100"
response = requests.get(url)

if response.status_code != 200:
log.error(f"Failed to fetch branches for {repo_url}: {response.status_code}")
return None

branches = response.json()
return [branch["name"] for branch in branches]
except Exception as e:
log.error(f"Error fetching branches for {repo_url}: {e}")
return None

async def get_repo_tags(self, repo_url: str) -> list[str] | None:
"""
Fetch available tags from a GitHub repository.
Returns list of tag names or None on error.
"""
try:
user_name = self.get_user_name(repo_url)
repo_name = self.get_repo_name(repo_url)
url = f"https://api.github.com/repos/{user_name}/{repo_name}/tags?per_page=100"
response = requests.get(url)

if response.status_code != 200:
log.error(f"Failed to fetch tags for {repo_url}: {response.status_code}")
return None

tags = response.json()
return [tag["name"] for tag in tags]
except Exception as e:
log.error(f"Error fetching tags for {repo_url}: {e}")
return None

async def get_official_store_branch(self) -> str:
if self.official_store_branch_cache is not None:
return self.official_store_branch_cache
Expand Down Expand Up @@ -317,18 +394,46 @@ async def prepare_plugin(self, plugin, include_image: bool = True, verified: boo
# Check if suitable version is available
compatible = True
commit: str = None
branch = plugin.get("branch")
using_git_override = False

# First, try to get manifest to determine plugin_id for override check
# We need to do a preliminary check to see if there's an override
temp_commit = None
if "commits" in plugin:
version = self.get_newest_compatible_version(plugin["commits"])
if version is None:
compatible = False
version = self.get_newest_version(list(plugin["commits"].keys()))
temp_version = self.get_newest_compatible_version(plugin["commits"])
if temp_version is None:
temp_version = self.get_newest_version(list(plugin["commits"].keys()))
if temp_version:
temp_commit = plugin["commits"][temp_version]

# Get manifest to find plugin_id
temp_manifest = await self.get_manifest(url, temp_commit or branch or "main")
plugin_id = None
if temp_manifest and not isinstance(temp_manifest, NoConnectionError):
plugin_id = temp_manifest.get("id")

# Check for git override
if plugin_id:
override = self.get_plugin_git_override(plugin_id)
if override and override.get("branch"):
branch = override["branch"]
using_git_override = True
commit = await self.get_last_commit(url, branch)

# If no override, use normal logic
if not using_git_override:
if "commits" in plugin:
version = self.get_newest_compatible_version(plugin["commits"])
if version is None:
return NoCompatibleVersion #TODO
commit = plugin["commits"][version]
compatible = False
version = self.get_newest_version(list(plugin["commits"].keys()))
if version is None:
return NoCompatibleVersion #TODO
commit = plugin["commits"][version]

branch = plugin.get("branch")
if branch is not None:
commit = await self.get_last_commit(url, branch)
if branch is not None:
commit = await self.get_last_commit(url, branch)

manifest = await self.get_manifest(url, commit or branch)
if isinstance(manifest, NoConnectionError):
Expand Down Expand Up @@ -387,7 +492,8 @@ async def prepare_plugin(self, plugin, include_image: bool = True, verified: boo
plugin_id=manifest.get("id") or None,

is_compatible=compatible,
verified=verified
verified=verified,
using_git_override=using_git_override
)

def get_current_git_commit_hash_without_git(self, repo_path: str) -> str:
Expand Down Expand Up @@ -851,7 +957,8 @@ async def clone_repo(self, repo_url:str, local_path:str, commit_sha:str = None,
return

if branch_name is not None:
await self.os_sys(f"cd '{local_path}' && git switch {branch_name}")
# Use git checkout (not git switch) - works for both branches and tags
await self.os_sys(f"cd '{local_path}' && git checkout {branch_name}")
return


Expand Down
3 changes: 2 additions & 1 deletion src/windows/Store/Icons/IconPage.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,4 +134,5 @@ def on_click_main(self, button: Gtk.Button):
self.icon_page.info_page.set_license(self.icon_data.license)
self.icon_page.info_page.set_copyright(self.icon_data.copyright)
self.icon_page.info_page.set_original_url(self.icon_data.original_url)
self.icon_page.info_page.set_license_description(self.icon_data.license_descriptions)
self.icon_page.info_page.set_license_description(self.icon_data.license_descriptions)
self.icon_page.info_page.clear_plugin_data()
Loading