Skip to content

Commit

Permalink
fix notifications with bencode packet encoder
Browse files Browse the repository at this point in the history
  • Loading branch information
totaam committed Feb 7, 2022
1 parent 8e69aa1 commit a9292f3
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion html5/js/Client.js
Original file line number Diff line number Diff line change
Expand Up @@ -3032,7 +3032,7 @@ XpraClient.prototype._process_notify_show = function(packet, ctx) {
function notify() {
let icon_url = "";
if (icon && icon[0]=="png") {
icon_url = "data:image/png;base64," + Utilities.ArrayBufferToBase64(icon[3]);
icon_url = "data:image/png;base64," + Utilities.ToBase64(icon[3]);
console.log("notification icon_url=", icon_url);
}
/*
Expand Down
9 changes: 9 additions & 0 deletions html5/js/Utilities.js
Original file line number Diff line number Diff line change
Expand Up @@ -460,6 +460,15 @@ const Utilities = {
return window.btoa(s);
},

ToBase64 : function(v) {
try {
return window.btoa(v);
}
catch (e) {
return ArrayBufferToBase64(v);
}
},

convertDataURIToBinary : function (dataURI) {
const BASE64_MARKER = ';base64,';
const base64Index = dataURI.indexOf(BASE64_MARKER) + BASE64_MARKER.length;
Expand Down

0 comments on commit a9292f3

Please sign in to comment.