Skip to content

Commit

Permalink
Merge pull request #6 from myyk/fix-skip
Browse files Browse the repository at this point in the history
Fix skip
  • Loading branch information
myyk authored Apr 30, 2024
2 parents ee1b009 + c3f5732 commit b7416da
Show file tree
Hide file tree
Showing 22 changed files with 579 additions and 34 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# Project specific ignores
icon.jpg.import
**/generated/updater/assets/*.import

# Godot 4+ specific ignores
.godot/
Expand Down
14 changes: 8 additions & 6 deletions addons/plugin_updater/core/download_update_panel.gd
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,11 @@ func _check_for_updater():
_latest_version = extract_latest_version(response)
var current_version := extract_current_version()

# if the current version is less than the skip version, skip the update
if "ignore_updates_before_version" in config:
var skip_version = SemVer.parse(config.ignore_updates_before_version)
if current_version.is_less_than(skip_version):
# if the current version is less than or equal to the skip version, skip the update
var skip_config = UpdaterConfig.get_skip_config()
if config.plugin_name in skip_config:
var skip_version: SemVer = SemVer.parse(skip_config[config.plugin_name])
if !_latest_version.is_greater(skip_version):
return

# if same version exit here no update need
Expand Down Expand Up @@ -135,9 +136,10 @@ func _colored(message :String, color :Color) -> String:

func _skip_update():
# Store a setting in the config.
config.ignore_updates_before_version = str(_latest_version)
var skip_config = UpdaterConfig.get_skip_config() # Read this again in case it was changed
skip_config[config.plugin_name] = str(_latest_version)
# Write the config into the addons dir so it gets removed on update
UpdaterConfig.save_user_config(config)
UpdaterConfig.save_skip_config(skip_config)

func _on_update_pressed():
hide()
Expand Down
6 changes: 6 additions & 0 deletions addons/plugin_updater/core/plugin-updater.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"plugin_name": "plugin_updater",
"secs_before_check_for_update": 5,
"github_repo": "myyk/godot-plugin-updater",
"editor_plugin_meta": "PluginUpdaterEditorPlugin"
}
26 changes: 20 additions & 6 deletions addons/plugin_updater/core/updater_config.gd
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ extends RefCounted
static var PLUGIN_NAME: String = "PLUGIN_NAME_PLACEHOLDER" # This is replaced when code is generated
const PLUGIN_MAKER_CONFIG_PATH = "res://plugin-updater.json"
const PLUGIN_USER_CONFIG_PATH_FORMAT = "res://addons/%s/generated/updater/plugin-updater.json"
const PLUGIN_SKIP_CONFIG_PATH = "res://.godot/plugin-updater-skip.json"

static func get_user_config() -> Dictionary:
return _get_config(PLUGIN_USER_CONFIG_PATH_FORMAT % PLUGIN_NAME)
Expand All @@ -31,14 +32,27 @@ static func _get_config(path: String) -> Dictionary:

return config

static func save_user_config(config: Dictionary) -> Error:
return _save_config(PLUGIN_USER_CONFIG_PATH_FORMAT % PLUGIN_NAME, config)
# Skip config is a JSON file like:
# {
# "plugin_name_1": "1.0.0"
# "plugin_name_2": "1.2.3"
# }
static func get_skip_config() -> Dictionary:
if !FileAccess.file_exists(PLUGIN_SKIP_CONFIG_PATH):
return {}

var file: FileAccess = FileAccess.open(PLUGIN_SKIP_CONFIG_PATH, FileAccess.READ)
if file == null:
push_error("plugin-updater: Could not open file at " + PLUGIN_SKIP_CONFIG_PATH)
return {}
return JSON.parse_string(file.get_as_text())

static func _save_config(path: String, config: Dictionary) -> Error:
var file: FileAccess = FileAccess.open(path, FileAccess.WRITE)
static func save_skip_config(config: Dictionary) -> Error:
var file: FileAccess = FileAccess.open(PLUGIN_SKIP_CONFIG_PATH, FileAccess.WRITE)
if file == null:
push_error("plugin-updater: Could not open file at " + path)
push_error("plugin-updater: Could not open file at " + PLUGIN_SKIP_CONFIG_PATH)
return FileAccess.get_open_error()
file.store_string(JSON.stringify(config, "\t"))

file.store_string(JSON.stringify(config))
file.close()
return OK
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
[remap]

importer="texture"
type="CompressedTexture2D"
uid="uid://ddxpytkht0m5p"
path="res://.godot/imported/Progress1.svg-057623bb7fc678c8ebfd7e6825cd98b4.ctex"
metadata={
"has_editor_variant": true,
"vram_texture": false
}

[deps]

source_file="res://addons/plugin_updater/generated/updater/assets/Progress1.svg"
dest_files=["res://.godot/imported/Progress1.svg-057623bb7fc678c8ebfd7e6825cd98b4.ctex"]

[params]

compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1
svg/scale=1.0
editor/scale_with_editor_scale=true
editor/convert_colors_with_editor_theme=true
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
[remap]

importer="texture"
type="CompressedTexture2D"
uid="uid://dowca7ike2thl"
path="res://.godot/imported/Progress2.svg-7068e980fabe92b28e1325b5f6d00641.ctex"
metadata={
"has_editor_variant": true,
"vram_texture": false
}

[deps]

source_file="res://addons/plugin_updater/generated/updater/assets/Progress2.svg"
dest_files=["res://.godot/imported/Progress2.svg-7068e980fabe92b28e1325b5f6d00641.ctex"]

[params]

compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1
svg/scale=1.0
editor/scale_with_editor_scale=true
editor/convert_colors_with_editor_theme=true
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
[remap]

importer="texture"
type="CompressedTexture2D"
uid="uid://cwh8md6qipmdw"
path="res://.godot/imported/Progress3.svg-3e76719e48627b96c22a3596f7a8004d.ctex"
metadata={
"has_editor_variant": true,
"vram_texture": false
}

[deps]

source_file="res://addons/plugin_updater/generated/updater/assets/Progress3.svg"
dest_files=["res://.godot/imported/Progress3.svg-3e76719e48627b96c22a3596f7a8004d.ctex"]

[params]

compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1
svg/scale=1.0
editor/scale_with_editor_scale=true
editor/convert_colors_with_editor_theme=true
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
[remap]

importer="texture"
type="CompressedTexture2D"
uid="uid://dm0jpqdjetv2c"
path="res://.godot/imported/Progress4.svg-243be5d576ae8f9e2c9116310ab48f9e.ctex"
metadata={
"has_editor_variant": true,
"vram_texture": false
}

[deps]

source_file="res://addons/plugin_updater/generated/updater/assets/Progress4.svg"
dest_files=["res://.godot/imported/Progress4.svg-243be5d576ae8f9e2c9116310ab48f9e.ctex"]

[params]

compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1
svg/scale=1.0
editor/scale_with_editor_scale=true
editor/convert_colors_with_editor_theme=true
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
[remap]

importer="texture"
type="CompressedTexture2D"
uid="uid://bkj6kjyjyi7cd"
path="res://.godot/imported/Progress5.svg-3b103ebc9dd79bfa1e58646d2a7bfb80.ctex"
metadata={
"has_editor_variant": true,
"vram_texture": false
}

[deps]

source_file="res://addons/plugin_updater/generated/updater/assets/Progress5.svg"
dest_files=["res://.godot/imported/Progress5.svg-3b103ebc9dd79bfa1e58646d2a7bfb80.ctex"]

[params]

compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1
svg/scale=1.0
editor/scale_with_editor_scale=true
editor/convert_colors_with_editor_theme=true
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
[remap]

importer="texture"
type="CompressedTexture2D"
uid="uid://bsljbs1aiyels"
path="res://.godot/imported/Progress6.svg-96a279f3b31690019bc9305be6572c65.ctex"
metadata={
"has_editor_variant": true,
"vram_texture": false
}

[deps]

source_file="res://addons/plugin_updater/generated/updater/assets/Progress6.svg"
dest_files=["res://.godot/imported/Progress6.svg-96a279f3b31690019bc9305be6572c65.ctex"]

[params]

compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1
svg/scale=1.0
editor/scale_with_editor_scale=true
editor/convert_colors_with_editor_theme=true
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
[remap]

importer="texture"
type="CompressedTexture2D"
uid="uid://cct6crbhix7u8"
path="res://.godot/imported/Progress7.svg-d1b3c88fd78d2a2fab65afae59e5a0f0.ctex"
metadata={
"has_editor_variant": true,
"vram_texture": false
}

[deps]

source_file="res://addons/plugin_updater/generated/updater/assets/Progress7.svg"
dest_files=["res://.godot/imported/Progress7.svg-d1b3c88fd78d2a2fab65afae59e5a0f0.ctex"]

[params]

compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1
svg/scale=1.0
editor/scale_with_editor_scale=true
editor/convert_colors_with_editor_theme=true
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
[remap]

importer="texture"
type="CompressedTexture2D"
uid="uid://dqc521iq12a7l"
path="res://.godot/imported/Progress8.svg-52faa4c6db33e7240be790d78f9fba49.ctex"
metadata={
"has_editor_variant": true,
"vram_texture": false
}

[deps]

source_file="res://addons/plugin_updater/generated/updater/assets/Progress8.svg"
dest_files=["res://.godot/imported/Progress8.svg-52faa4c6db33e7240be790d78f9fba49.ctex"]

[params]

compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1
svg/scale=1.0
editor/scale_with_editor_scale=true
editor/convert_colors_with_editor_theme=true
Loading

0 comments on commit b7416da

Please sign in to comment.