0%

例如转发到服务器3002端口,域名Nginx配置:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
location / {
allow all;
proxy_pass http://localhost:3002;
proxy_set_header Host $http_host;
proxy_set_header Cookie $http_cookie;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
{
proxy_pass http://localhost:3002;
}
location ~ .*\.(js|css)?$
{
proxy_pass http://localhost:3002;
}

如果使用宝塔面板,在[伪静态]部分配置。

测试,通过node test.js来listen3002端口,访问域名后显示test.js返回值:Hello World

test.js:

1
2
3
4
5
6
7
8
9
10
11
const http = require('http');

const server = http.createServer((req, res) => {
res.statusCode = 200;
res.setHeader('Content-Type', 'text/plain');
res.end('Hello World\n');
});

server.listen(3002, () => {
console.log('Server running at http://localhost:3002/');
});

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
server{

...

# 限制IP白名单
allow 91.59.0.0/16;
allow 123.180.0.0/16;
deny all;

自定义403页面
error_page 403 /custom_403.html;
location = /custom_403.html {
root /www/wwwroot/xxx;
allow all;
}

...
}

自定义 Wordpress Translatepress 语言切换菜单。

主题模板用的:
https://themeforest.net/item/optime-logistics-transportation-wordpress-theme/24380838
由于官方只兼容了WPML和自己的语言切换器,未兼容 Translatepress ,所以需要自己加上。

编辑主题文件,找到function.php 加入:
ref: https://translatepress.com/docs/developers/custom-language-switcher/

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
function trpc_custom_language_switcher()
{
if (apply_filters('trp_allow_tp_to_run', true)) {
$html = '<div class="language-dropdow">';
$languages = trp_custom_language_switcher();
$html .= "<ul data-no-translation>";
$html .= '<li class="lang-item">';
$html .= '<a class="lang-sel">' . get_locale() . "</a>";
$html .= '<ul class="lang-submenu">';
foreach ($languages as $name => $item) {
$html .= '<li class="lang-item">';
$html .= "<a href='{$item['current_page_url']}'>";
$html .= "<span>{$item['language_code']}</span></a></li>";
}
$html .= "</ul>";
$html .= "</li>";
$html .= "</ul>";
$html .= "</div>";
return $html;
}
}

打开 template-parts/header-layout.php 在判断语言菜单处加入:

1
2
3
4
...
<?php } elseif ( class_exists('TRP_Translate_Press') ) { ?>
<?php echo trpc_custom_language_switcher(); ?>
...

1
show variables like 'log_bin';

结果为On表示有开启Log。

以 BT 环境为例,在 /www/server/data/ 看下 mysql-bin.00000x ,找到修改时间最近的那个文件。
我这里是 mysql-bin.000006

1
/www/server/mysql/bin/mysqlbinlog --no-defaults --base64-output=decode-rows -v /www/server/data/mysql-bin.000006 > /www/server/data/mysql-bin.000006.txt

导出为 mysql-bin.000006.txt 文件,这里是所有执行过的sql语句。

但文件太大了,不好下载,把最近3w行导出到新文件:

1
tail -n 30000 /www/server/data/mysql-bin.000006.txt > /www/server/data/mysql-bin.000006_last_3w.txt

下载 mysql-bin.000006_last_3w.txt ,在其中查找到被删数据的 insert 拿出来执行即可。

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25

搜索参数:
$filters['customs_document_remarks']比如:['T1','ATB', '..']

数据库:
mysql customs_document_remarks 字段存储例如: ATC,ATB,Unbekannt,T1

查询需求:
filters里的任意值匹配字段逗号隔开的任意值,即返回结果

可以在whereHas里做in_items的whereRaw查询。

// 海关文件备注
if (isset($filters['customs_document_remarks']) && $filters['customs_document_remarks']) {
$data->whereHas('in_items', function ($query) use ($filters) {
$sql = '';
foreach ($filters['customs_document_remarks'] as $customs_document_remarks) {
if ($sql) {
$sql .= ' OR ';
}
$sql .= 'FIND_IN_SET("' . $customs_document_remarks . '", customs_document_remarks)';
}
$query->whereRaw($sql);
});
}

在 package.json 文件删除antd依赖。

https://www.jsdelivr.com/ 搜索antd得到js和css链接。

在 public/index.html ,放入js和css链接。

1
2
3
4
5
6
...
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/reset.min.css">
</head>
...
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/antd.min.js" integrity="sha256-eP2yKhOQWYkDmydKH19f+mBDhj1BpUJ38oSuLtK1NSk=" crossorigin="anonymous"></script>
</body>

然后在 src/index.js 中添加空白的导入语句

1
import 'antd';

禁用依赖检查,在 package.json 文件中添加以下配置:

1
2
3
"resolutions": {
"antd": "x.x.x" // x.x.x 是 Ant Design 的版本号
}

删除node_modules、yarn.lock,执行yarn install、yarn start即可。

文件传输到电视方式:

  1. 电视安装【小白文件管理器】,使用其中的【多屏互动-快速传输】,来实现电脑传送文件到电视。
  2. 如果没有【小白文件管理器】,如果有【悟空遥控器】,可以安装【悟空遥控器】后在该软件应用市场安装【小白文件管理器】
  3. U盘。

TV源项目:https://github.com/fanmingming/live

TV源地址:https://live.fanmingming.com/tv/m3u/ipv6.m3u

安卓电视可以用:
Tivimate(https://github.com/skysolf/iptv)


KODI:https://kodi.tv/download/android/
KODI设置中文、解决中文乱码、安装PVR插件、设置源说明:https://zhuanlan.zhihu.com/p/385068899

所用项目:https://github.com/Lozy/danted/

安装和管理方式在GitHub项目主页都有,这里不再重复。
需要注意的是,如果机器有多个IP,且配置文件中无 external.rotation: same-same 配置,则要手动加上。

配置文件:/etc/danted/sockd.conf
在配置文件 clientmethod: none 上面加一行:
external.rotation: same-same