Extensions: support token access for remote repositories
This introduce a new "secret" per-repository property of type password as described by #121856. A token or secret may be used by some non blender.org repositories. This only shows for remote repositories and is shown in the "Add Remote Repository" popup. This commit doesn't implement sending to token to the server which will be implemented separately. Ref !121886 Co-authored-by: Dalai Felinto <dalai@blender.org>
This commit is contained in:
@@ -2137,24 +2137,41 @@ class USERPREF_PT_extensions_repos(Panel):
|
||||
split.prop(active_repo, "remote_url", text="", icon='URL', placeholder="Repository URL")
|
||||
split = row.split()
|
||||
|
||||
if active_repo.use_access_token:
|
||||
access_token_icon = 'LOCKED' if active_repo.access_token else 'UNLOCKED'
|
||||
row = layout.row()
|
||||
split = row.split(factor=0.936)
|
||||
split.prop(active_repo, "access_token", icon=access_token_icon)
|
||||
split = row.split()
|
||||
|
||||
layout.prop(active_repo, "use_sync_on_startup")
|
||||
|
||||
layout_header, layout_panel = layout.panel("advanced", default_closed=True)
|
||||
layout_header.label(text="Advanced")
|
||||
if layout_panel:
|
||||
layout_panel.prop(active_repo, "use_custom_directory")
|
||||
|
||||
row = layout_panel.row()
|
||||
if layout_panel:
|
||||
layout_panel.use_property_split = True
|
||||
|
||||
col = layout_panel.column(align=False, heading="Custom Directory")
|
||||
row = col.row(align=True)
|
||||
sub = row.row(align=True)
|
||||
sub.prop(active_repo, "use_custom_directory", text="")
|
||||
sub = sub.row(align=True)
|
||||
sub.active = active_repo.use_custom_directory
|
||||
if active_repo.use_custom_directory:
|
||||
if active_repo.custom_directory == "":
|
||||
row.alert = True
|
||||
row.prop(active_repo, "custom_directory", text="")
|
||||
sub.alert = True
|
||||
sub.prop(active_repo, "custom_directory", text="")
|
||||
else:
|
||||
# Show the read-only directory property.
|
||||
# Apart from being consistent with the custom directory UI,
|
||||
# prefer a read-only property over a label because this is not necessarily
|
||||
# valid UTF-8 which will raise a Python exception when passed in as text.
|
||||
row.prop(active_repo, "directory", text="")
|
||||
sub.prop(active_repo, "directory", text="")
|
||||
|
||||
if active_repo.use_remote_url:
|
||||
row = layout_panel.row(align=True, heading="Authentication")
|
||||
row.prop(active_repo, "use_access_token")
|
||||
|
||||
layout_panel.prop(active_repo, "use_cache")
|
||||
layout_panel.separator()
|
||||
|
||||
Reference in New Issue
Block a user