mirror of
https://github.com/zulip/zulip-desktop.git
synced 2025-10-25 17:13:35 +00:00
27 lines
444 B
JavaScript
27 lines
444 B
JavaScript
'use strict';
|
|
|
|
const wurl = require('wurl');
|
|
|
|
let instance = null;
|
|
|
|
class LinkUtil {
|
|
constructor() {
|
|
if (instance) {
|
|
return instance;
|
|
} else {
|
|
instance = this;
|
|
}
|
|
|
|
return instance;
|
|
}
|
|
|
|
isInternal(currentUrl, newUrl) {
|
|
const currentDomain = wurl('hostname', currentUrl);
|
|
const newDomain = wurl('hostname', newUrl);
|
|
|
|
return (currentDomain === newDomain) && newUrl.includes('/#narrow');
|
|
}
|
|
}
|
|
|
|
module.exports = new LinkUtil();
|