Update content of files

This commit is contained in:
GitHub Action 2022-05-10 14:55:52 +00:00
parent bf2e484828
commit 0bdff38b13
11 changed files with 76 additions and 18 deletions

View file

@ -110,9 +110,9 @@
<script src="/js/jquery-ui.min.js?1"></script>
<script src="/js/jquery-ex.js?11"></script>
<script src="/js/tchart.min.js?18"></script>
<script src="/js/health.js?17"></script>
<script src="/js/health.js?18"></script>
<script>ajInit({"version":573,"apiUrl":"\/api?hash=telegram-crawler","unauth":true});</script>
<script>ajInit({"version":574,"apiUrl":"\/api?hash=telegram-crawler","unauth":true});</script>
<script id="aj_script">l.add({"WEB_AB_WARNING_HEADER":"Turn off ad blocker","WEB_POPUP_CLOSE_BTN":"Close","WEB_AB_WARNING_TEXT":"You appear to be using an ad blocker that may prevent pages on the Telegram Ad Platform from working as expected.<br\/><br\/>Please turn off your ad blocker or add <a href=\"http:\/\/promote.telegram.org\/\">promote.telegram.org<\/a> as an exception to manage your promoted messages."});
window.enableInlineVideo&&$('video').each(function(){enableInlineVideo(this)});
Ads.init();

View file

@ -110,9 +110,9 @@
<script src="/js/jquery-ui.min.js?1"></script>
<script src="/js/jquery-ex.js?11"></script>
<script src="/js/tchart.min.js?18"></script>
<script src="/js/health.js?17"></script>
<script src="/js/health.js?18"></script>
<script>ajInit({"version":573,"apiUrl":"\/api?hash=telegram-crawler","unauth":true});</script>
<script>ajInit({"version":574,"apiUrl":"\/api?hash=telegram-crawler","unauth":true});</script>
<script id="aj_script">l.add({"WEB_AB_WARNING_HEADER":"Turn off ad blocker","WEB_POPUP_CLOSE_BTN":"Close","WEB_AB_WARNING_TEXT":"You appear to be using an ad blocker that may prevent pages on the Telegram Ad Platform from working as expected.<br\/><br\/>Please turn off your ad blocker or add <a href=\"http:\/\/promote.telegram.org\/\">promote.telegram.org<\/a> as an exception to manage your promoted messages."});
openPopup('#login-popup-container');
window.enableInlineVideo&&$('video').each(function(){enableInlineVideo(this)});

View file

@ -110,9 +110,9 @@
<script src="/js/jquery-ui.min.js?1"></script>
<script src="/js/jquery-ex.js?11"></script>
<script src="/js/tchart.min.js?18"></script>
<script src="/js/health.js?17"></script>
<script src="/js/health.js?18"></script>
<script>ajInit({"version":573,"apiUrl":"\/api?hash=telegram-crawler","unauth":true});</script>
<script>ajInit({"version":574,"apiUrl":"\/api?hash=telegram-crawler","unauth":true});</script>
<script id="aj_script">l.add({"WEB_AB_WARNING_HEADER":"Turn off ad blocker","WEB_POPUP_CLOSE_BTN":"Close","WEB_AB_WARNING_TEXT":"You appear to be using an ad blocker that may prevent pages on the Telegram Ad Platform from working as expected.<br\/><br\/>Please turn off your ad blocker or add <a href=\"http:\/\/promote.telegram.org\/\">promote.telegram.org<\/a> as an exception to manage your promoted messages."});
window.enableInlineVideo&&$('video').each(function(){enableInlineVideo(this)});
Ads.init();

View file

@ -226,9 +226,9 @@
<script src="/js/jquery-ui.min.js?1"></script>
<script src="/js/jquery-ex.js?11"></script>
<script src="/js/tchart.min.js?18"></script>
<script src="/js/health.js?17"></script>
<script src="/js/health.js?18"></script>
<script>ajInit({"version":573,"apiUrl":"\/api?hash=telegram-crawler","unauth":true});</script>
<script>ajInit({"version":574,"apiUrl":"\/api?hash=telegram-crawler","unauth":true});</script>
<script id="aj_script">l.add({"WEB_AB_WARNING_HEADER":"Turn off ad blocker","WEB_POPUP_CLOSE_BTN":"Close","WEB_AB_WARNING_TEXT":"You appear to be using an ad blocker that may prevent pages on the Telegram Ad Platform from working as expected.<br\/><br\/>Please turn off your ad blocker or add <a href=\"http:\/\/promote.telegram.org\/\">promote.telegram.org<\/a> as an exception to manage your promoted messages."});
window.enableInlineVideo&&$('video').each(function(){enableInlineVideo(this)});
Ads.init();

View file

@ -218,9 +218,9 @@
<script src="/js/jquery-ui.min.js?1"></script>
<script src="/js/jquery-ex.js?11"></script>
<script src="/js/tchart.min.js?18"></script>
<script src="/js/health.js?17"></script>
<script src="/js/health.js?18"></script>
<script>ajInit({"version":573,"apiUrl":"\/api?hash=telegram-crawler","unauth":true});</script>
<script>ajInit({"version":574,"apiUrl":"\/api?hash=telegram-crawler","unauth":true});</script>
<script id="aj_script">l.add({"WEB_AB_WARNING_HEADER":"Turn off ad blocker","WEB_POPUP_CLOSE_BTN":"Close","WEB_AB_WARNING_TEXT":"You appear to be using an ad blocker that may prevent pages on the Telegram Ad Platform from working as expected.<br\/><br\/>Please turn off your ad blocker or add <a href=\"http:\/\/promote.telegram.org\/\">promote.telegram.org<\/a> as an exception to manage your promoted messages."});
window.enableInlineVideo&&$('video').each(function(){enableInlineVideo(this)});
Ads.init();

View file

@ -35,7 +35,7 @@ function fetchGraph(id, tokenData, retry) {
}
var loadingEl = domEl.querySelector('.chart_wrap_loading');
retry = retry || 0;
return fetch('/asyncgraph', {
return fetch('/asyncgraph' + (tokenData.test ? '?_test=1' : ''), {
method: 'post',
headers: {
"Content-type": "application/x-www-form-urlencoded; charset=UTF-8"

View file

@ -158,9 +158,9 @@
<script src="/js/jquery-ui.min.js?1"></script>
<script src="/js/jquery-ex.js?11"></script>
<script src="/js/tchart.min.js?18"></script>
<script src="/js/health.js?17"></script>
<script src="/js/health.js?18"></script>
<script>ajInit({"version":573,"apiUrl":"\/api?hash=telegram-crawler","unauth":true});</script>
<script>ajInit({"version":574,"apiUrl":"\/api?hash=telegram-crawler","unauth":true});</script>
<script id="aj_script">l.add({"WEB_AB_WARNING_HEADER":"Turn off ad blocker","WEB_POPUP_CLOSE_BTN":"Close","WEB_AB_WARNING_TEXT":"You appear to be using an ad blocker that may prevent pages on the Telegram Ad Platform from working as expected.<br\/><br\/>Please turn off your ad blocker or add <a href=\"http:\/\/promote.telegram.org\/\">promote.telegram.org<\/a> as an exception to manage your promoted messages."});
window.enableInlineVideo&&$('video').each(function(){enableInlineVideo(this)});
Ads.init();

View file

@ -681,6 +681,21 @@
return mainButton;
})();
var webAppInvoices = {};
function onInvoiceClosed(eventType, eventData) {
if (eventData.slug && webAppInvoices[eventData.slug]) {
var invoiceData = webAppInvoices[eventData.slug];
delete webAppInvoices[eventData.slug];
if (invoiceData.callback) {
invoiceData.callback(eventData.status);
}
receiveWebViewEvent('invoiceClosed', {
url: invoiceData.url,
status: eventData.status
});
}
}
if (!window.Telegram) {
window.Telegram = {};
}
@ -740,7 +755,7 @@
}
WebView.postEvent('web_app_data_send', false, {data: data});
};
WebApp.openTgLink = function (url) {
WebApp.openTelegramLink = function (url) {
var a = document.createElement('A');
a.href = url;
if (a.protocol != 'http:' &&
@ -759,6 +774,31 @@
location.href = 'https://t.me' + path_full;
}
};
WebApp.openInvoice = function (url, callback) {
var a = document.createElement('A'), match, slug;
a.href = url;
if (a.protocol != 'http:' &&
a.protocol != 'https:' ||
a.hostname != 't.me' ||
!(match = a.pathname.match(/^\/(\$|invoice\/)([A-Za-z0-9\-_=]+)$/)) ||
!(slug = match[2])) {
console.error('[Telegram.WebApp] Invoice url is invalid', url);
throw Error('WebAppInvoiceUrlInvalid');
}
if (!versionAtLeast('1.1')) {
console.error('[Telegram.WebApp] Method openInvoice is not supported in version ' + webAppVersion);
throw Error('WebAppMethodUnsupported');
}
if (webAppInvoices[slug]) {
console.error('[Telegram.WebApp] Invoice is already opened');
throw Error('WebAppInvoiceOpened');
}
webAppInvoices[slug] = {
url: url,
callback: callback
};
WebView.postEvent('web_app_open_invoice', false, {slug: slug});
};
WebApp.ready = function () {
WebView.postEvent('web_app_ready');
};
@ -780,6 +820,7 @@
WebView.onEvent('theme_changed', onThemeChanged);
WebView.onEvent('viewport_changed', onViewportChanged);
WebView.onEvent('invoice_closed', onInvoiceClosed);
WebView.postEvent('web_app_request_theme');
WebView.postEvent('web_app_request_viewport');

View file

@ -9,7 +9,7 @@
<meta name="MobileOptimized" content="176" />
<meta name="HandheldFriendly" content="True" />
<meta name="robots" content="noindex, nofollow" />
<script src="https://tg.dev/js/telegram-web-app.js?7"></script>
<script src="https://tg.dev/js/telegram-web-app.js?8"></script>
<script>
function setThemeClass() {
document.documentElement.className = Telegram.WebApp.colorScheme;
@ -441,7 +441,7 @@
</div>
<script src="https://tg.dev/js/jquery.min.js"></script>
<script src="https://tg.dev/js/tgsticker.js?27"></script>
<script src="/js/cafe.js?17"></script>
<script src="/js/cafe.js?18"></script>
<script>Cafe.init({"apiUrl":"\/cafe\/api","userId":0,"userHash":null});</script>
</body>
</html>

View file

@ -8,7 +8,7 @@
<meta name="MobileOptimized" content="176" />
<meta name="HandheldFriendly" content="True" />
<meta name="robots" content="noindex,nofollow" />
<script src="https://telegram.org/js/telegram-web-app.js?7"></script>
<script src="https://telegram.org/js/telegram-web-app.js?8"></script>
<script>
function setThemeClass() {
document.documentElement.className = Telegram.WebApp.colorScheme;
@ -170,6 +170,7 @@
<li><a href="https://telegram.org/" target="_blank">target="_blank" link</a> (opens outside webview)</li>
<li><a href="javascript:window.open('https://telegram.org/');">window.open() link</a> (opens outside webview)</li>
<li><a href="https://t.me/like">LikeBot t.me link</a> (opens inside Telegram app)</li>
<li><a href="javascript:Telegram.WebApp.openTelegramLink('https://t.me/VoteBot');">web_app_open_tg_link()</a> (opens inside Telegram app)</li>
<li><a href="tg://resolve?domain=vote">VoteBot tg:// link</a> (does not open)</li>
</ul>
<p>Test permissions:</p>

View file

@ -259,11 +259,27 @@ var Cafe = {
params.user_id = Cafe.userId;
params.user_hash = Cafe.userHash;
}
var invoiceSupported = Telegram.WebApp.isVersionAtLeast('1.1');
if (invoiceSupported) {
params.invoice = 1;
}
Cafe.toggleLoading(true);
Cafe.apiRequest('makeOrder', params, function(result) {
Cafe.toggleLoading(false);
if (result.ok) {
Telegram.WebApp.close();
if (invoiceSupported) {
Telegram.WebApp.openInvoice(result.invoice_url, function(status) {
if (status == 'paid') {
Telegram.WebApp.close();
} else if (status == 'failed') {
Cafe.showStatus('Payment has been failed.');
} else {
Cafe.showStatus('You have cancelled this order.');
}
});
} else {
Telegram.WebApp.close();
}
}
if (result.error) {
Cafe.showStatus(result.error);