Skip to content

Commit

Permalink
Merge pull request linuxmint#5215 from claudiux/SpicesUpdate_fix5167
Browse files Browse the repository at this point in the history
[SpicesUpdate@claudiux] Use of Soup3 (Cinnamon 6.0).
  • Loading branch information
claudiux authored Dec 9, 2023
2 parents 8b4df67 + ef3f026 commit 551a40f
Show file tree
Hide file tree
Showing 5 changed files with 112 additions and 9 deletions.
22 changes: 14 additions & 8 deletions SpicesUpdate@claudiux/files/SpicesUpdate@claudiux/5.6/applet.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ const {
mkdir_with_parents,
file_set_contents,
file_get_contents,
uuid_string_random,
//~ uuid_string_random,
markup_escape_text
} = imports.gi.GLib; //GLib

Expand Down Expand Up @@ -560,9 +560,13 @@ class SpicesUpdate extends IconApplet {
define_http_session() {
if (this._httpSession) Util.unref(this._httpSession);

this._httpSession = new Soup.Session(); // SessionAsync is deprecated. Use Session instead.
this._httpSession.timeout=60;
Soup.Session.prototype.add_feature.call(this._httpSession, new Soup.ProxyResolverDefault());
if (Soup.MAJOR_VERSION == 2) { //Soup2
this._httpSession = new Soup.SessionAsync();
this._httpSession.timeout=60;
Soup.Session.prototype.add_feature.call(this._httpSession, new Soup.ProxyResolverDefault());
} else { // Soup3
this._httpSession = new Soup.Session(); // SessionAsync is deprecated. Use Session instead.
}
}

//monitor_interfaces() {
Expand Down Expand Up @@ -1184,15 +1188,15 @@ class SpicesUpdate extends IconApplet {
}

are_dependencies_installed() {
let _fonts_installed =
let _fonts_installed =
file_new_for_path("/usr/share/fonts/truetype/ancient-scripts/Symbola_hint.ttf").query_exists(null) ||
file_new_for_path("/usr/share/fonts/TTF/Symbola.ttf").query_exists(null) ||
file_new_for_path("/usr/share/fonts/truetype/Symbola.ttf").query_exists(null) ||
file_new_for_path("/usr/share/fonts/gdouros-symbola/Symbola.ttf").query_exists(null) ||
file_new_for_path("%s/.local/share/fonts/Symbola_Hinted.ttf".format(HOME_DIR)).query_exists(null) ||
file_new_for_path("%s/.local/share/fonts/Symbola.ttf".format(HOME_DIR)).query_exists(null) ||
file_new_for_path("%s/.local/share/fonts/Symbola.otf".format(HOME_DIR)).query_exists(null);

if (!_fonts_installed) {
let _ArchlinuxWitnessFile = file_new_for_path("/etc/arch-release");
let _isArchlinux = _ArchlinuxWitnessFile.query_exists(null);
Expand Down Expand Up @@ -1310,10 +1314,11 @@ class SpicesUpdate extends IconApplet {

//Should we renew the cache?
let is_to_download = false;
let currentTime = Math.round(new Date().getTime()/1000.0);

if (jsonFile.query_exists(null)) {
let jsonModifTime = jsonFile.query_info("time::modified", FileQueryInfoFlags.NONE, null).get_modification_time().tv_sec;
let currentTime = Math.round(new Date().getTime()/1000.0);

if (currentTime - jsonModifTime > Math.round(this.refreshInterval/2)) {
// the cache is too old
is_to_download = true
Expand All @@ -1327,7 +1332,8 @@ class SpicesUpdate extends IconApplet {

if (is_to_download === true || this.forceRefresh === true || force === true) {
// replace local json cache file by the remote one
let message = Soup.Message.new("GET", URL_MAP[type] + uuid_string_random());
//~ let message = Soup.Message.new("GET", URL_MAP[type] + uuid_string_random());
let message = Soup.Message.new("GET", URL_MAP[type] + "time=" + currentTime);
this._httpSession.queue_message(message, Lang.bind(this, this._on_response_download_cache, type, force));
this.testblink[type]=null;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
### v6.4.3~20231209
* Fixes #5167. Use of Soup3 (Cinnamon 6.0).
.
### v6.4.2~20230413
* Minor bugfix.

Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"name": "Spices Update",
"max-instances": "1",
"hide-configuration": false,
"version": "6.4.2",
"version": "6.4.3",
"description": "Warns you when installed Spices (applets, desklets, extensions, themes) require an update or new Spices are available.",
"multiversion": true,
"cinnamon-version": [
Expand Down

0 comments on commit 551a40f

Please sign in to comment.