webk v2.1.0.2

This commit is contained in:
octospacc 2024-08-14 23:05:46 +02:00
parent 9870b81ddb
commit 3896a907d8
26 changed files with 207 additions and 48 deletions

View File

@ -1,8 +1,8 @@
VITE_API_ID=1025907
VITE_API_HASH=452b0359b988148995f22ff0f4229750
VITE_VERSION=2.1.0.1
VITE_VERSION_FULL=2.1.0.1 (521)
VITE_BUILD=521
VITE_VERSION=2.1.0.2
VITE_VERSION_FULL=2.1.0.2 (522)
VITE_BUILD=522
VITE_MTPROTO_WORKER=1
VITE_MTPROTO_SW=
VITE_MTPROTO_HTTP=

View File

@ -95,9 +95,7 @@
<div class="tabs-tab page-sign">
<div class="container">
<div class="auth-image">
<svg class="sign-logo" xmlns="http://www.w3.org/2000/svg" width="160" height="160" viewBox="0 0 160 160">
<use href="#logo" />
</svg>
<img src="assets/img/android-chrome-256x256.png" style="width: 100%;"/>
</div>
</div>
</div>

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 22 KiB

View File

@ -0,0 +1 @@
You can see the full list of new features and improvements here: https://t.me/c/2149281820/6 (https://t.me/+ujaob63Vy705Mzgx).

View File

@ -1,9 +1,9 @@
const e={"Login.Title":"Sign in to Telegram","Login.PhoneLabel":"Phone Number","Login.PhoneLabelInvalid":"Phone Number Invalid","Login.KeepSigned":"Keep me signed in","Login.StartText":`Please confirm your country code
const e={"Login.Title":"Sign in to Spaccogram","Login.PhoneLabel":"Phone Number","Login.PhoneLabelInvalid":"Phone Number Invalid","Login.KeepSigned":"Keep me signed in","Login.StartText":`Please confirm your country code
and enter your phone number.`,"Login.Code.SentSms":`We have sent you an SMS
with the code.`,"Login.Code.SentInApp":`We have sent you a message in Telegram
with the code.`,"Login.Code.SentCall":`We will call you and dictate
the code.`,"Login.Code.SentUnknown":`Please check everything
for a code (type: %s)`,"Login.Password.Title":"Enter Your Password","Login.Password.Subtitle":`Your account is protected with
an additional password`,"Login.Register.Subtitle":`Enter your name and add
a profile photo`,PleaseWait:"Please wait...",Code:"Code",LoginPassword:"Password",YourName:"Your Name",FirstName:"First name (required)",LastName:"Last name (optional)",StartMessaging:"Start Messaging",Country:"Country","Contacts.PhoneNumber.Placeholder":"Phone Number","Login.Next":"Next","Login.ContinueOnLanguage":"Continue in English","Login.QR.Title":"Log in to Telegram by QR Code","Login.QR.Help1":"Open Telegram on your phone","Login.QR.Help2":"Go to **Settings** > **Devices** > **Link Desktop Device**","Login.QR.Help3":"Point your phone at this screen to confirm login","Login.QR.Cancel":"Log in by phone Number","Login.QR.Login":"Log in by QR Code","PhoneNumber.Code.Fragment.Info":"Get the code in the Anonymous Numbers section on [Fragment](%1$@)",PHONE_CODE_INVALID:"Invalid code",PHONE_CODE_EXPIRED:"Code expired",PASSWORD_HASH_INVALID:"Incorrect password"};export{e as default};
a profile photo`,PleaseWait:"Please wait...",Code:"Code",LoginPassword:"Password",YourName:"Your Name",FirstName:"First name (required)",LastName:"Last name (optional)",StartMessaging:"Start Messaging",Country:"Country","Contacts.PhoneNumber.Placeholder":"Phone Number","Login.Next":"Next","Login.ContinueOnLanguage":"Continue in English","Login.QR.Title":"Log in to Spaccogram by QR Code","Login.QR.Help1":"Open Telegram on your phone","Login.QR.Help2":"Go to **Settings** > **Devices** > **Link Desktop Device**","Login.QR.Help3":"Point your phone at this screen to confirm login","Login.QR.Cancel":"Log in by phone Number","Login.QR.Login":"Log in by QR Code","PhoneNumber.Code.Fragment.Info":"Get the code in the Anonymous Numbers section on [Fragment](%1$@)",PHONE_CODE_INVALID:"Invalid code",PHONE_CODE_EXPIRED:"Code expired",PASSWORD_HASH_INVALID:"Incorrect password"};export{e as default};
//# sourceMappingURL=langSign-CN-ja8rh.js.map

View File

@ -2448,7 +2448,7 @@ export default class ChatInput {
// this.updateSendBtn();
if((this.chat.type === ChatType.Chat || this.chat.type === ChatType.Discussion) &&
this.chat.bubbles.scrollable.loadedAll.bottom) {
this.chat.bubbles.scrollable.loadedAll.bottom && !stealthMode.isEnabled()) { // octt: //
this.managers.appMessagesManager.readAllHistory(this.chat.peerId, this.chat.threadId);
}

View File

@ -237,7 +237,8 @@ export class ChatReactionsMenu {
}
this.reactions = peerAvailableReactions.reactions;
this.noPacks = this.noSearch = peerAvailableReactions.type !== 'chatReactionsAll';
// octt: use full reaction panel even when not allowed, normal one is buggy (#281)
this.noPacks = this.noSearch = false; // peerAvailableReactions.type !== 'chatReactionsAll';
return this.renderReactions(peerAvailableReactions, availableReactions);
});

View File

@ -136,7 +136,7 @@ export default class ChatTranslation extends PinnedContainer {
});
createEffect(() => { // octt: force show translation menu on all chats, to curb some issues
this.toggle(false); // (!peerTranslation().shouldShow());
this.toggle(!isPremium()); // (!peerTranslation().shouldShow());
});
const listenerSetter = new ListenerSetter();
@ -160,13 +160,13 @@ export default class ChatTranslation extends PinnedContainer {
},
verify: isPremium,
separatorDown: true
}, { // octt: make the disable translation button into a toggle button
} /* , {
// octt: TODO make this hide bar on click
icon: 'crossround',
text: 'Toggle', // 'Hide',
text: 'Toggle',
onClick: () => {
this.managers.appTranslationsManager.togglePeerTranslations(peerId(), peerTranslation().shouldShow()); // true);
}
}],
} */ ],
listenerSetter
});
menu.classList.add('pinned-translation-menu', 'primary');
@ -180,6 +180,11 @@ export default class ChatTranslation extends PinnedContainer {
return;
}
// octt: force enable translation on server config when disable, otherwise we can't use this
if(!peerTranslation().shouldShow()) {
this.managers.appTranslationsManager.togglePeerTranslations(peerId(), false); // true);
}
const translation = peerTranslation();
translation.toggle(!translation.enabled());
}}

View File

@ -322,7 +322,7 @@ export class AppSidebarLeft extends SidebarSlider {
},
onOpen: (e, btnMenu) => { // octt: branding
const btnMenuFooter = document.createElement('a');
// btnMenuFooter.href = 'https://github.com/morethanwords/tweb/blob/master/CHANGELOG.md';
btnMenuFooter.href = 'https://gitea.it/octospacc/Spaccogram/src/branch/main/webk';
setBlankToAnchor(btnMenuFooter);
btnMenuFooter.classList.add('btn-menu-footer');
btnMenuFooter.addEventListener(CLICK_EVENT_NAME, (e) => {
@ -344,6 +344,7 @@ export class AppSidebarLeft extends SidebarSlider {
noIcon: true
});
this.toolsBtn.classList.add('sidebar-tools-button', 'is-visible');
this.toolsBtn.appendChild(Object.assign(document.createElement('div'), {className: 'attention-dot'}));
this.backBtn.parentElement.insertBefore(this.toolsBtn, this.backBtn);

View File

@ -201,7 +201,8 @@ export default class AppBackgroundTab extends SliderSuperTab {
public static addWallPaper(
wallPaper: WallPaper,
container = document.createElement('div')
container = document.createElement('div'),
renderComplexBackground = true
) {
const colors = getColorsFromWallPaper(wallPaper);
const hasFile = wallPaper._ === 'wallPaper';
@ -232,6 +233,12 @@ export default class AppBackgroundTab extends SliderSuperTab {
media.classList.add('background-item-media');
const loadPromises: Promise<any>[] = [];
// octt: don't show useless theme background preview in general settings, it makes them lag
if(!renderComplexBackground) {
return {container, media, loadPromise: Promise.all(loadPromises)};
}
let wrapped: ReturnType<typeof wrapPhoto>, size: ReturnType<typeof choosePhotoSize>;
if(hasFile) {
size = choosePhotoSize(doc, 200, 200);

View File

@ -106,8 +106,8 @@ export default class AppGeneralSettingsTab extends SliderSuperTabEventable {
{
const container = section('Settings');
const range = new RangeSettingSelector('TextSize', 1, rootScope.settings.messagesTextSize, 12, 20);
range.onChange = (value) => {
const textSizeRange = new RangeSettingSelector('TextSize', 1, rootScope.settings.messagesTextSize, 12, 20);
textSizeRange.onChange = (value) => {
rootScope.managers.appStateManager.setByKey(joinDeepPath('settings', 'messagesTextSize'), value);
};
@ -135,7 +135,6 @@ export default class AppGeneralSettingsTab extends SliderSuperTabEventable {
checked: false,
listenerSetter: this.listenerSetter
});
const animationsRow = new Row({
checkboxField: animationsCheckboxField,
clickable: () => {
@ -156,15 +155,61 @@ export default class AppGeneralSettingsTab extends SliderSuperTabEventable {
listenerSetter: this.listenerSetter
});
// octt: new config fields
const chatCheckmarksRow = new Row({
checkboxField: (new CheckboxField({
text: 'ShowMessageCheckmarks',
name: 'chatCheckmarks',
stateKey: joinDeepPath('settings', 'chatCheckmarks'),
checked: rootScope.settings.chatCheckmarks,
listenerSetter: this.listenerSetter
})),
listenerSetter: this.listenerSetter
});
const chatCheckmarksInput = chatCheckmarksRow.container.querySelector('input');
chatCheckmarksInput.onchange = (() => {
const showCheckmarks = chatCheckmarksInput.checked;
rootScope.settings.chatCheckmarks = showCheckmarks;
document.body.classList[showCheckmarks ? 'remove' : 'add']('hide-chat-checkmarks');
});
const forcePremiumRow = new Row({
title: 'Force Local Premium',
checkboxField: (new CheckboxField({
name: 'forcePremium',
stateKey: joinDeepPath('settings', 'forcePremium'),
checked: rootScope.settings.forcePremium,
listenerSetter: this.listenerSetter,
toggle: true
})),
listenerSetter: this.listenerSetter
});
const forcePremiumInput = forcePremiumRow.container.querySelector('input');
forcePremiumInput.onchange = (() => {
const forcePremium = forcePremiumInput.checked;
if(forcePremium) {
rootScope.premiumBak = rootScope.premium;
rootScope.premium = forcePremium;
} else {
rootScope.premium = rootScope.premiumBak;
}
rootScope.dispatchEvent('premium_toggle', rootScope.premium);
});
// ... //
onUpdate();
this.listenerSetter.add(rootScope)('settings_updated', onUpdate);
container.append(
range.container,
textSizeRange.container,
chatBackgroundButton,
chatCheckmarksRow.container,
animationsRow.container,
liteModeRow.container
liteModeRow.container,
forcePremiumRow.container
);
}
@ -270,7 +315,7 @@ export default class AppGeneralSettingsTab extends SliderSuperTabEventable {
.filter((themeSettings) => availableBaseThemes.has(themeSettings.base_theme._))
.map((themeSettings) => {
const wallPaper = themeSettings.wallpaper;
const result = AppBackgroundTab.addWallPaper(wallPaper);
const result = AppBackgroundTab.addWallPaper(wallPaper, document.createElement('div'), false);
k.wallPaperContainers[themeSettings.base_theme._] = result.container;
return result;
});

View File

@ -110,7 +110,10 @@ export type State = {
timeFormat: 'h12' | 'h23',
liteMode: {[key in LiteModeKey]: boolean},
savedAsForum: boolean,
stealthMode: boolean // octt: //
// octt: new config fields
chatCheckmarks: boolean,
forcePremium: boolean,
stealthMode: boolean
},
playbackParams: ReturnType<AppMediaPlaybackController['getPlaybackParams']>,
keepSigned: boolean,
@ -326,7 +329,10 @@ export const STATE_INIT: State = {
video: false
},
savedAsForum: false,
stealthMode: false // octt: //
// octt: new config fields
chatCheckmarks: true,
forcePremium: true,
stealthMode: false
},
playbackParams: {
volume: 1,

View File

@ -1,8 +1,7 @@
/*
* https://github.com/morethanwords/tweb
* Copyright (C) 2019-2021 Eduard Kuzmenko
* https://gitea.it/octospacc/Spaccogram
* Copyright (C) 2024-2024 OctoSpacc, Spacc Inc.
* https://github.com/morethanwords/tweb/blob/master/LICENSE
* https://gitea.it/octospacc/Spaccogram/src/branch/main/webk/LICENSE
*/
import {MOUNT_CLASS_TO} from '../config/debug';
@ -11,12 +10,19 @@ import {joinDeepPath} from './object/setDeepProperty';
export class StealthMode {
public isEnabled() {
return !!(rootScope.settings && rootScope.settings.stealthMode);
const state = !!(rootScope.settings && rootScope.settings.stealthMode);
this.setBodyClass(state);
return state;
}
public setState(state: boolean) {
this.setBodyClass(state);
return rootScope.managers.appStateManager.setByKey(joinDeepPath('settings', 'stealthMode'), state);
}
private setBodyClass(state: boolean) {
document.body.classList[state ? 'add' : 'remove']('stealthmode-enabled');
}
}
const stealthMode = new StealthMode();

View File

@ -316,7 +316,7 @@ IMAGE_MIME_TYPES_SUPPORTED_PROMISE.then((mimeTypes) => {
I18n.setTimeFormat(stateResult.state.settings.timeFormat);
rootScope.managers.rootScope.getPremium().then((isPremium) => {
rootScope.premium = true; // isPremium; // octt: force premium to be enabled
rootScope.premium = isPremium;
});
themeController.setThemeListener();
@ -427,8 +427,9 @@ IMAGE_MIME_TYPES_SUPPORTED_PROMISE.then((mimeTypes) => {
case 'authStateSignIn':
pagePromise = (await import('./pages/pageSignIn')).default.mount();
break;
case 'authStateSignQr':
pagePromise = (await import('./pages/pageSignQR')).default.mount();
case 'authStateSignQr': // octt: force standard login view on boot instead of QR code
pagePromise = (await import('./pages/pageSignIn')).default.mount();
// pagePromise = (await import('./pages/pageSignQR')).default.mount();
break;
case 'authStateAuthCode':
pagePromise = (await import('./pages/pageAuthCode')).default.mount(authState.sentCode);

View File

@ -891,6 +891,8 @@ const lang = {
'TextSize': 'Message Text Size',
'ChatBackground': 'Chat Wallpaper',
'EnableAnimations': 'Enable Animations',
'ShowMessageCheckmarks': 'Show Message Checkmarks',
'ForceLocalPremium': 'Force Local Premium',
'AutoDownloadMedia': 'Auto-Download Media',
'AutodownloadContacts': 'Contacts',
'AutodownloadPrivateChats': 'Private Chats',

View File

@ -1,5 +1,5 @@
const lang = {
'Login.Title': 'Sign in to Telegram',
'Login.Title': 'Sign in to Spaccogram',
'Login.PhoneLabel': 'Phone Number',
'Login.PhoneLabelInvalid': 'Phone Number Invalid',
'Login.KeepSigned': 'Keep me signed in',
@ -26,7 +26,7 @@ const lang = {
'Contacts.PhoneNumber.Placeholder': 'Phone Number',
'Login.Next': 'Next',
'Login.ContinueOnLanguage': 'Continue in English',
'Login.QR.Title': 'Log in to Telegram by QR Code',
'Login.QR.Title': 'Log in to Spaccogram by QR Code',
'Login.QR.Help1': 'Open Telegram on your phone',
'Login.QR.Help2': 'Go to **Settings** > **Devices** > **Link Desktop Device**',
'Login.QR.Help3': 'Point your phone at this screen to confirm login',

View File

@ -2284,6 +2284,15 @@ export class AppDialogsManager {
await (await m(loadDialogsPromise)).renderPromise.catch(noop);
this.managers.appMessagesManager.fillConversations();
if(!rootScope.settings.chatCheckmarks) { // octt: hide message checkmarks
document.body.classList.add('hide-chat-checkmarks');
}
if(!rootScope.premium) { // octt: force local premium
rootScope.premium = rootScope.settings.forcePremium;
rootScope.dispatchEvent('premium_toggle', rootScope.premium);
}
}
/* private getOffset(side: 'top' | 'bottom'): {index: number, pos: number} {

View File

@ -239,6 +239,7 @@ export class AppImManager extends EventListenerBase<{
this.selectTab(APP_TABS.CHATLIST);
// octt: TODO modify this to implement online status obfuscation
idleController.addEventListener('change', (idle) => {
this.offline = idle;
this.updateStatus();

View File

@ -25,6 +25,7 @@ import CustomEmojiElement, {CustomEmojiElements} from './element';
import assumeType from '../../helpers/assumeType';
import {IS_WEBM_SUPPORTED} from '../../environment/videoSupport';
import {observeResize, unobserveResize} from '../../components/resizeObserver';
import liteMode from '../../helpers/liteMode';
const globalLazyLoadQueue = new LazyLoadQueue();
@ -214,6 +215,9 @@ export class CustomEmojiRendererElement extends HTMLElement {
if(!frame) {
continue;
}
if(!(liteMode.isAvailable('animations') && liteMode.isAvailable('emoji_panel'))) {
player.pause();
}
const isImageData = frame instanceof ImageData;
let frameWidth: number, frameHeight: number;

View File

@ -362,7 +362,8 @@ export default class MTPNetworker {
serializer.storeInt(App.id, 'api_id');
serializer.storeString(getEnvironment().USER_AGENT || 'Unknown UserAgent', 'device_model');
serializer.storeString(navigator.platform || 'Unknown Platform', 'system_version');
serializer.storeString(App.version + (App.isMainDomain ? ' ' + App.suffix : ''), 'app_version');
// octt: remove the last version digit, to not leak the fact we're using a strange version
serializer.storeString(App.version.split('.').slice(0, -1).join('.') + (App.isMainDomain ? ' ' + App.suffix : ''), 'app_version');
serializer.storeString(navigator.language || 'en', 'system_lang_code');
serializer.storeString(App.langPack, 'lang_pack');
serializer.storeString(this.networkerFactory.language, 'lang_code');

View File

@ -518,16 +518,17 @@ export default function wrapRichText(text: string, options: WrapRichTextOptions
url = wrapped.url;
onclick = wrapped.onclick;
if(options.whitelistedDomains) {
try {
const hostname = new URL(url).hostname;
if(!options.whitelistedDomains.includes(hostname)) {
break;
}
} catch(err) {
break;
}
}
// octt: no domain restrictions on rich text links
// if(options.whitelistedDomains) {
// try {
// const hostname = new URL(url).hostname;
// if(!options.whitelistedDomains.includes(hostname)) {
// break;
// }
// } catch(err) {
// break;
// }
// }
if(entity._ === 'messageEntityTextUrl') {
if(nextEntity?._ === 'messageEntityUrl' &&

View File

@ -209,6 +209,7 @@ export class RootScope extends EventListenerBase<BroadcastEventsListeners> {
public settings: State['settings'];
public managers: AppManagers;
public premium: boolean;
public premiumBak: boolean;
constructor() {
super();
@ -216,6 +217,7 @@ export class RootScope extends EventListenerBase<BroadcastEventsListeners> {
this.myId = NULL_PEER_ID;
this.connectionStatus = {};
this.premium = false;
this.premiumBak = this.premium; // octt: force local premium
this.addEventListener('user_auth', ({id}) => {
this.myId = id.toPeerId();
@ -249,7 +251,7 @@ export class RootScope extends EventListenerBase<BroadcastEventsListeners> {
}
public getPremium() {
return true; // this.premium; // octt: force premium enabled
return this.premium;
}
public dispatchEventSingle(...args: any[]) {

View File

@ -749,6 +749,8 @@
"TextSize" = "Message Text Size";
"ChatBackground" = "Chat Wallpaper";
"EnableAnimations" = "Enable Animations";
"ShowMessageCheckmarks" = "Show Message Checkmarks";
"ForceLocalPremium" = "Force Local Premium";
"AutoDownloadMedia" = "Auto-Download Media";
"AutodownloadContacts" = "Contacts";
"AutodownloadPrivateChats" = "Private Chats";
@ -2489,7 +2491,7 @@
"Input.Quote.Expanded" = "Quote text will be fully visible";
"CopyRestricted.Channel" = "Sorry, copying from this channel is disabled by its admins.";
"CopyRestricted.Group" = "Sorry, copying from this group is disabled by its admins.";
"Login.Title" = "Sign in to Telegram";
"Login.Title" = "Sign in to Spaccogram";
"Login.PhoneLabel" = "Phone Number";
"Login.PhoneLabelInvalid" = "Phone Number Invalid";
"Login.KeepSigned" = "Keep me signed in";
@ -2512,7 +2514,7 @@
"Contacts.PhoneNumber.Placeholder" = "Phone Number";
"Login.Next" = "Next";
"Login.ContinueOnLanguage" = "Continue in English";
"Login.QR.Title" = "Log in to Telegram by QR Code";
"Login.QR.Title" = "Log in to Spaccogram by QR Code";
"Login.QR.Help1" = "Open Telegram on your phone";
"Login.QR.Help2" = "Go to **Settings** > **Devices** > **Link Desktop Device**";
"Login.QR.Help3" = "Point your phone at this screen to confirm login";

View File

@ -101,6 +101,15 @@
flex-wrap: wrap;
//flex-direction: column; // fix 'Unread messages', still need to refactor it
// octt: hide checkmarks option
body.hide-chat-checkmarks & {
&.is-sent, &.is-read {
.time-sending-status {
display: none;
}
}
}
&.is-sponsored {
--max-width: calc(80% - var(--message-beside-button-margin) * -1) !important;
width: 100%;

View File

@ -248,6 +248,15 @@ ul.chatlist {
}
}
// octt: hide checkmarks option
body.hide-chat-checkmarks & {
.sending-status-icon {
&-check, &-checks {
display: none;
}
}
}
@include respond-to(not-handhelds) {
&.active {
--background: var(--primary-color) !important;

View File

@ -313,6 +313,19 @@
opacity: 1;
visibility: visible;
}
body.stealthmode-enabled & {
.attention-dot {
width: 8px;
height: 8px;
background-color: red;
border-radius: 100%;
bottom: 0;
left: 0;
position: absolute;
margin: 1em;
}
}
}
@include respond-to(handhelds) {