清除历史提交,删除历史提交中的安装包

This commit is contained in:
name 2022-04-27 11:34:25 +08:00
commit 2ec433fa7c
8 changed files with 570 additions and 0 deletions

23
.github/workflows/destversion.yml vendored Normal file
View File

@ -0,0 +1,23 @@
name: Wechat Dest Version
on:
schedule:
- cron: '0 7 * * *'
workflow_dispatch:
inputs:
download_link:
description: 'The manual WechatSetup.exe download link'
required: false
default: 'https://dldir1.qq.com/weixin/Windows/WeChatSetup.exe'
jobs:
save_new_wechat:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
# - name: Test Github Action Server Time
# run: echo `date`
- name: Check new version and push
env:
GHTOKEN: ${{ secrets.GHTOKEN }}
run: bash -x ./scripts/destVersionRelease.sh ${{ github.event.inputs.download_link }}

18
.github/workflows/notify.yml vendored Normal file
View File

@ -0,0 +1,18 @@
name: Wechat Release Notify
on:
release:
types: [published]
jobs:
notify_to_tg:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Check new version and push
env:
GHTOKEN: ${{ secrets.GHTOKEN }}
BOTTOKEN: ${{ secrets.BOTTOKEN }}
CHATIDS: ${{ secrets.CHATIDS }}
run: bash -x ./scripts/notify.sh

30
.gitignore vendored Normal file
View File

@ -0,0 +1,30 @@
################################################################################
# This below was automatically created for macOS system
################################################################################
# General
.DS_Store
.AppleDouble
.LSOverride
# Icon must end with two \r
Icon
# Thumbnails
._*
# Files that might appear in the root of a volume
.DocumentRevisions-V100
.fseventsd
.Spotlight-V100
.TemporaryItems
.Trashes
.VolumeIcon.icns
.com.apple.timemachine.donotpresent
# Directories potentially created on remote AFP share
.AppleDB
.AppleDesktop
Network Trash Folder
Temporary Items
.apdisk

25
README.md Normal file
View File

@ -0,0 +1,25 @@
# wechat-windows-versions
收集 Windows 微信版本并保存
## 目录结构
```shell
├── README.md # 自述文件
├── WeChatSetup # 微信安装包临时目录
│ └── temp # 临时目录
└── scripts # 脚本目录
├── destVersionRelease.sh # 获取安装包及取得版本号与 hash 值的脚本
└── notify.sh # 新release 时调用通知的脚本
```
## 说明
项目使用 Github Action 自动下载微信最新版本安装包计算 Hash 值并推送至仓库。
**注意: 3.5.0.46 版本以下(不包含 3.5.0.46 版, 仅下载了一部分)均下载自 [web.archive.org](https://web.archive.org/web/*/https://pc.weixin.qq.com/)**
各版本更新日志可参见 [changelog](https://weixin.qq.com/cgi-bin/readtemplate?lang=zh_CN&t=weixin_faq_list&head=true)
*如有问题/侵权,请直接提交 issue 告知。*
## Github Pages
[微信版本号计算(测试版)](https://tom-snow.github.io/wechat-windows-versions/index.html)

178
docs/index.html Normal file
View File

@ -0,0 +1,178 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<!-- import CSS -->
<link rel="stylesheet" href="https://unpkg.com/element-ui/lib/theme-chalk/index.css">
<!-- import Vue before Element -->
<script src="https://unpkg.com/vue@2.6.14/dist/vue.js"></script>
<!-- import JavaScript -->
<script src="https://unpkg.com/element-ui/lib/index.js"></script>
<style>
#app {
font-family: "PingFang SC";
}
#header {
justify-content: center;
}
#main {
justify-content: center;
}
#form {
width: 60%;
}
/* .el-row {
margin-bottom: 20px;
&:last-child {
margin-bottom: 0;
}
}
.el-col {
border-radius: 4px;
} */
</style>
</head>
<body>
<div id="app">
<el-container>
<el-header>
<a href="https://github.com/tom-snow/wechat-windows-versions/tree/pages" class="github-corner" aria-label="View source on GitHub">
<svg width="80" height="80" viewBox="0 0 250 250"
style="fill:#151513; color:#fff; position: absolute; top: 0; border: 0; right: 0;" aria-hidden="true">
<path d="M0,0 L115,115 L130,115 L142,142 L250,250 L250,0 Z"></path>
<path d="M128.3,109.0 C113.8,99.7 119.0,89.6 119.0,89.6 C122.0,82.7 120.5,78.6 120.5,78.6 C119.2,72.0 123.4,76.3 123.4,76.3 C127.3,80.9 125.5,87.3 125.5,87.3 C122.9,97.6 130.6,101.9 134.4,103.2"
fill="currentColor" style="transform-origin: 130px 106px;" class="octo-arm"></path>
<path d="M115.0,115.0 C114.9,115.1 118.7,116.5 119.8,115.4 L133.7,101.6 C136.9,99.2 139.9,98.4 142.2,98.6 C133.8,88.0 127.5,74.4 143.8,58.0 C148.5,53.4 154.0,51.2 159.7,51.0 C160.3,49.4 163.2,43.6 171.4,40.1 C171.4,40.1 176.1,42.5 178.8,56.2 C183.1,58.6 187.2,61.8 190.9,65.4 C194.5,69.0 197.7,73.2 200.1,77.6 C213.8,80.2 216.3,84.9 216.3,84.9 C212.7,93.1 206.9,96.0 205.4,96.6 C205.1,102.4 203.0,107.8 198.3,112.5 C181.9,128.9 168.3,122.5 157.7,114.1 C157.9,116.9 156.7,120.9 152.7,124.9 L141.0,136.5 C139.8,137.7 141.6,141.9 141.8,141.8 Z"
fill="currentColor" class="octo-body"></path>
</svg>
</a>
<el-container id="header">
<h1 id="wechat-version-convertor">Wechat Version Convertor</h1>
</el-container>
</el-header>
<el-main>
<el-container id="main">
<el-form id="form" class="demo-ruleForm" :model="wechatVersion" ref="wechatVersion" :rules="rules" label-position="right" label-width="40%">
<el-form-item label="Wechat Dest Version" prop="dest">
<el-input v-model="wechatVersion.dest"></el-input>
</el-form-item>
<el-form-item label="Wechat Hex Version" prop="hex">
<el-input v-model="wechatVersion.hex" readonly></el-input>
</el-form-item>
<el-form-item label="Wechat Version(Int)" prop="int">
<el-input v-model="wechatVersion.int" readonly></el-input>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="convert('wechatVersion')">Convert</el-button>
<el-button native-type="reset">Reset</el-button>
</el-form-item>
</el-form>
</el-container>
</el-main>
</el-container>
</div>
</body>
<script>
new Vue({
el: '#app',
data: function () {
var validateDest = (rule, value, callback) => {
if (!value) {
return callback(new Error('DestVersion must not null'));
}
setTimeout(() => {
if (!/^(\d\.){3}(25[0-5]|2[0-4][0-9]|[0-1]?[0-9]?[0-9])$/.test(value)) {
callback(new Error('Please input the format like a.b.c.d (0<=a,b,c<=9, 0<=d<=255; eg: 3.5.0.46)'));
} else {
callback();
}
}, 100);
};
return {
wechatVersion: {
dest: '',
hex: '',
int: ''
},
rules: {
dest: [
{ validator: validateDest, trigger: 'blur' }
]
}
}
},
methods: {
convert: function (formName) {
this.$refs[formName].validate((valid) => {
if (valid) {
this.wechatVersion.hex = this.dest2hex(this.wechatVersion.dest);
this.wechatVersion.int = parseInt(this.wechatVersion.hex, 16)
// alert('submit!');
} else {
console.log('error submit!!');
alert('Failed to convert')
return false;
}
});
},
dest2hex: function (ver) {
version_list = ver.split('.');
version_list[0] = '6' + parseInt(version_list[0], 10).toString(16);
version_list[1] = parseInt(version_list[1], 10).toString(16);
if (version_list[1].length == 1 ) {
version_list[1] = '0' + version_list[1];
}
version_list[2] = parseInt(version_list[2], 10).toString(16);
if (version_list[2].length == 1 ) {
version_list[2] = '0' + version_list[2];
}
version_list[3] = parseInt(version_list[3], 10).toString(16);
if (version_list[3].length == 1 ) {
version_list[3] = '0' + version_list[3];
}
version_hex = '0x' + version_list[0] + version_list[1] + version_list[2] + version_list[3];
return version_hex
}
}
})
</script>
<style>
.github-corner:hover .octo-arm {
animation: octocat-wave 560ms ease-in-out
}
@keyframes octocat-wave {
0%, 100% {
transform: rotate(0)
}
20%, 60% {
transform: rotate(-25deg)
}
40%, 80% {
transform: rotate(10deg)
}
}
@media (max-width: 500px) {
.github-corner:hover .octo-arm {
animation: none
}
.github-corner .octo-arm {
animation: octocat-wave 560ms ease-in-out
}
}
</style>
</html>

127
scripts/destVersionRelease.sh Executable file
View File

@ -0,0 +1,127 @@
#!/usr/bin/env bash
set -eo pipefail
temp_path="WeChatSetup/temp"
latest_path="WeChatSetup/latest"
download_link="$1"
if [ -z "$1" ]; then
>&2 echo -e "Missing argument. Using default download link"
download_link="https://dldir1.qq.com/weixin/Windows/WeChatSetup.exe"
fi
function install_depends() {
printf "#%.0s" {1..60}
echo
echo -e "## \033[1;33mInstalling 7zip, shasum, wget, curl, git\033[0m"
printf "#%.0s" {1..60}
echo
apt install -y p7zip-full p7zip-rar libdigest-sha-perl wget curl git
}
function login_gh() {
printf "#%.0s" {1..60}
echo
echo -e "## \033[1;33mLogin to github to use github-cli...\033[0m"
printf "#%.0s" {1..60}
echo
if [ -z $GHTOKEN ]; then
>&2 echo -e "\033[1;31mMissing Github Token! Please get a BotToken from 'Github Settings->Developer settings->Personal access tokens' and set it in Repo Secrect\033[0m"
exit 1
fi
echo $GHTOKEN > WeChatSetup/temp/GHTOKEN
gh auth login --with-token < WeChatSetup/temp/GHTOKEN
if [ "$?" -ne 0 ]; then
>&2 echo -e "\033[1;31mLogin Failed, please check your network or token!\033[0m"
clean_data 1
fi
rm -rfv WeChatSetup/temp/GHTOKEN
}
function download_wechat() {
printf "#%.0s" {1..60}
echo
echo -e "## \033[1;33mDownloading the newest WechatSetup...\033[0m"
printf "#%.0s" {1..60}
echo
wget "$download_link" -O ${temp_path}/WeChatSetup.exe
if [ "$?" -ne 0 ]; then
>&2 echo -e "\033[1;31mDownload Failed, please check your network!\033[0m"
clean_data 1
fi
}
function extract_version() {
printf "#%.0s" {1..60}
echo
echo -e "## \033[1;33mExtract WechatSetup, get the dest version of wechat\033[0m"
printf "#%.0s" {1..60}
echo
local outfile=`7z l ${temp_path}/WeChatSetup.exe | grep improve.xml | awk 'NR ==1 { print $NF }'`
## 7z x ${temp_path}/WeChatSetup.exe -o${temp_path}/temp "\$R5/Tencent/WeChat/improve.xml"
7z x ${temp_path}/WeChatSetup.exe -o${temp_path}/temp $outfile
dest_version=`awk '/MinVersion/{ print $2 }' ${temp_path}/temp/$outfile | sed -e 's/^.*="//g' -e 's/".*$//g'`
}
# rename and replace
function prepare_commit() {
printf "#%.0s" {1..60}
echo
echo -e "## \033[1;33mPrepare to commit new version\033[0m"
printf "#%.0s" {1..60}
echo
mkdir -p WeChatSetup/$dest_version
cp $temp_path/WeChatSetup.exe WeChatSetup/$dest_version/WeChatSetup-$dest_version.exe
echo "DestVersion: $dest_version" > WeChatSetup/$dest_version/WeChatSetup-$dest_version.exe.sha256
echo "Sha256: $now_sum256" >> WeChatSetup/$dest_version/WeChatSetup-$dest_version.exe.sha256
echo "UpdateTime: $(date -u '+%Y-%m-%d %H:%M:%S') (UTC)" >> WeChatSetup/$dest_version/WeChatSetup-$dest_version.exe.sha256
echo "DownloadFrom: $download_link" >> WeChatSetup/$dest_version/WeChatSetup-$dest_version.exe.sha256
}
function clean_data() {
printf "#%.0s" {1..60}
echo
echo -e "## \033[1;33mClean runtime and exit...\033[0m"
printf "#%.0s" {1..60}
echo
rm -rfv WeChatSetup/*
exit $1
}
function main() {
# rm -rfv WeChatSetup/*
mkdir -p ${temp_path}/temp
login_gh
## https://github.com/actions/virtual-environments/blob/main/images/linux/Ubuntu2004-Readme.md
# install_depends
download_wechat
now_sum256=`shasum -a 256 ${temp_path}/WeChatSetup.exe | awk '{print $1}'`
local latest_sum256=`gh release view --json body --jq ".body" | awk '/Sha256/{ print $2 }'`
if [ "$now_sum256" = "$latest_sum256" ]; then
>&2 echo -e "\n\033[1;32mThis is the newest Version!\033[0m\n"
clean_data 0
fi
## if not the newest
extract_version
prepare_commit
gh release create v$dest_version ./WeChatSetup/$dest_version/WeChatSetup-$dest_version.exe -F ./WeChatSetup/$dest_version/WeChatSetup-$dest_version.exe.sha256 -t "Wechat v$dest_version"
gh auth logout --hostname github.com | echo "y"
clean_data 0
}
main

85
scripts/destversion.sh Executable file
View File

@ -0,0 +1,85 @@
#!/usr/bin/env bash
# 已废弃
set -eo pipefail
temp_path="WeChatSetup/temp"
latest_path="WeChatSetup/latest"
function install_depends () {
printf "#%.0s" {1..60}
echo
echo -e "## \033[1;33mInstalling 7zip, shasum, wget, curl, git\033[0m"
printf "#%.0s" {1..60}
echo
apt install -y p7zip-full p7zip-rar libdigest-sha-perl wget curl git
}
function download_wechat() {
printf "#%.0s" {1..60}
echo
echo -e "## \033[1;33mDownloading the newest WechatSetup...\033[0m"
printf "#%.0s" {1..60}
echo
wget https://dldir1.qq.com/weixin/Windows/WeChatSetup.exe -O ${temp_path}/WeChatSetup.exe
if [ "$?" -ne 0 ]; then
>&2 echo -e "\033[1;31mDownload Failed, please check your network!\033[0m"
exit 1
fi
}
function extract_version() {
printf "#%.0s" {1..60}
echo
echo -e "## \033[1;33mExtract WechatSetup, get the dest version of wechat\033[0m"
printf "#%.0s" {1..60}
echo
mkdir -p ${temp_path}/temp
local outfile=`7z l ${temp_path}/WeChatSetup.exe | grep improve.xml | awk 'NR ==1 { print $NF }'`
# 7z x ${temp_path}/WeChatSetup.exe -o${temp_path}/temp "\$R5/Tencent/WeChat/improve.xml"
7z x ${temp_path}/WeChatSetup.exe -o${temp_path}/temp $outfile
dest_version=`awk '/MinVersion/{ print $2 }' ${temp_path}/temp/$outfile | sed -e 's/^.*="//g' -e 's/".*$//g'`
rm -rfv ${temp_path}/temp
}
# rename and replace
function prepare_commit() {
printf "#%.0s" {1..60}
echo
echo -e "## \033[1;33mPrepare to commit new version and clean runtime\033[0m"
printf "#%.0s" {1..60}
echo
mkdir -p WeChatSetup/$dest_version
cp $temp_path/WeChatSetup.exe WeChatSetup/$dest_version/WeChatSetup-$dest_version.exe
echo "$now_sum256 WeChatSetup-$dest_version.exe" > WeChatSetup/$dest_version/WeChatSetup-$dest_version.exe.sha256
cp $temp_path/WeChatSetup.exe WeChatSetup/latest/WeChatSetup-latest.exe
echo "$now_sum256 WeChatSetup-latest.exe" > WeChatSetup/latest/WeChatSetup-latest.exe.sha256
# clean runtime
rm -rfv ${temp_path}/*
}
function main() {
install_depends
download_wechat
now_sum256=`shasum -a 256 ${temp_path}/WeChatSetup.exe | awk '{print $1}'`
local latest_sum256=`cat ${latest_path}/WeChatSetup-latest.exe.sha256 | awk '{print $1}'`
if [ "$now_sum256" = "$latest_sum256" ]; then
>&2 echo -e "\n\033[1;32mThis is the newest Version! Clean runtime and exit...\033[0m\n"
rm -rfv ${temp_path}/*
exit 0
fi
## if not the newest
extract_version
prepare_commit
git add . && git commit -m "Add new dest version: $dest_version" && git push origin master
}
main

84
scripts/notify.sh Executable file
View File

@ -0,0 +1,84 @@
#!/usr/bin/env bash
set -eo pipefail
if [ -z $GHTOKEN ]; then
>&2 echo -e "\033[1;31mMissing Github Token(GHTOKEN)! Please get a BotToken from 'Github Settings->Developer settings->Personal access tokens' and set it in Repo Secrect\033[0m"
exit 1
fi
if [ -z $BOTTOKEN ]; then
>&2 echo -e "\033[1;31mMissing Bot Token(BOTTOKEN)! Please get a BotToken from @Botfather on Telegram and set it in Repo Secrect\033[0m"
exit 2
fi
if [ -z $CHATIDS ]; then
>&2 echo -e "\033[1;31mMissing ChatIds(CHATIDS)! Please get ChatId from @GroupIDbot on Telegram Chats(Muti chatids split with comma ',') and set it in Repo Environment Values\033[0m"
exit 2
fi
function login_gh() {
printf "#%.0s" {1..60}
echo
echo -e "## \033[1;33mLogin to github to use github-cli...\033[0m"
printf "#%.0s" {1..60}
echo
echo $GHTOKEN > WeChatSetup/temp/GHTOKEN
gh auth login --with-token < WeChatSetup/temp/GHTOKEN
if [ "$?" -ne 0 ]; then
>&2 echo -e "\033[1;31mLogin Failed, please check your network or token!\033[0m"
clean_data 1
fi
rm -rfv WeChatSetup/temp/GHTOKEN
}
### https://kodango.com/sed-and-awk-notes-part-5
## start=${1:-""} means as follows in general
## if ($1) then
## start=$1
## else
## start=""
## end
function join_lines() {
local delim=${1:-,}
sed 'H;$!d;${x;s/^\n//;s/\n/\'$delim'/g}'
}
function clean_data() {
printf "#%.0s" {1..60}
echo
echo -e "## \033[1;33mClean runtime and exit...\033[0m"
printf "#%.0s" {1..60}
echo
rm -rfv WeChatSetup/*
exit $1
}
function main() {
temp_path="WeChatSetup/temp"
mkdir -p ${temp_path}
login_gh
gh release view --json body --jq ".body" > ${temp_path}/release.info
release_info=`awk '!/^$|Sha256/ { $1="*"$1"*";sub("UpdateTime", "CheckTime"); if ( match($2, /https?:\/\/([\w\.\/:])*/) ) $2="[Url]("$2")"; print $0 }' ${temp_path}/release.info | join_lines '%0A' | sed 's/ /%20/g'`
dest_version=`awk '/DestVersion/ { print $2 }' ${temp_path}/release.info`
release_info="$release_info%0A%0A*NotifyFrom:*%20[Github](https://github.com/tom-snow/wechat-windows-versions/releases/tag/v$dest_version)"
echo $CHATIDS | sed 's/,/\n/g' > ${temp_path}/chat_ids
# while IFS="" read -r chatid || [ -n "$chatid" ]
while IFS="" read -r chatid
do
api_link="https://api.telegram.org/bot$BOTTOKEN/sendMessage?chat_id=$chatid&text=*New%20WeChat%20Windows%20Version!!*%0A%0A$release_info&parse_mode=Markdown&disable_web_page_preview=true"
curl -s -o /dev/null $api_link
done < ${temp_path}/chat_ids
gh auth logout --hostname github.com | echo "y"
clean_data 0
}
main