Code Monkey home page Code Monkey logo

tgstate's Introduction

tgState

English

一款以Telegram作为储存的文件外链系统

不限制文件大小和格式

可以作为telegram图床,也可以作为telegram网盘使用。

支持web上传文件和telegram直接上传

搭配CLoudFlare使用

参数说明

必填参数

  • target
  • token

可选参数

  • pass
  • mode
  • url
  • port

target

目标可为频道、群组、个人

当目标为频道时,需要将Bot拉入频道作为管理员,公开频道并自定义频道Link,target值填写Link,如@xxxx

当目标为群组时,需要将Bot拉入群组,公开群组并自定义群组Link,target值填写Link,如@xxxx

当目标为个人时,则为telegram id(@getmyid_bot获取)

token

填写你的bot token

pass

填写访问密码,如不需要,直接填写none即可

mode

  • p 代表网盘模式运行,不限制上传后缀
  • m 在p模式的基础上关闭网页上传,可私聊进行上传(如果target是个人,则只支持指定用户进行私聊上传

url

bot获取FileID的前置域名地址自动补充及api返回完整url的补充

port

自定义运行端口

管理

获取FIleID

对bot聊天中的文件引用并回复get可以获取FileID,搭建地址+获取的path即可访问资源

如果配置了url参数,会直接返回完整的地址

image

部署

二进制

编译

go build -tags netgo -o tgState
推荐自行编译 Linux amd64下载
wget https://github.com/csznet/tgState/releases/latest/download/tgState.zip && unzip tgState.zip && rm tgState.zip

Linux arm64下载

wget https://github.com/csznet/tgState/releases/latest/download/tgState_arm64.zip && unzip tgState_arm64.zip && rm tgState_arm64.zip

Linux 一键脚本

bash -c "$(curl -fsSL https://raw.githubusercontent.com/csznet/tgState/main/get.sh)"

使用方法

 ./tgState 参数

例子

 ./tgState -token xxxx -target @xxxx

后台运行

nohup ./tgState 参数 &

Docker

pull镜像

docker pull csznet/tgstate:latest

启动

docker run -d -p 8088:8088 --name tgstate 参数 --net=host csznet/tgstate:latest

其中docker的参数需要设置为环境变量

开机自启需要加上

--restart always

例子

docker run -d -p 8088:8088 --name tgstate -e token=token -e target=@target -e mode=p --net=host csznet/tgstate:latest

Docker Compose

编译二进制文件

go build -tags netgo -o tgState

修改 docker-compose.yml文件

配置 mode、target、token、pass、url,其中mode、target、token必填

配置好后执行:

docker-compose up -d

Vercel

不支持大于5mb文件,不支持tg获取文件路径

点我传送至Vercel配置页面

API说明

POST方法到路径/api

表单传输,字段名为image,内容为二进制数据

当设置访问密码时,直接将密码加入url参数pass中,如密码为123:

/api?pass=123

返回示例:

{"code": 1, "message": "/d/xxx","url":"xxx"}

json格式的url默认返回tgState的url参数+访问路径,如果只得到了路径则需要自行设置url参数

picgo-plugin-web-uploader填写说明:

POST参数名:image

JSON路径:url

Alt Text

tgstate's People

Contributors

csznet avatar comdotwww avatar vikiboss avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.