semvec/pypi-packages huggingface dataset:
nonebot-plugin-theworld 0.1.1
「ザ・ワールド」ッ！ 時よ止まれ！
License: MIT
Requires Python: >=3.8

<div align="center">
  <a href="https://v2.nonebot.dev/store"><img src="https://github.com/A-kirami/nonebot-plugin-template/blob/resources/nbp_logo.png" width="180" height="180" alt="NoneBotPluginLogo"></a>
  <br>
  <p><img src="https://github.com/A-kirami/nonebot-plugin-template/blob/resources/NoneBotPlugin.svg" width="240" alt="NoneBotPluginText"></p>
</div>

<div align="center">

# nonebot-plugin-theworld

_✨ 「ザ・ワールド」ッ！ 時よ止まれ！ ✨_


<a href="./LICENSE">
    <img src="https://img.shields.io/github/license/A-kirami/nonebot-plugin-theworld.svg" alt="license">
</a>
<a href="https://pypi.python.org/pypi/nonebot-plugin-theworld">
    <img src="https://img.shields.io/pypi/v/nonebot-plugin-theworld.svg" alt="pypi">
</a>
<img src="https://img.shields.io/badge/python-3.8+-blue.svg" alt="python">

</div>

## 📖 介绍

> 「ザ・ワールド」ッ！ 時よ止まれ！

![theworld](https://img.moegirl.org.cn/common/2/26/%E4%B8%96%E7%95%8C%E5%8D%A1%E4%BD%8F%E6%97%B6%E9%97%B4%E9%BD%BF%E8%BD%AE.png)

## 💿 安装

<details open>
<summary>使用 nb-cli 安装</summary>
在 nonebot2 项目的根目录下打开命令行, 输入以下指令即可安装

    nb plugin install nonebot-plugin-theworld

</details>

<details>
<summary>使用包管理器安装</summary>
在 nonebot2 项目的插件目录下, 打开命令行, 根据你使用的包管理器, 输入相应的安装命令

<details>
<summary>pip</summary>

    pip install nonebot-plugin-theworld
</details>
<details>
<summary>pdm</summary>

    pdm add nonebot-plugin-theworld
</details>
<details>
<summary>poetry</summary>

    poetry add nonebot-plugin-theworld
</details>
<details>
<summary>conda</summary>

    conda install nonebot-plugin-theworld
</details>

打开 nonebot2 项目根目录下的 `pyproject.toml` 文件, 在 `[tool.nonebot]` 部分追加写入

    plugins = ["nonebot_plugin_theworld"]

</details>

## ⚙️ 配置

在 nonebot2 项目的`.env`文件中添加下表中的必填配置

| 配置项 | 必填 | 默认值 | 说明 |
|:-----:|:----:|:----:|:----:|
| THEWORLD_ONLY_ADMIN | 否 | true | 是否仅管理员可使用 |

## 🎉 使用

### 指令表

| 指令 | 需要@ | 范围 | 说明 |
|:-----:|:----:|:----:|:----:|
| the world/世界/咋瓦鲁多/时间停止 | 否 | 群聊 | 启用全群禁言，持续9秒 |
| 然后时间开始流动/时间流动/解除时停 | 否 | 群聊 | 关闭全群禁言 |
| roadroller/泷泽萝拉哒/食我压路机/压路机 | 否 | 群聊 | 播放动画（ |
Flask-UA-Enricher 0.0.1
Decorates flask views and enrich User-Agent header in case of reduced UA string
License: MIT
Requires Python: >=3.6
Keywords: flask,flask-ua,flask-ua-enricher,flask-Sec-CH-UA,flask-useragent-enrich,flask-useragent-enricher,flask-sec-ua,useragent-enricher

## Why it's needed

Starting Chrome 110 (https://developer.chrome.com/blog/user-agent-reduction-android-model-and-version/), Chrome reduced User-Agent string content sent by default by browsers in every request.
The new UA string is will look like this:

Before: user-agent includes Android version and device model:

``` Mozilla/5.0 (Linux; Android 13; Pixel 7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/95.0.0.0 Mobile Safari/537.36 ```

After: reduced user-agent with fixed Android version and device model:

``` Mozilla/5.0 (Linux; Android 10; K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/95.0.0.0 Mobile Safari/537.36 ```


This Flask wrapper tries to fix this by decorating a chosen Flask view, and if the fixed Android version and model are observed, it will trigger a refresh request from the browser but with the high entropy sec-ch-ua HTTP headers in the response, that can give us more information about the client (device model, OS version etc).

  (You can read more about those Sec-CH-UA headers here https://developer.mozilla.org/en-US/docs/Web/API/NavigatorUAData/getHighEntropyValues)

The response from the browser after the resent request will then have an enriched Flask request.user_agent including the correct device model and Android version, that can also be later parsed in any standard user-agent parsers libs or APIs


## Quickstart

```
from flask import Flask, request
from flask_ua_enricher import SecChUa, resend_request_with_ch_ua

app = Flask(__name__)

sec_ch_ua = SecChUa()
sec_ch_ua.init_app(app)


@app.route('/helloChrome', methods=['GET'])
@resend_request_with_ch_ua
def hello():
    return f"Hello with enriched UA: {request.user_agent.string}" 
```


## Note

If you're running this in a dev environment (i.e. your local PC), make sure to run your Flask server with HTTPS otherwise the enrichment won't work