Version Notification: Prevent duplicates after release (#6284)

This commit is contained in:
zubiden 2025-09-30 16:52:23 +02:00 committed by Alexander Zinchuk
parent ad5bba3e6e
commit 11b8d0c318
4 changed files with 10 additions and 4 deletions

View File

@ -4,6 +4,7 @@ declare module '*.module.scss';
declare const APP_VERSION: string;
declare const APP_REVISION: string;
declare const CHANGELOG_DATETIME: number | undefined;
declare namespace React {
interface HTMLAttributes {

View File

@ -8,7 +8,6 @@ import type {
export const APP_CODE_NAME = 'A';
export const APP_NAME = process.env.APP_NAME || `Telegram Web ${APP_CODE_NAME}`;
export const RELEASE_DATETIME = process.env.RELEASE_DATETIME;
export const PRODUCTION_HOSTNAME = 'web.telegram.org';
export const PRODUCTION_URL = 'https://web.telegram.org/a';

View File

@ -8,7 +8,6 @@ import { type ActiveDownloads, FocusDirection } from '../../../types';
import {
ANIMATION_END_DELAY,
RELEASE_DATETIME,
SCROLL_MAX_DURATION,
SERVICE_NOTIFICATIONS_USER_ID,
} from '../../../config';
@ -780,7 +779,7 @@ addActionHandler('openTodoListModal', (global, actions, payload): ActionReturnTy
addTabStateResetterAction('closeTodoListModal', 'todoListModal');
addActionHandler('checkVersionNotification', (global, actions): ActionReturnType => {
if (RELEASE_DATETIME && Date.now() > Number(RELEASE_DATETIME) + VERSION_NOTIFICATION_DURATION) {
if (CHANGELOG_DATETIME && Date.now() > CHANGELOG_DATETIME + VERSION_NOTIFICATION_DURATION) {
return;
}

View File

@ -3,6 +3,7 @@ import 'dotenv/config';
import WatchFilePlugin from '@mytonwallet/webpack-watch-file-plugin';
import StatoscopeWebpackPlugin from '@statoscope/webpack-plugin';
import { statSync } from 'fs';
import { GitRevisionPlugin } from 'git-revision-webpack-plugin';
import HtmlWebpackPlugin from 'html-webpack-plugin';
import MiniCssExtractPlugin from 'mini-css-extract-plugin';
@ -48,6 +49,8 @@ const CSP = `
form-action 'none';`
.replace(/\s+/g, ' ').trim();
const CHANGELOG_PATH = path.resolve(__dirname, 'src/versionNotification.txt');
export default function createConfig(
_: any,
{ mode = 'production' }: { mode: 'none' | 'development' | 'production' },
@ -206,7 +209,6 @@ export default function createConfig(
// eslint-disable-next-line no-null/no-null
APP_NAME: null,
APP_TITLE,
RELEASE_DATETIME: Date.now(),
TELEGRAM_API_ID: undefined,
TELEGRAM_API_HASH: undefined,
// eslint-disable-next-line no-null/no-null
@ -221,6 +223,11 @@ export default function createConfig(
const shouldDisplayOnlyCommit = APP_ENV === 'staging' || !branch || branch === 'HEAD';
return JSON.stringify(shouldDisplayOnlyCommit ? commit : `${branch}#${commit}`);
}, mode === 'development' ? true : []),
CHANGELOG_DATETIME: DefinePlugin.runtimeValue(() => {
return JSON.stringify(statSync(CHANGELOG_PATH, { throwIfNoEntry: false })?.mtime.getTime());
}, {
fileDependencies: [CHANGELOG_PATH],
}),
}),
new ProvidePlugin({
Buffer: ['buffer', 'Buffer'],