• Stars
    star
    246
  • Rank 164,726 (Top 4 %)
  • Language
    Python
  • License
    GNU General Publi...
  • Created over 3 years ago
  • Updated 3 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A Telegram userbot to index Chinese and Japanese group contents.

功能说明

落絮可以 CJK 友善的方式索引 Telegram 群组与频道,并提供 API 供前端使用。

安装与配置

配置 luoxu

  • 安装 Rust nightly 以及 OpenCC 库。
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
rustup toolchain install nightly
  • Python 库依赖请见 requirements.txt 文件
  • 获取一份 Telegram API key
  • querytrans 目录下运行 rustup run nightly cargo build --release 然后把生成的文件(target/release/libquerytrans.so)复制为 querytrans.so 并放在 Python 能找到的地方(比如当前目录)需要注意的是:构建 querytrans 之前需要提前准备好 python 环境,如果与运行 luoxu 的环境不一致将会出错。
  • 复制 config.toml.example 并按需要修改
  • (可选)词云插件需要在 luoxu-cutwords 下运行 cargo build --release 并将生成的可执行文件放到 $PATH

使用 python -m luoxu.ls_dialogs 可以列出会话的 id 和名称。频道和群组的 id 可以用于配置文件中。

设置数据库

  • 安装 PostgreSQL 及 pgroonga
  • 使用 createdb 命令创建数据库
  • 使用 postgres 用户身份连接到该数据库,并执行 CREATE EXTENSION pgroonga;
  • 导入 dbsetup.sql 脚本,如 psql DBNAME < dbsetup.sql

运行

在本项目目录下(或者将本项目目录加入 Python 模块路径),执行:

python -m luoxu

配置 Web 前端

  • 可使用 luoxu-web
  • 修改 src/App.svelte 中的 API URL
  • 运行 npm run build 编译文件
  • 使用 Web 服务器 serve public 目录

你也可以使用 Vercel 来方便快捷地部署此项目。

当然了,你也可以自己另外编写 Web 页面来使用此 API。

注意事项

不要直接将索引了私有群组/频道的 API 公开于网络上!任何人都能获取其内容的。公开索引了公开群组或频道的服务前,也请获取群组/频道管理员的同意。

luoxu 相当于运行一个 Telegram 客户端,其权限是完全的(包括创建新的登录、结束已有会话、设置两步验证等)。请注意保护账号安全,不要在不信任的服务器上登录与运行本项目!

请注意配置数据库权限。Arch Linux 上默认安装的 PostgreSQL 很可能是对本地用户不设防的(请查阅 /var/lib/postgres/data/pg_hba.conf 配置文件)。

使用

搜索消息时,搜索字符串不区分简繁(会使用 OpenCC 自动转换),也不进行分词(请手动将可能不连在一起的词语以空格分开)。

搜索字符串支持以下功能:

  • 以空格分开的多个搜索词是「与」的关系
  • 使用 OR(全大写)来表达「或」条件
  • 使用 - 来表达排除,如 落絮 - 测试
  • 使用小括号来分组

数据库升级

当对 PostgreSQL 进行跨版本升级时,需要额外处理 pgroonga 的事情。

步骤示意:

  1. 安装新的数据库软件
  2. cp /usr/lib/postgresql/pgroonga* /opt/pgsql-13/lib
  3. 安装新的 pgroonga
  4. 执行升级(pg_upgrade
  5. 升级完成之后需要重新索引:
reindex index usernames_idx;
reindex index message_idx;

不兼容的变更

  • 2022年06月23日,采用分区表来提升部分查询的性能。需要更新配置文件及数据库。

More Repositories

1

swapview-rosetta

Print swap usage per process. Implemented in various programming languages
C++
487
star
2

morerssplz

Convert other article sources to RSS feeds
Python
402
star
3

nvchecker

New version checker for software releases
Python
370
star
4

colorizer

A Vim plugin to colorize all text in the form #rrggbb or #rgb.
Vim Script
336
star
5

dotvim

My vim config
Vim Script
274
star
6

pssh

Parallel SSH Tools
Python
262
star
7

fcitx.vim

keep and restore fcitx state when leaving/re-entering insert mode
Python
234
star
8

winterpy

My python scripts started in winter.
Python
218
star
9

myawesomerc

My Awesome WM config files
Lua
84
star
10

dotzsh

My zsh config
Shell
56
star
11

search-and-view

Tools to make searching and viewing easy.
Python
47
star
12

xmpptalk

An XMPP bot to make a chatroom
Python
46
star
13

telegram-cache-decryption

Decrypt the media cache of Telegram Desktop
Python
46
star
14

capture-dns

A simple program to capture and show DNS queries
Rust
41
star
15

wait-online

Wait until we're connected to the Internet
Python
41
star
16

dotconfig

~/.config
Lua
40
star
17

dnssnoop

show which process did what DNS queries
Python
34
star
18

stdoutisatty

Make programs think their stdout is a tty / terminal.
C
34
star
19

ncdu-diff

ncdu fork that can compare and diff results
C
27
star
20

taskmaid

A D-Bus task API for Wayland
Rust
25
star
21

dpms-off

Turn off monitors to save power (for Wayland)
Rust
25
star
22

remotebrowser

open URLs from Windows virtual machines in the host system
Rust
24
star
23

openredir

redirect file open operations via LD_PRELOAD
C
24
star
24

luoxu-web

A web frontend for luoxu.
Svelte
23
star
25

2bbcode

A set of custom Pandoc writers for converting to BBCode.
Lua
23
star
26

abp-rules

My list of Adblock Plus rules, mainly for China websites
22
star
27

gaetalk

A chatroom application run on Google App Engine
Python
22
star
28

userscripts

My user scripts
JavaScript
21
star
29

cgtree

List cgroups info in a tree
Python
21
star
30

swapview

A simple program to view processes' swap usage on Linux.
Rust
20
star
31

archrepo2

Arch Linux repository manager
Python
19
star
32

monitor-control

The fastest way to get / set DDC values for a monitor
Rust
16
star
33

gm-github-tweaks

Tweak GitHub to make it great again.
CSS
16
star
34

udt_py

Python UDT
C++
15
star
35

ircbindxmpp

IRC <-> XMPP bidirectional connection
Python
14
star
36

compare-env

Compare the given environment variable value across all the processes
Rust
14
star
37

chinese-num

A Rust librrary to convert a decimal number to its Chinese form
Rust
13
star
38

spamfightbot

Another Telegram anti-spam bot without disturbance.
Python
13
star
39

fiemap-rs

FIEMAP library and tools for Rust
Rust
12
star
40

tornadochat

A web chatroom using tornado
Python
12
star
41

walkdir-test

a simple and naïve test to see which implementations of directory traversing is faster
Makefile
11
star
42

copy-link-address

Firefox addon to Copy Link Address with accesskey "a"
JavaScript
11
star
43

bluekeyslistener

Listen to bluetooth headphone keys (Linux only)
Rust
10
star
44

mozlz4-tool

A tool to process mozlz4 files
Rust
9
star
45

rpysh

Remote Python shell, for Linux Pythoners coping with Windows.
Python
8
star
46

bookmarked-search

Firefox addon to search the selected text using a search engine from your bookmarked search engines.
JavaScript
8
star
47

gdu-diff

Use gdu to diff and compare directory usages
Python
8
star
48

myhaskells

Haskell programs writing while learning
Haskell
7
star
49

paddleocr-web

A simple PaddleOCR web frontend.
Svelte
7
star
50

accurate-time

Show accurate time in tmux status
Rust
6
star
51

fcitx-lua-scripts

Lua
6
star
52

uniclip

Unify the clipboard operations for X11 and Wayland
Rust
6
star
53

paddleocr-service

Run PaddleOCR as a systemd service.
Shell
6
star
54

paperlike-i2c

i2c program for Dasung Paperlike HD e-ink monitors
Rust
6
star
55

HTTPSEverywhereUserRules

My personal HTTPSEverywhere rules
5
star
56

socat

socat - Multipurpose relay (cloned from git://repo.or.cz/socat.git) http://www.dest-unreach.org/socat/
C
5
star
57

cjk-align

Align CJK and emoji characters correctly on terminals
Rust
5
star
58

vim-foldtree

Fold ASCII tree graphs in Vim
Rust
5
star
59

fcitx-mb

A tool for interactively viewing and modifying fcitx's code tables.
Python
5
star
60

git-linked

git logs with hyperlinks
Python
5
star
61

website-styles

My custom styles for some websites (stylus)
CSS
4
star
62

https-speed

Show HTTPS speed in a terminal
Rust
4
star
63

tailf.vim

asynchronous "tail -f" and other shell commands in Vim 8
Vim Script
4
star
64

simplehist

A simple program to show a histogram on the terminal.
Rust
4
star
65

viewhtmlmsg

View an HTML email message in a browser (for text MUAs like mutt)
Python
4
star
66

android-dedupefs

A filesystem for reading Android dedupe backup
C
4
star
67

filequeue

send logs to Kafka, using the log file like a queue, without rotation.
Rust
4
star
68

fcitx5-dictsync

A tool to synchronize fcitx5 tabledict.
Rust
4
star
69

text-reflow-we

Firefox Android addon to allow click events to reflow text of that tag to fit screen width
JavaScript
3
star
70

srcipfix

fix source IP for UDP packets with netfilter_queue
Rust
3
star
71

roll-it-back

A command-line tool to rollback a possibly-nested btrfs subvolume to a snapshot
Rust
3
star
72

fetchtitle

Asynchronized URL information retriever
Python
3
star
73

cf-pop

Which Cloudflare® datacenter am I visiting? (Firefox addon)
JavaScript
3
star
74

imagestamp

add a stamp / watermark to a couple of images, at a chosen position for each
C
3
star
75

rust-signalbool

A simple crate to catch signals and set a boolean flag for later use.
Rust
3
star
76

mc2tg

A bot to synchronize messages from minecraft server to Telegram and back
Python
3
star
77

lilydjwg.github.io

HTML
2
star
78

x.rs

Extract various archive formats to standalone directory.
Rust
2
star
79

reorder-extensions

Reorder Firefox's extension menu with ease (see https://bugzilla.mozilla.org/show_bug.cgi?id=1831782)
Svelte
2
star
80

fcitx5-paste-primary

Fcitx Addon to Paste Primary selection with Keyboard
C++
2
star
81

open-noatime

Hook `open` and `open64` libc calls to avoid updating atimes while searching or the like.
Rust
2
star
82

fcitx5-tabledict

A tool to manipulate fcitx5 tabledict.
Rust
2
star
83

drop-serverhello

Drop ServerHello with netfilter_queue. For testing bug 1718719 of Firefox.
Rust
2
star
84

expiringdict-rs

A dict / HashMap whose items expire over time
Rust
2
star
85

multimc-bin-pkgbuild

Repackage multimc for Arch Linux in a distribution way
Shell
1
star
86

rust-tokio-anyfd

Use any suitable file descriptor with tokio
Rust
1
star
87

my-trime

My customizations for trime
Shell
1
star
88

pyparsing_fork

My fork for pyparsing, on *GitHub*
Python
1
star
89

pid_children

A simple program outputs descendant process ids for each pid given on the command line
Rust
1
star
90

extsort-lily

An efficient external sort library for Rust
Rust
1
star
91

journal-usage

Analyze systemd journal usage by unit or by date
Rust
1
star
92

netctl-lily

Profile based systemd network management. lilydjwg's fork.
Shell
1
star
93

transgender-pride-3

Transgender Pride 3 is a Firefox theme that changes itself based on system theme kind.
Python
1
star
94

archutils

My personal scripts for Arch Linux
Python
1
star
95

sys-stat

System Statistics Collector
Rust
1
star