Skip to content
This repository has been archived by the owner on Oct 13, 2023. It is now read-only.

Commit

Permalink
Merge branch 'master' into stable
Browse files Browse the repository at this point in the history
  • Loading branch information
TheGoddessInari committed Mar 3, 2022
2 parents 7bbb2c6 + aeb5a15 commit 32d4407
Show file tree
Hide file tree
Showing 14 changed files with 9,304 additions and 3,652 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
[dependencies]: https://img.shields.io/david/TheGoddessInari/hamsket.svg
[dev-dependencies]: https://img.shields.io/david/dev/TheGoddessInari/hamsket.svg

##### Nightly build artifacts are available in Windows ([Win64](https://github.com/TheGoddessInari/hamsket/releases/download/nightly/Hamsket.Setup.0.6.2.exe)), Mac ([DMG](https://github.com/TheGoddessInari/hamsket/releases/download/nightly/Hamsket-0.6.2.dmg) / [App](https://github.com/TheGoddessInari/hamsket/releases/download/nightly/Hamsket-0.6.2-mac.zip)), and Linux ([AppImage64](https://github.com/TheGoddessInari/hamsket/releases/download/nightly/Hamsket-0.6.2.AppImage) / [RPM64](https://github.com/TheGoddessInari/hamsket/releases/download/nightly/Hamsket-0.6.2.x86_64.rpm) / [DEB64](https://github.com/TheGoddessInari/hamsket/releases/download/nightly/Hamsket_0.6.2_amd64.deb) / [Tarball64](https://github.com/TheGoddessInari/hamsket/releases/download/nightly/Hamsket-0.6.2.tar.gz)) packaging flavors. <!-- omit in toc -->
##### Nightly build artifacts are available in Windows ([Win64](https://github.com/TheGoddessInari/hamsket/releases/download/nightly/Hamsket.Setup.0.6.3.exe)), Mac ([DMG](https://github.com/TheGoddessInari/hamsket/releases/download/nightly/Hamsket-0.6.3.dmg) / [App](https://github.com/TheGoddessInari/hamsket/releases/download/nightly/Hamsket-0.6.3-mac.zip)), and Linux ([AppImage64](https://github.com/TheGoddessInari/hamsket/releases/download/nightly/Hamsket-0.6.3.AppImage) / [RPM64](https://github.com/TheGoddessInari/hamsket/releases/download/nightly/Hamsket-0.6.3.x86_64.rpm) / [DEB64](https://github.com/TheGoddessInari/hamsket/releases/download/nightly/Hamsket_0.6.3_amd64.deb) / [Tarball64](https://github.com/TheGoddessInari/hamsket/releases/download/nightly/Hamsket-0.6.3.tar.gz)) packaging flavors. <!-- omit in toc -->

###### Logo designed by [Andriy Yurchenko](http://andyur.com/). <!-- omit in toc -->

Expand Down Expand Up @@ -217,9 +217,9 @@ Keep in mind, I'm not pushing this. I'll do my best regardless.
To build your own copy, you need:

- An 8.0 version of the [Java SE Development Kit](http://www.oracle.com/technetwork/java/javase/downloads/index.html).
- [Ruby](https://www.ruby-lang.org/en/downloads/) 2.3 or newer.
- [Ruby](https://www.ruby-lang.org/en/downloads/) >2.3 && <3.0.
- [Sencha CMD](https://www.sencha.com/products/extjs/cmd-download/) 6.7.0 or newer, and to install it with the Compass extension.
- [NodeJS](https://nodejs.org/en/download/) 8.5.0 (10.0+ preferred) or newer with npm.
- [NodeJS](https://nodejs.org/en/download/) 14.x or newer with npm.

These **need** to be added to your PATH.

Expand Down
6 changes: 3 additions & 3 deletions app/Application.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@ Ext.define('Hamsket.Application', {


// Set cookies to help Tooltip.io messages segmentation
Ext.util.Cookies.set('version', require('electron').remote.app.getVersion());
Ext.util.Cookies.set('version', require('@electron/remote').app.getVersion());

// Check for updates
if ( require('electron').remote.process.argv.indexOf('--without-update') === -1 ) Hamsket.app.checkUpdate(true);
if ( require('@electron/remote').process.argv.indexOf('--without-update') === -1 ) Hamsket.app.checkUpdate(true);

// Mouse Wheel zooming
document.addEventListener('mousewheel', function(e) {
Expand Down Expand Up @@ -85,7 +85,7 @@ Ext.define('Hamsket.Application', {
,method: 'GET'
,success(response) {
const json = JSON.parse(response.responseText);
const appVersion = new Ext.Version(require('electron').remote.app.getVersion());
const appVersion = new Ext.Version(require('@electron/remote').app.getVersion());
const updateVersion = new Ext.Version(json.tag_name);
if ( appVersion.isLessThan(updateVersion) ) {
console.info('New version is available', updateVersion);
Expand Down
25 changes: 8 additions & 17 deletions app/store/ServicesList.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ Ext.define('Hamsket.store.ServicesList', {
,description: locale['services[0]']
,url: 'https://web.whatsapp.com/'
,type: 'messaging'
,js_unread: `let checkUnread=()=>{const elements=document.querySelectorAll("#pane-side .VOr2j");let count=0;for(const i of elements){const gp=i.parentNode.parentNode;0===gp.querySelectorAll('#pane-side *[data-icon="muted"]').length&&count++}hamsket.updateBadge(count)};setInterval(checkUnread,1e3);let unregister_queue=[];navigator.serviceWorker.getRegistrations().then(registrations=>{for(const registration of registrations)unregister_queue.push(registration.unregister());return unregister_queue}).then(queue=>{}).catch(err=>{});`
,js_unread: `let checkUnread=()=>{const elements=document.querySelectorAll("#pane-side ._23LrM");let count=0;for(const i of elements){const gp=i.parentNode.parentNode;0===gp.querySelectorAll('#pane-side *[data-icon="muted"]').length&&count++}hamsket.updateBadge(count)};setInterval(checkUnread,1e3);let unregister_queue=[];navigator.serviceWorker.getRegistrations().then(registrations=>{for(const registration of registrations)unregister_queue.push(registration.unregister());return unregister_queue}).then(queue=>{}).catch(err=>{});`
},
{
id: 'slack'
Expand Down Expand Up @@ -56,6 +56,7 @@ Ext.define('Hamsket.store.ServicesList', {
,type: 'messaging'
,titleBlink: true
,note: 'To enable desktop notifications, you have to go to Options inside Messenger.'
,js_unread: `const titleTest=new RegExp("^\\((\\d+)\\)"),checkUnread=()=>{let count=0;const isNotification=titleTest.test(document.title);isNotification?count=hamsket.parseIntOrZero(titleTest.exec(document.title)[1]):(count=document.querySelectorAll("._5fx8:not(._569x),._1ht3:not(._569x)").length,0===count&&(count=document.querySelectorAll(".pq6dq46d.is6700om.qu0x051f.esr5mh6w.e9989ue4.r7d6kgcz.s45kfl79.emlxlaya.bkmhp75w.spb7xbtv.cyypbtt7.fwizqjfa").length));const messageRequests=document.querySelector("._5nxf");messageRequests&&(count+=hamsket.parseIntOrZero(messageRequests.textContent)),hamsket.updateBadge(count)};setInterval(checkUnread,3e3);`
},
{
id: 'skype'
Expand All @@ -75,7 +76,7 @@ Ext.define('Hamsket.store.ServicesList', {
,type: 'messaging'
,titleBlink: true
,manual_notifications: true
,js_unread: `let checkUnread=()=>{let myframe=document.getElementById("hangout-landing-chat").lastChild,mydocument=myframe.contentDocument||myframe.contentWindow.document;hamsket.updateBadge(mydocument.body.getElementsByClassName("ee").length)};setInterval(checkUnread,3e3);`
,js_unread: `const checkUnread=()=>{const myframe=document.querySelector("#hangout-landing-chat iframe"),mydocument=myframe&&"contentDocument"in myframe?myframe.contentDocument:myframe.contentWindow.document,count=mydocument?mydocument.body.querySelectorAll(".ee").length:0;hamsket.updateBadge(count)};setInterval(checkUnread,3e3);`
},
{
id: 'hipchat'
Expand All @@ -94,7 +95,7 @@ Ext.define('Hamsket.store.ServicesList', {
,description: locale['services[7]']
,url: 'https://web.telegram.org/'
,type: 'messaging'
,js_unread: `let checkUnread=()=>{const e=document.getElementsByClassName("im_dialog_badge badge");let t=0;for(let i of e)i.classList.contains("im_dialog_badge_muted")||(t+=parseInt(i.innerHTML.trim()));hamsket.updateBadge(t)};setInterval(checkUnread,3e3);`
,js_unread: `const checkUnread=()=>{const unread_messages=document.querySelectorAll(".badge.unread:not(.is-muted), .Badge.unread:not(.muted)");let count=0;for(const unread of unread_messages)count+=hamsket.parseIntOrZero(unread.textContent.trim());hamsket.updateBadge(count)};setInterval(checkUnread,3e3);`
},
{
id: 'wechat'
Expand Down Expand Up @@ -169,7 +170,7 @@ Ext.define('Hamsket.store.ServicesList', {
,url: 'https://discordapp.com/login'
,type: 'messaging'
,titleBlink: true
,js_unread: `let getMentionCount=badges=>{let alerts=0;for(const badge of badges)alerts+=parseInt(badge.innerText,10)||0;return alerts},getServerUnread=badges=>{let alerts=0;for(const badge of badges)alerts+="1"===badge.style.opacity&&"8px"===badge.style.height?1:0;return alerts},checkUnread=()=>{const mentions=document.querySelectorAll(".lowerBadge-29hYVK > .numberBadge-2s8kKX");unread=document.getElementsByClassName("item-2hkk8m");const direct=getMentionCount(mentions);let indirect=getServerUnread(unread);indirect+=document.getElementsByClassName("unread-3zKkbm").length,hamsket.updateBadge(direct,indirect)};setInterval(checkUnread,3e3);`
,js_unread: `const getMentionCount=badges=>{let alerts=0;for(const badge of badges)alerts+=hamsket.parseIntOrZero(badge.textContent);return alerts},getServerUnread=badges=>{let alerts=0;for(const badge of badges)alerts+="1"===badge.style.opacity&&"8px"===badge.style.height?1:0;return alerts},checkUnread=()=>{const mentions=document.querySelectorAll('[class*="lowerBadge-"] > [class*="numberBadge-"]'),unread=document.querySelectorAll('[class*="pill-"] > [class*="item-"]'),direct=getMentionCount(mentions),indirect=getServerUnread(unread);hamsket.updateBadge(direct,indirect)};setInterval(checkUnread,3e3);`
,note: 'To enable desktop notifications, you have to go to Options inside Discord.'
},
{
Expand All @@ -180,7 +181,7 @@ Ext.define('Hamsket.store.ServicesList', {
,url: 'https://mail.live.com/'
,type: 'email'
,manual_notifications: true
,js_unread: `let checkUnread=()=>{const fav=$(".ms-FocusZone [role=tree]:first i[data-icon-name=Inbox]").siblings()[1],folders=$(".ms-FocusZone [role=tree]:nth(1)")[0].children[1].querySelector("span span"),innerText=fav?fav.innerText:folders?folders.innerText:0,i=parseInt(innerText,10)||0;hamsket.updateBadge(i)};setInterval(checkUnread,3e3);`
,js_unread: `let checkUnread=()=>{const fav=document.querySelector(".ms-FocusZone [role=tree] i[data-icon-name=Inbox]").parentNode.parentNode.lastElementChild,folders=document.querySelectorAll(".ms-FocusZone [role=tree]")[1].children[1].querySelector("span span"),textContent=fav?fav.textContent:folders?folders.textContent:0,count=hamsket.parseIntOrZero(textContent);hamsket.updateBadge(count)};setInterval(checkUnread,3e3);`
},
{
id: 'outlook365'
Expand All @@ -190,7 +191,7 @@ Ext.define('Hamsket.store.ServicesList', {
,url: 'https://outlook.office.com/owa/'
,type: 'email'
,manual_notifications: true
,js_unread: `let checkUnread=()=>{const fav=$(".ms-FocusZone [role=tree]:first i[data-icon-name=Inbox]").siblings()[1],folders=$(".ms-FocusZone [role=tree]:nth(1)")[0].children[1].querySelector("span span"),innerText=fav?fav.innerText:folders?folders.innerText:0,i=parseInt(innerText,10)||0;hamsket.updateBadge(i)};setInterval(checkUnread,3e3);`
,js_unread: `let checkUnread=()=>{const inbox=document.querySelector(".ms-FocusZone i[data-icon-name=Inbox]").parentNode.parentNode.querySelector("span span"),result=inbox?inbox.textContent:0,count=hamsket.parseIntOrZero(result);hamsket.updateBadge(count)};setInterval(checkUnread,3e3);`
},
{
id: 'yahoo'
Expand Down Expand Up @@ -550,16 +551,6 @@ Ext.define('Hamsket.store.ServicesList', {
,url: 'https://www.pushbullet.com/'
,type: 'messaging'
},
{
id: 'riot'
,logo: 'riot.png'
,name: 'Riot (deprecated)'
,description: 'Riot is a simple and elegant collaboration environment that gathers all of your different conversations and app integrations into one single app.'
,url: 'https://riot.im/app/'
,type: 'messaging'
,js_unread: `let checkUnread=()=>{const a=document.getElementsByClassName("mx_RoomTile_nameContainer");let b=0;for(let i of a){const c=i.getElementsByClassName("mx_RoomTile_badge");for(let ii of c){const iiTrim=parseInt(ii.textContent.trim());iiTrim%1==0&&(b+=iiTrim)}}hamsket.updateBadge(b)};setInterval(checkUnread,1e3);`
,custom_domain: true
},
{
id: 'Element'
,logo: 'element.png'
Expand Down Expand Up @@ -775,7 +766,7 @@ Ext.define('Hamsket.store.ServicesList', {
,url: 'https://mastodon.social/auth/sign_in'
,type: 'messaging'
,custom_domain: true
,note: '<a href="https://instances.mastodon.xyz/" target="_blank">List of instances</a>'
,note: '<a href="https://instances.social/" target="_blank">List of instances</a>'
},
{
id: 'teamworkchat'
Expand Down
11 changes: 7 additions & 4 deletions app/util/IconLoader.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,9 @@ Ext.define('Hamsket.util.IconLoader', {
this.loadServiceIconUrl = function (service, webview) {
switch (service.type) {
case 'slack':
setTimeout( () =>
webview.executeJavaScript(
setTimeout( () => {
const service_name = Ext.String.htmlEncode(service.record.get('name'));
webview.executeJavaScript(
`(() => {
let icon = document.querySelector('.c-team_icon');
if (!icon) {
Expand All @@ -39,12 +40,14 @@ Ext.define('Hamsket.util.IconLoader', {
return bg.slice(5, -2);
})();`).then(function (backgroundImage) {
if (backgroundImage) {
service.setTitle(`<img src="${backgroundImage}" width="" style="background-color: white;border-radius: 50%;position: absolute;left: 18px;top: 17px;width: 12px;">${Ext.String.htmlEncode(service.title)}`);
service.setTitle(`<img src="${backgroundImage}" width="" style="background-color: white;border-radius: 50%;position: absolute;left: 18px;top: 17px;width: 12px;">${service_name}`);
service.fireEvent('iconchange', service, backgroundImage, service.icon);
}
return true;
}
).finally({}), 1000);
).catch(err => {
console.error(`Slack IconLoader - ${service_name}: ${err}`);
});}, 1000);
break;
default:
break;
Expand Down
2 changes: 1 addition & 1 deletion app/ux/FileBackup.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Ext.define('Hamsket.ux.FileBackup', {
constructor() {
const me = this;
me.callParent(arguments);
me.remote = require('electron').remote;
me.remote = require('@electron/remote');
me.path = me.remote.require('path');
me.fs = me.remote.require('fs');
me.userPath = me.remote.app.getPath('userData');
Expand Down

0 comments on commit 32d4407

Please sign in to comment.