This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import hmac | |
def checkValidateInitData(hash_str, init_data, token, c_str="WebAppData"): | |
""" | |
Validates the data received from the Telegram web app, using the | |
method documented here: | |
https://core.telegram.org/bots/webapps#validating-data-received-via-the-web-app | |
hash_str - the has string passed by the webapp | |
init_data - the query string passed by the webapp |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Token Based API Access for Supabase | |
-- | |
-- How to configure Supabase (https://supabase.com/) to generate and accept API tokens. | |
-- | |
-- (c) 2022 Felix Zedén Yverås | |
-- Provided under the MIT license (https://spdx.org/licenses/MIT.html) | |
-- | |
-- Disclaimer: This file is formatted using pg_format. I'm not happy with the result but | |
-- prefer to follow a tool over going by personal taste. | |
-- |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Bot token | |
const bot_token = '0123456789:XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'; | |
// https://core.telegram.org/bots/webapps#validating-data-received-via-the-web-app | |
function isValidHash() { | |
// Parse query data | |
const parsedData = Telegram.Utils.urlParseQueryString(Telegram.WebApp.initData) | |
// Get Telegram hash | |
const hash = parsedData.hash |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* SQLite to GeoJSON (Requires https://github.com/phayes/geoPHP) | |
* Query a SQLite table or view (with a WKB GEOMETRY field) and return the results in GeoJSON format, suitable for use in OpenLayers, Leaflet, etc. | |
* | |
* @param string $geotable The SQLite table name *REQUIRED* | |
* @param string $geomfield The WKB GEOMETRY field *REQUIRED* | |
* @param string $fields Fields to be returned *OPTIONAL (If omitted, all fields will be returned)* | |
* @param string $parameters SQL WHERE clause parameters *OPTIONAL* | |
* @param string $orderby SQL ORDER BY constraint *OPTIONAL* |