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不會增加版本號碼