-
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #30 from CrazyTapok-bit/develop
Added Chine translation
- Loading branch information
Showing
23 changed files
with
567 additions
and
5 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
export * from "./uk.js"; | ||
export * from "./en.js"; | ||
export * from "./zh.js"; |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import { navbar } from "vuepress-theme-hope"; | ||
|
||
export const zhNavbar = navbar([ | ||
"/zh/", | ||
{ | ||
text: "文档", | ||
icon: "book", | ||
link: "/zh/docs/README.md", | ||
activeMatch: "^/zh/docs/$" | ||
}, | ||
{ | ||
text: "完整示例", | ||
icon: "bolt", | ||
link: "/zh/docs/example/README.md" | ||
} | ||
]); |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
export * from "./uk.js"; | ||
export * from "./en.js"; | ||
export * from "./zh.js"; |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import { sidebar } from "vuepress-theme-hope"; | ||
|
||
export const zhSidebar = sidebar({ | ||
"/zh/": [ | ||
{ | ||
text: "文档", | ||
icon: "laptop-code", | ||
prefix: "zh/docs/", | ||
children: "structure", | ||
}, | ||
], | ||
"/zh/docs/": "structure", | ||
}); |
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
--- | ||
home: true | ||
icon: home | ||
title: 家 | ||
head: | ||
- - meta | ||
- name: description | ||
content: TgWebValid 库是使用 PHP 验证网站上的 Telegram Login Widget 和 Telegram Mini App 用户的简单方法。 | ||
sitemap: | ||
priority: 1 | ||
heroImage: /logo.svg | ||
heroAlt: 徽标 TgWebValid | ||
bgImage: /assets/bg/main-light.svg | ||
bgImageDark: /assets/bg/main-dark.svg | ||
bgImageStyle: | ||
background-attachment: fixed | ||
heroText: TgWebValid | ||
tagline: 使用 PHP 检查网站上的 Telegram Login Widget 和 Telegram Mini App 用户的简单方法 | ||
actions: | ||
- text: 开始使用 | ||
icon: signs-post | ||
link: /zh/docs/ | ||
type: primary | ||
|
||
- text: 例子 | ||
link: /zh/docs/example/ | ||
|
||
highlights: | ||
- header: 我们的特色 | ||
description: 成功工作的主要好处 | ||
features: | ||
- title: 速度 | ||
icon: rocket | ||
details: 专注于尽可能最快的数据处理 | ||
|
||
- title: 自动完成 | ||
icon: wand-magic-sparkles | ||
details: 我们和您一样喜欢清晰干净的代码 | ||
|
||
- title: 测试 | ||
icon: vial-circle-check | ||
details: 我们通过测试提供 100% 的 PHPUnit 功能覆盖 | ||
|
||
- title: 多机器人 | ||
icon: gem | ||
details: 与不同的机器人同时工作 | ||
|
||
- title: 可靠性 | ||
icon: check-double | ||
details: 在高流量聊天机器人上进行测试 | ||
--- |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
--- | ||
title: 文档 | ||
index: false | ||
icon: book | ||
--- | ||
|
||
[![Testing Status](https://github.com/CrazyTapok-bit/tgWebValid/workflows/PHP%20CI/badge.svg)](https://github.com/CrazyTapok-bit/tgWebValid/actions) | ||
[![Minimum PHP Version](https://img.shields.io/packagist/dependency-v/tg/tgwebvalid/php)](https://packagist.org/packages/tg/tgwebvalid) | ||
[![Latest version](https://img.shields.io/packagist/v/tg/tgWebValid)](https://packagist.org/packages/tg/tgwebvalid) | ||
[![Total Downloads](https://img.shields.io/packagist/dt/tg/tgwebvalid)](https://packagist.org/packages/tg/tgwebvalid) | ||
[![Total Stars](https://img.shields.io/packagist/stars/tg/tgwebvalid)](https://packagist.org/packages/tg/tgwebvalid) | ||
[![License](https://img.shields.io/packagist/l/tg/tgwebvalid)](https://packagist.org/packages/tg/tgwebvalid) | ||
|
||
[![StandWithUkraine](https://raw.githubusercontent.com/CrazyTapok-bit/tgWebValid/4.x/badges/StandWithUkraine.svg)](https://stand-with-ukraine.pp.ua) | ||
[![StandWithUkraine](https://raw.githubusercontent.com/CrazyTapok-bit/tgWebValid/4.x/badges/RussianWarship.svg)](https://stand-with-ukraine.pp.ua) | ||
|
||
[![StandWithUkraine](https://raw.githubusercontent.com/CrazyTapok-bit/tgWebValid/4.x/StandWithUkraine.svg)](https://stand-with-ukraine.pp.ua) | ||
|
||
## 关于 TgWebValid {#about} | ||
|
||
我们的库轻量、快速:rocket:、现代化,并且具有 `100%` 自动完成功能来获取用户数据。 同时,我们使其成为自治的,因此无论是否在任何框架中都可以使用它。 | ||
|
||
最重要的是,我们的库旨在验证 PHP 上的 [Telegram Mini App](https://core.telegram.org/bots/webapps) 和 [Telegram Login Widget](https://core.telegram.org/widgets/login) 的用户 | ||
|
||
通过加密接收到的原始用户数据并将其与 Telegram 提供的哈希值进行比较来进行身份验证。 | ||
|
||
:::info 推荐 | ||
提供对敏感用户数据的访问 **仅在身份验证成功后** | ||
::: | ||
|
||
**开始快速、安全地验证用户。** | ||
|
||
:::tip 注意 | ||
在您的项目中部署 TgWebValid 库的平均时间 **仅 ~ 1 分钟** | ||
::: | ||
|
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
--- | ||
title: 完整示例 | ||
icon: bolt | ||
index: false | ||
dir: | ||
order: 5 | ||
--- | ||
|
||
<Catalog /> |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
--- | ||
title: 登录小部件 | ||
icon: right-to-bracket | ||
order: 2 | ||
head: | ||
- - meta | ||
- name: description | ||
content: 如何验证通过 Telegram Login Widget 收到的数据 - PHP | ||
--- | ||
|
||
我们尝试展示尽可能完整的示例,您很可能会使用该示例。 | ||
|
||
```php | ||
<?php | ||
|
||
use TgWebValid\TgWebValid; | ||
use TgWebValid\Exceptions\BotException; | ||
use TgWebValid\Exceptions\ValidationException; | ||
use Exception; | ||
|
||
include './vendor/autoload.php'; | ||
|
||
try { | ||
/** | ||
* 我指定令牌设置并启用异常处理 | ||
*/ | ||
$tgWebValid = new TgWebValid( | ||
token: 'TELEGRAM_BOT_TOKEN', | ||
throw: true | ||
); | ||
|
||
/** 我将设置另一个额外的机器人来与他们合作 */ | ||
$tgWebValid->addBot( | ||
name: 'secondary', | ||
token: 'TELEGRAM_BOT_TOKEN_2' | ||
); | ||
|
||
/** 我使用默认机器人 */ | ||
$bot = $tgWebValid->bot(); | ||
|
||
/** 或者,指定我想要使用哪个机器人 */ | ||
$bot = $tgWebValid->bot( | ||
name: 'secondary' | ||
); | ||
|
||
/** | ||
* 调用 validateLoginWidget 方法, | ||
* 检查从 Telegram Login Widget 收到的数据 | ||
*/ | ||
$user = $bot->validateLoginWidget( | ||
user: [/** 用户数据 */] | ||
); | ||
|
||
/** | ||
* 如果检查成功, | ||
* 我将显示包含所有用户数据的 LoginWidget 实体 | ||
*/ | ||
var_dump($user); | ||
|
||
} catch (ValidationException $e) { | ||
// 如果检查失败,我将收到验证异常 | ||
} catch (BotException $e) { | ||
// 由于机器人名称错误,我会捕获此异常 | ||
} catch (Exception $e) { | ||
// 如果有其他错误我会处理 | ||
} | ||
``` |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
--- | ||
title: 迷你应用程序 | ||
icon: tablet-screen-button | ||
order: 1 | ||
head: | ||
- - meta | ||
- name: description | ||
content: 如何验证通过 Telegram Web 应用程序收到的数据 - PHP | ||
--- | ||
|
||
我们尝试展示尽可能完整的示例,您很可能会使用该示例。 | ||
|
||
```php | ||
<?php | ||
|
||
use TgWebValid\TgWebValid; | ||
use TgWebValid\Exceptions\BotException; | ||
use TgWebValid\Exceptions\ValidationException; | ||
use Exception; | ||
|
||
include './vendor/autoload.php'; | ||
|
||
try { | ||
/** | ||
* 我指定令牌设置并启用异常处理 | ||
*/ | ||
$tgWebValid = new TgWebValid( | ||
token: 'TELEGRAM_BOT_TOKEN', | ||
throw: true | ||
); | ||
|
||
/** 我将设置另一个额外的机器人来与他们合作 */ | ||
$tgWebValid->addBot( | ||
name: 'secondary', | ||
token: 'TELEGRAM_BOT_TOKEN_2' | ||
); | ||
|
||
/** 我使用默认机器人 */ | ||
$bot = $tgWebValid->bot(); | ||
|
||
/** 或者,指定我想要使用哪个机器人 */ | ||
$bot = $tgWebValid->bot( | ||
name: 'secondary' | ||
); | ||
|
||
/** | ||
* 调用 validateInitData 方法, | ||
* 检查从 Telegram Mini 应用程序收到的数据 | ||
*/ | ||
$initData = $bot->validateInitData( | ||
initData: 'query_id=...' | ||
); | ||
|
||
/** | ||
* 如果检查成功, | ||
* 我将输出包含所有用户数据的 InitData 实体 | ||
*/ | ||
var_dump($initData); | ||
|
||
} catch (ValidationException $e) { | ||
// 如果检查失败,我将收到验证异常 | ||
} catch (BotException $e) { | ||
// 由于机器人名称错误,我会捕获此异常 | ||
} catch (Exception $e) { | ||
// 如果有其他错误我会处理 | ||
} | ||
``` |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
--- | ||
title: 例外情况 | ||
icon: bomb | ||
order: 4 | ||
--- | ||
|
||
如果您确定验证数据正确,但仍然出现此异常,请检查设置中指定的令牌的正确性。 | ||
|
||
## BotException | ||
您尝试[应用](./get-started/usage.md)的机器人名称不正确,或者添加的列表中不存在该机器人。 | ||
|
||
## ValidationException | ||
无法使用[可用验证器](./validator/) 之一验证用户。 它可能表明存在黑客攻击和/或绕过系统的威胁。 |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
--- | ||
title: 开始使用 | ||
icon: lightbulb | ||
index: false | ||
dir: | ||
order: 1 | ||
collapsible: false | ||
--- | ||
|
||
<Catalog /> |
Oops, something went wrong.