git clone https://github.com/TannerReynolds/ShareX-Upload-Server.git
cd ShareX-Upload-Server
chmod +x install.sh
./install.shdocker build -t sharex-upload-server .
docker run --name " sharex-upload-server " -d
-v $( pwd ) /src/config.json:/usr/src/app/config.json
-v $( pwd ) /src/db.json:/usr/src/app/db.json
-v $( pwd ) /src/server/uploads/:/usr/src/app/server/uploads/
-p 8000:80 -p 8443:443
sharex-upload-server
docker logs -f sharex-upload-server如果您使用上述命令来启动服务器,则/src/config.json将是使用的配置文件。 Web UI将在https://server-ip:8443上可用,如果启用了https,则可以http://server-ip:8000使用。
在您从此存储库中下载的文件中,您将看到一个名为config.json的文件。下面解释了配置文件以及每个部分的作用
{
"key" : [ "" ] , // Password(s) for private uploading
"domain" : "*.example.com" , // Domain server will use. Will error if domain not used in request. Place "*" as the subdomain to enable wildcard subdomains for the webserver.
"puploadKeyGenLength" : 64 , // Amount of characters server should use for pupload files
"public" : false , // Disables auth and does not render a password field for /upload
"maxUploadSize" : 50 , // max upload size for non-admins using regular key in MB
"markdown" : true , // enables markdown rendering (upload whole .md file for render)
"port" : 80 , // port to listen on
"secure" : true , // Whether or not you want https. (make sure key and cert.pem are in src directory)
"fileNameLength" : 4 , // File name length
"shortUrlLength" : 3 , // File name length for short URLs
"securePort" : 443 , // Port to use when secure is true
"ratelimit" : 1000 , // Ratelimit for POSTing in milliseconds
"dateURLPath" : false , // Set to true to prefix uploads with the date (Ex: https://domain.com/2020/04/22/ghNa.pdf)
"allowed" : [
"png" , "jpg" , "gif" , "mp4" , "mp3" , "jpeg" , "tiff" , "bmp" , "ico" , "psd" , "eps" , "raw" , "cr2" , "nef" , "sr2" , "orf" , "svg" , "wav" , "webm" , "aac" , "flac" , "ogg" , "wma" , "m4a" , "gifv"
] , // Allowed file types for non-admins
"admin" : {
"key" : [ "" ] , // Admin password(s) for uploading & for gallery access
"maxUploadSize" : 1024 , // Max upload size for admin in MB
"allowed" : [
"png" , "jpg" , "gif" , "mp4" , "mp3" , "jpeg" , "tiff" , "bmp" , "ico" , "psd" , "eps" , "raw" , "cr2" , "nef" , "sr2" , "orf" , "svg" , "wav" , "webm" , "aac" , "flac" , "ogg" , "wma" , "m4a" , "gifv" , "html"
] // Allowed file types for admins
} ,
"paste" : {
"maxUploadSize" : 20 // allowed paste upload size in MB
} ,
"discordToken" : "" , // Discord bot token
"discordAdminIDs" : [ "discord IDs of people who can run commands go here" , "Like this" ] , // User IDs in an array
"discordChannelID" : "" , // Channel ID for monitoring uploads to
"prefix" : "" // Bot Prefix
} 正确配置服务器后,您可以在SRC文件夹中运行node index.js来启动服务器。如果使用PM2等流程管理器,则可以使服务器永远运行。如果您使用install.sh脚本安装服务器,则PM2与服务器一起安装。否则,您可以运行npm i -g pm2安装PM2。然后,您可以通过运行pm2 start index.js运行服务器,并使用pm2 monit监视日志
如果您要配置此Web服务器以通过NGINX反向代理运行,请确保将这些行添加到反向代理配置
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
通常,这是您要添加到配置中的某些东西,这是分享正常工作所需的。这是因为股票返回上传诸如[http/https]://[requested url]/[filename] ,并且由于您通过反向代理运行共享,除非您沿着原始标题传递,否则Sharees很可能只会向您发送诸如http://[server's real ip address]/[filename]
如果您有多个指向此Web服务器的域,则只能使用一个(可以包括通配符子域),除非域设置设置为单个 *这样的 *: "domain": "*",这意味着任何域都将被服务器接受为有效域,而不论子域如何。
如果您希望出于某种原因将Web服务器的活动记录在Discord频道中,则可以。这是有关如何设置机器人帐户并获取Discord Logging所需的信息的信息
Destinations -> Custom Uploader SettingsDestination Locationpupload的字段,然后使价值变为您想要的密码除了能够为Puploads使用所需的任何密码外,如果您将*random*作为Pupload字段键入,服务器还将自动为您生成密码。此密码将包括字母,数字和特殊字符。它将根据您在配置中指定的长度(puploadkeygenlength)中生成键。在提出请求时,服务器将使用键返回图像URL,例如so URL: https://qoilo.com/lhHr | KEY: Np$[CBk>X[c^YY{MDlCHH0|Qfm1uK0*lld^Mi$f4d62R5x6C2>~yaL}3*QYnziuZ
showCase的字段,然后使值true为了与Flameshot使用共享,您需要使用一个简单的脚本,这是一个示例:
key= " YourPassword "
# Only needed for multi-domain support, if you only have one simply set the url
# 2 lines below to url="https://your.domain/api/files"
urls=( " https://example.com/api/files " " https://example.org/api/files " )
url= ${urls[$RANDOM % ${#urls[@]} ]}
temp_file= " /tmp/screenshot.png "
# Run flameshot --help for options
flameshot gui -r > $temp_file
# For some reason flameshot always seems to exit with 0 even when aborting the process
# so we had to find a way around that.
if [[ $( file --mime-type -b $temp_file ) != " image/png " ]] ; then
rm $temp_file
notify-send " Screenshot aborted " -a " Flameshot " && exit 1
fi
image_url= $( curl -X POST -F " fdata=@ " $temp_file -F " key= " $key -v " $url " 2> /dev/null )
echo -n $image_url | xclip -sel c
notify-send " Image URL copied to clipboard " " $image_url " -a " Flameshot " -i $temp_file
rm $temp_file在运行此脚本时,只需在对图像感到满意时点击Enter,Flameshot将将图像保存到剪贴板上,然后将图像上传后将其替换为图像URL。为了获得最佳结果,我建议在Flameshot应用程序中禁用通知。
4.5.6 ,请确保更改readme和package.json文件中的盾牌以说4.5.7版。如果版本为4.5.10 ,则将其更新为4.5.11 。仅更新最后一个数字。不是代码的更新/PR(readme.md,install.sh,sxcu文件,package.json等)不应构成该项目的更新版本号,因此这些特定文件的PR不会增加版本号码