Telegram Web K with changes to work inside I2P
https://web.telegram.i2p/
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
26 lines
573 B
26 lines
573 B
3 years ago
|
import { RestrictionReason } from "../layer";
|
||
|
|
||
|
const platforms = new Set([
|
||
|
'all',
|
||
|
'web',
|
||
|
'webk'
|
||
|
]);
|
||
|
|
||
|
const ignore = new Set();
|
||
|
|
||
|
export function getRestrictionReason(reasons: RestrictionReason[]) {
|
||
|
// return reasons[0];
|
||
|
return reasons.find(reason => platforms.has(reason.platform) && !ignore.has(reason.reason));
|
||
|
}
|
||
|
|
||
|
export function isRestricted(reasons: RestrictionReason[]) {
|
||
|
return !!getRestrictionReason(reasons);
|
||
|
}
|
||
|
|
||
|
export function ignoreRestrictionReasons(reasons: string[]) {
|
||
|
ignore.clear();
|
||
|
reasons.forEach(reason => {
|
||
|
ignore.add(reason);
|
||
|
});
|
||
|
}
|