Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions recipes/msteams-personal/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
module.exports = Ferdium =>
class MicrosoftTeams extends Ferdium {
overrideUserAgent() {
return window.navigator.userAgent
.replaceAll(/(Ferdium|Electron)\/\S+ \([^)]+\)/g, '')
.trim();
}

// TODO: Commenting out since this can expose the user to a MITM attack. Before this can be turned on, we will need to put in some safeguards/warnings that the user can explicitly accept the security ramifications
// // https://docs.microsoft.com/en-us/microsoftteams/troubleshoot/teams-sign-in/sign-in-loop#resolution
// knownCertificateHosts() {
// return [
// 'microsoft.com',
// 'microsoftonline.com',
// 'teams.skype.com',
// 'teams.microsoft.com',
// 'sfbassets.com',
// 'skypeforbusiness.com',
// ];
// };
};
16 changes: 16 additions & 0 deletions recipes/msteams-personal/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"id": "msteams-personal",
"name": "Microsoft Teams Personal",
"version": "3.3.2",
"license": "MIT",
"aliases": [
"teamsChat"
],
"config": {
"serviceURL": "https://teams.live.com",
"hasNotificationSound": true,
"hasIndirectMessages": true
},
"defaultIcon": "https://cdn.jsdelivr.net/gh/ferdium/ferdium-recipes@main/recipes/msteams/icon.svg",
"message": "Use this to fix logouts when using the Personal team (teams.live.com). For 365-based teams (teams.microsoft.com) use the default Microsoft Teams service."
}
63 changes: 63 additions & 0 deletions recipes/msteams-personal/service.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
notification-banner {
display: none !important;
}
.desktop-capturer-selection {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100vh;
background: rgba(30,30,30,.75);
color: #fff;
z-index: 10000000;
display: flex;
align-items: center;
justify-content: center;
}
.desktop-capturer-selection__scroller {
width: 100%;
max-height: 100vh;
overflow-y: auto;
}
.desktop-capturer-selection__list {
max-width: calc(100% - 100px);
margin: 50px;
padding: 0;
display: flex;
flex-wrap: wrap;
list-style: none;
overflow: hidden;
justify-content: center;
}
.desktop-capturer-selection__item {
display: flex;
margin: 4px;
}
.desktop-capturer-selection__btn {
display: flex;
flex-direction: column;
align-items: stretch;
width: 145px;
margin: 0;
border: 0;
border-radius: 3px;
padding: 4px;
background: #252626;
text-align: left;
transition: background-color .15s, box-shadow .15s;
}
.desktop-capturer-selection__btn:hover,
.desktop-capturer-selection__btn:focus {
background: rgba(98,100,167,.8);
}
.desktop-capturer-selection__thumbnail {
width: 100%;
height: 81px;
object-fit: cover;
}
.desktop-capturer-selection__name {
margin: 6px 0 6px;
white-space: nowrap;
text-overflow: ellipsis;
overflow: hidden;
}
5 changes: 5 additions & 0 deletions recipes/msteams-personal/webview-unsafe.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
window.electronSafeIpc = {
send: () => null,
on: () => null,
};
window.desktop = undefined;
41 changes: 41 additions & 0 deletions recipes/msteams-personal/webview.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : { default: obj };
}

const _path = _interopRequireDefault(require('path'));

module.exports = Ferdium => {
const getMessages = () => {
let messages = 0;

const isTeamsV2 = window.location.href.includes('/v2/');

let badges = document.querySelectorAll(
'.activity-badge.dot-activity-badge .activity-badge',
);

if (isTeamsV2) {
badges = document.querySelectorAll('.fui-Badge');
}

if (badges) {
Array.prototype.forEach.call(badges, badge => {
messages += Ferdium.safeParseInt(badge.textContent);
});
}

const indirectMessages =
document.querySelectorAll('.app-bar-mention').length;

Ferdium.setBadge(messages, indirectMessages);
};

window.addEventListener('beforeunload', async () => {
Ferdium.releaseServiceWorkers();
});

Ferdium.loop(getMessages);

Ferdium.injectCSS(_path.default.join(__dirname, 'service.css'));
Ferdium.injectJSUnsafe(_path.default.join(__dirname, 'webview-unsafe.js'));
};