diff --git a/public/apple-touch-icon-dev.png b/public/apple-touch-icon-dev.png new file mode 100644 index 000000000..9e8ba3345 Binary files /dev/null and b/public/apple-touch-icon-dev.png differ diff --git a/public/icon-dev-192x192.png b/public/icon-dev-192x192.png new file mode 100644 index 000000000..b73fe64ef Binary files /dev/null and b/public/icon-dev-192x192.png differ diff --git a/public/icon-dev-384x384.png b/public/icon-dev-384x384.png new file mode 100644 index 000000000..1e358958c Binary files /dev/null and b/public/icon-dev-384x384.png differ diff --git a/public/icon-dev-512x512.png b/public/icon-dev-512x512.png new file mode 100644 index 000000000..d8b6090f6 Binary files /dev/null and b/public/icon-dev-512x512.png differ diff --git a/public/icon-square-192x192.png b/public/icon-square-192x192.png new file mode 100644 index 000000000..4efb570d1 Binary files /dev/null and b/public/icon-square-192x192.png differ diff --git a/public/icon-square-384x384.png b/public/icon-square-384x384.png new file mode 100644 index 000000000..06fb79a54 Binary files /dev/null and b/public/icon-square-384x384.png differ diff --git a/public/icon-square-512x512.png b/public/icon-square-512x512.png new file mode 100644 index 000000000..92dfcdca2 Binary files /dev/null and b/public/icon-square-512x512.png differ diff --git a/public/icon-square-dev-192x192.png b/public/icon-square-dev-192x192.png new file mode 100644 index 000000000..c12ba4b01 Binary files /dev/null and b/public/icon-square-dev-192x192.png differ diff --git a/public/icon-square-dev-384x384.png b/public/icon-square-dev-384x384.png new file mode 100644 index 000000000..b49c2822b Binary files /dev/null and b/public/icon-square-dev-384x384.png differ diff --git a/public/icon-square-dev-512x512.png b/public/icon-square-dev-512x512.png new file mode 100644 index 000000000..269307cb6 Binary files /dev/null and b/public/icon-square-dev-512x512.png differ diff --git a/public/screenshot.jpg b/public/screenshot.jpg new file mode 100644 index 000000000..bd9a1b5d8 Binary files /dev/null and b/public/screenshot.jpg differ diff --git a/public/site.webmanifest b/public/site.webmanifest index 704927adb..0934f0e61 100644 --- a/public/site.webmanifest +++ b/public/site.webmanifest @@ -1,6 +1,7 @@ { - "name": "Telegram WebZ", - "short_name": "Telegram WebZ", + "name": "Telegram Web", + "short_name": "Telegram Web", + "description": "Telegram is a cloud-based mobile and desktop messaging app with a focus on security and speed.", "start_url": "./", "gcm_sender_id": "122867383838", "icons": [ @@ -20,6 +21,11 @@ "type": "image/png" } ], + "screenshots" : [{ + "src": "screenshot.jpg", + "sizes": "1280x802", + "type": "image/jpeg" + }], "theme_color": "#ffffff", "background_color": "#ffffff", "display": "standalone" diff --git a/public/site_apple.webmanifest b/public/site_apple.webmanifest new file mode 100644 index 000000000..658c16d9d --- /dev/null +++ b/public/site_apple.webmanifest @@ -0,0 +1,32 @@ +{ + "name": "Telegram Web", + "short_name": "Telegram Web", + "description": "Telegram is a cloud-based mobile and desktop messaging app with a focus on security and speed.", + "start_url": "./", + "gcm_sender_id": "122867383838", + "icons": [ + { + "src": "icon-square-192x192.png", + "sizes": "192x192", + "type": "image/png" + }, + { + "src": "icon-square-384x384.png", + "sizes": "384x384", + "type": "image/png" + }, + { + "src": "icon-square-512x512.png", + "sizes": "512x512", + "type": "image/png" + } + ], + "screenshots" : [{ + "src": "screenshot.jpg", + "sizes": "1280x802", + "type": "image/jpeg" + }], + "theme_color": "#ffffff", + "background_color": "#ffffff", + "display": "standalone" +} diff --git a/public/site_apple_dev.webmanifest b/public/site_apple_dev.webmanifest new file mode 100644 index 000000000..e5763c0a7 --- /dev/null +++ b/public/site_apple_dev.webmanifest @@ -0,0 +1,32 @@ +{ + "name": "Telegram Web Beta", + "short_name": "Telegram Web Beta", + "description": "Telegram is a cloud-based mobile and desktop messaging app with a focus on security and speed.", + "start_url": "./", + "gcm_sender_id": "122867383838", + "icons": [ + { + "src": "icon-square-dev-192x192.png", + "sizes": "192x192", + "type": "image/png" + }, + { + "src": "icon-square-dev-384x384.png", + "sizes": "384x384", + "type": "image/png" + }, + { + "src": "icon-square-dev-512x512.png", + "sizes": "512x512", + "type": "image/png" + } + ], + "screenshots" : [{ + "src": "screenshot.jpg", + "sizes": "1280x802", + "type": "image/jpeg" + }], + "theme_color": "#ffffff", + "background_color": "#ffffff", + "display": "standalone" +} diff --git a/public/site_dev.webmanifest b/public/site_dev.webmanifest new file mode 100644 index 000000000..7559baa9b --- /dev/null +++ b/public/site_dev.webmanifest @@ -0,0 +1,32 @@ +{ + "name": "Telegram Web Beta", + "short_name": "Telegram Web Beta", + "description": "Telegram is a cloud-based mobile and desktop messaging app with a focus on security and speed.", + "start_url": "./", + "gcm_sender_id": "122867383838", + "icons": [ + { + "src": "icon-dev-192x192.png", + "sizes": "192x192", + "type": "image/png" + }, + { + "src": "icon-dev-384x384.png", + "sizes": "384x384", + "type": "image/png" + }, + { + "src": "icon-dev-512x512.png", + "sizes": "512x512", + "type": "image/png" + } + ], + "screenshots" : [{ + "src": "screenshot.jpg", + "sizes": "1280x802", + "type": "image/jpeg" + }], + "theme_color": "#ffffff", + "background_color": "#ffffff", + "display": "standalone" +} diff --git a/src/index.html b/src/index.html index ad10d4430..91032aa91 100644 --- a/src/index.html +++ b/src/index.html @@ -4,16 +4,16 @@ - Telegram + <%= htmlWebpackPlugin.options.appName %> - + - + - - + + @@ -22,29 +22,28 @@ - + - + - + - +
- diff --git a/src/index.tsx b/src/index.tsx index 853355e51..3040e9cae 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -5,6 +5,7 @@ import React from './lib/teact/teact'; import TeactDOM from './lib/teact/teact-dom'; import { getActions, getGlobal } from './global'; +import updateWebmanifest from './util/updateWebmanifest'; import './global/init'; import { DEBUG } from './config'; @@ -25,6 +26,8 @@ if (DEBUG) { console.log('>>> START INITIAL RENDER'); } +updateWebmanifest(); + TeactDOM.render( , document.getElementById('root'), diff --git a/src/util/updateWebmanifest.ts b/src/util/updateWebmanifest.ts new file mode 100644 index 000000000..81458bdd8 --- /dev/null +++ b/src/util/updateWebmanifest.ts @@ -0,0 +1,15 @@ +// Original idea was found here +// https://medium.com/@alshakero/how-to-setup-your-web-app-manifest-dynamically-using-javascript-f7fbee899a61 + +import { DEBUG } from '../config'; +import { IS_MAC_OS } from './environment'; + +export default function updateWebmanifest() { + const manifest = document.getElementById('the-manifest-placeholder'); + if (!manifest) { + return; + } + + const url = `site${IS_MAC_OS ? '_apple' : ''}${DEBUG ? '_dev' : ''}.webmanifest`; + manifest.setAttribute('href', url); +} diff --git a/webpack.config.js b/webpack.config.js index 5d2829599..47a156491 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -6,7 +6,7 @@ const { EnvironmentPlugin, ProvidePlugin, } = require('webpack'); -const HtmlPlugin = require('html-webpack-plugin'); +const HtmlWebackPlugin = require('html-webpack-plugin'); const MiniCssExtractPlugin = require('mini-css-extract-plugin'); const CssMinimizerPlugin = require('css-minimizer-webpack-plugin'); const { GitRevisionPlugin } = require('git-revision-webpack-plugin'); @@ -118,7 +118,9 @@ module.exports = (env = {}, argv = {}) => { }, }, plugins: [ - new HtmlPlugin({ + new HtmlWebackPlugin({ + appName: process.env.APP_ENV === 'production' ? 'Telegram Web' : 'Telegram Web Beta', + appleIcon: process.env.APP_ENV === 'production' ? 'apple-touch-icon' : './apple-touch-icon-dev', template: 'src/index.html', }), new MiniCssExtractPlugin({