mirror of
https://github.com/Sunnyyoung/WeChatTweak-macOS.git
synced 2026-01-17 15:35:39 +08:00
Compare commits
17 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ebdcb7bbd2 | ||
|
|
2a9978b046 | ||
|
|
ac9b1575de | ||
|
|
0682644327 | ||
|
|
3cc0f2c5c6 | ||
|
|
f8226536dc | ||
|
|
87d4854174 | ||
|
|
4f801b35f2 | ||
|
|
6d3c75faec | ||
|
|
6922703e57 | ||
|
|
171c352dce | ||
|
|
a58f04b1d4 | ||
|
|
003643d063 | ||
|
|
4b1bd7c2ab | ||
|
|
540f13b35b | ||
|
|
723e982bf3 | ||
|
|
8e13e947d5 |
|
|
@ -1 +0,0 @@
|
||||||
2.7.8
|
|
||||||
|
|
@ -1,5 +0,0 @@
|
||||||
# Contributing
|
|
||||||
|
|
||||||
This project exists thanks to all the people who contribute. [[Contribute](CONTRIBUTING.md)].
|
|
||||||
|
|
||||||
[](https://github.com/Sunnyyoung/WeChatTweak-macOS/graphs/contributors)
|
|
||||||
23
README.md
23
README.md
|
|
@ -1,7 +1,10 @@
|
||||||
# WeChatTweak
|
# WeChatTweak
|
||||||
|
|
||||||
[](LICENSE)
|
[](https://github.com/sunnyyoung/WeChatTweak)
|
||||||
[](https://t.me/wechattweak)
|
[](https://t.me/wechattweak)
|
||||||
|
[](https://github.com/sunnyyoung/WeChatTweak/wiki/FAQ)
|
||||||
|
|
||||||
|
A command-line tool for tweaking WeChat.
|
||||||
|
|
||||||
## 功能
|
## 功能
|
||||||
|
|
||||||
|
|
@ -9,16 +12,20 @@
|
||||||
- 阻止自动更新
|
- 阻止自动更新
|
||||||
- 客户端多开
|
- 客户端多开
|
||||||
|
|
||||||
## 安装
|
## 安装&使用
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
|
# 安装
|
||||||
brew install sunnyyoung/tap/wechattweak
|
brew install sunnyyoung/tap/wechattweak
|
||||||
```
|
|
||||||
|
|
||||||
## 使用
|
# 更新
|
||||||
|
brew upgrade wechattweak
|
||||||
|
|
||||||
```bash
|
# 执行 Patch
|
||||||
wechattweak patch
|
wechattweak patch
|
||||||
|
|
||||||
|
# 查看所有支持的 WeChat 版本
|
||||||
|
wechattweak versions
|
||||||
```
|
```
|
||||||
|
|
||||||
## 参考
|
## 参考
|
||||||
|
|
@ -29,9 +36,9 @@ wechattweak patch
|
||||||
|
|
||||||
## 贡献者
|
## 贡献者
|
||||||
|
|
||||||
This project exists thanks to all the people who contribute. [[Contribute](CONTRIBUTING.md)].
|
This project exists thanks to all the people who contribute.
|
||||||
|
|
||||||
[](https://github.com/Sunnyyoung/WeChatTweak-macOS/graphs/contributors)
|
[](https://github.com/sunnyyoung/WeChatTweak/graphs/contributors)
|
||||||
|
|
||||||
## License
|
## License
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -81,7 +81,7 @@ struct Config: Decodable {
|
||||||
let version: String
|
let version: String
|
||||||
let targets: [Target]
|
let targets: [Target]
|
||||||
|
|
||||||
static func load(from url: URL) async throws -> [Config] {
|
static func load(url: URL) async throws -> [Config] {
|
||||||
if url.isFileURL {
|
if url.isFileURL {
|
||||||
return try JSONDecoder().decode(
|
return try JSONDecoder().decode(
|
||||||
[Config].self,
|
[Config].self,
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,64 @@ import Foundation
|
||||||
import Dispatch
|
import Dispatch
|
||||||
import ArgumentParser
|
import ArgumentParser
|
||||||
|
|
||||||
struct Patch: AsyncParsableCommand {
|
// MARK: Versions
|
||||||
|
extension Tweak {
|
||||||
|
struct Versions: AsyncParsableCommand {
|
||||||
|
static let configuration = CommandConfiguration(abstract: "List all supported WeChat versions")
|
||||||
|
|
||||||
|
@OptionGroup
|
||||||
|
var options: Tweak.Options
|
||||||
|
|
||||||
|
mutating func run() async throws {
|
||||||
|
print("------ Current version ------")
|
||||||
|
print(try await Command.version(app: options.app) ?? "unknown")
|
||||||
|
print("------ Supported versions ------")
|
||||||
|
try await Config.load(url: options.config).forEach({ print($0.version) })
|
||||||
|
Darwin.exit(EXIT_SUCCESS)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// MARK: Patch
|
||||||
|
extension Tweak {
|
||||||
|
struct Patch: AsyncParsableCommand {
|
||||||
|
static let configuration = CommandConfiguration(abstract: "Patch WeChat.app")
|
||||||
|
|
||||||
|
@OptionGroup
|
||||||
|
var options: Tweak.Options
|
||||||
|
|
||||||
|
mutating func run() async throws {
|
||||||
|
print("------ Version ------")
|
||||||
|
let version = try await Command.version(app: options.app)
|
||||||
|
print("WeChat version: \(version ?? "unknown")")
|
||||||
|
|
||||||
|
print("------ Config ------")
|
||||||
|
guard let config = (try await Config.load(url: options.config)).first(where: { $0.version == version }) else {
|
||||||
|
throw Error.unsupportedVersion
|
||||||
|
}
|
||||||
|
print("Matched config: \(config)")
|
||||||
|
|
||||||
|
print("------ Patch ------")
|
||||||
|
try await Command.patch(
|
||||||
|
app: options.app,
|
||||||
|
config: config
|
||||||
|
)
|
||||||
|
print("Done!")
|
||||||
|
|
||||||
|
print("------ Resign ------")
|
||||||
|
try await Command.resign(
|
||||||
|
app: options.app
|
||||||
|
)
|
||||||
|
print("Done!")
|
||||||
|
|
||||||
|
Darwin.exit(EXIT_SUCCESS)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// MARK: Tweak
|
||||||
|
struct Tweak: AsyncParsableCommand {
|
||||||
enum Error: LocalizedError {
|
enum Error: LocalizedError {
|
||||||
case invalidApp
|
case invalidApp
|
||||||
case invalidConfig
|
case invalidConfig
|
||||||
|
|
@ -29,82 +86,49 @@ struct Patch: AsyncParsableCommand {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static let configuration = CommandConfiguration(abstract: "Patch WeChat.app")
|
struct Options: ParsableArguments {
|
||||||
|
@Option(
|
||||||
@Option(
|
name: .shortAndLong,
|
||||||
name: .shortAndLong,
|
help: "Path of WeChat.app",
|
||||||
help: "Path of WeChat.app",
|
transform: {
|
||||||
transform: {
|
guard FileManager.default.fileExists(atPath: $0) else {
|
||||||
guard FileManager.default.fileExists(atPath: $0) else {
|
throw Error.invalidApp
|
||||||
throw Error.invalidApp
|
|
||||||
}
|
|
||||||
return URL(fileURLWithPath: $0)
|
|
||||||
}
|
|
||||||
)
|
|
||||||
var app: URL = URL(fileURLWithPath: "/Applications/WeChat.app", isDirectory: true)
|
|
||||||
|
|
||||||
@Option(
|
|
||||||
name: .shortAndLong,
|
|
||||||
help: "Local path or Remote URL of config.json",
|
|
||||||
transform: {
|
|
||||||
if FileManager.default.fileExists(atPath: $0) {
|
|
||||||
return URL(fileURLWithPath: $0)
|
|
||||||
} else {
|
|
||||||
guard let url = URL(string: $0) else {
|
|
||||||
throw Error.invalidConfig
|
|
||||||
}
|
}
|
||||||
return url
|
return URL(fileURLWithPath: $0)
|
||||||
}
|
}
|
||||||
}
|
)
|
||||||
)
|
var app: URL = URL(fileURLWithPath: "/Applications/WeChat.app", isDirectory: true)
|
||||||
var config: URL = URL(string: "https://raw.githubusercontent.com/sunnyyoung/WeChatTweak/refs/heads/feature/2.0/config.json")!
|
|
||||||
|
|
||||||
mutating func run() async throws {
|
@Option(
|
||||||
do {
|
name: .shortAndLong,
|
||||||
print("------ Version ------")
|
help: "Local path or Remote URL of config.json",
|
||||||
guard let version = try await Command.version(app: self.app) else {
|
transform: {
|
||||||
throw Error.invalidVersion
|
if FileManager.default.fileExists(atPath: $0) {
|
||||||
|
return URL(fileURLWithPath: $0)
|
||||||
|
} else {
|
||||||
|
guard let url = URL(string: $0) else {
|
||||||
|
throw Error.invalidConfig
|
||||||
|
}
|
||||||
|
return url
|
||||||
|
}
|
||||||
}
|
}
|
||||||
print("\(version)")
|
)
|
||||||
|
var config: URL = URL(string:"https://raw.githubusercontent.com/sunnyyoung/WeChatTweak/refs/heads/master/config.json")!
|
||||||
print("------ Config ------")
|
|
||||||
guard let config = (try await Config.load(from: self.config)).first(where: { $0.version == version }) else {
|
|
||||||
throw Error.unsupportedVersion
|
|
||||||
}
|
|
||||||
print("\(config)")
|
|
||||||
|
|
||||||
print("------ Patch ------")
|
|
||||||
try await Command.patch(
|
|
||||||
app: self.app,
|
|
||||||
config: config
|
|
||||||
)
|
|
||||||
print("Done!")
|
|
||||||
|
|
||||||
print("------ Resign ------")
|
|
||||||
try await Command.resign(
|
|
||||||
app: self.app
|
|
||||||
)
|
|
||||||
print("Done!")
|
|
||||||
|
|
||||||
print("------🎉 Done!------")
|
|
||||||
Darwin.exit(EXIT_SUCCESS)
|
|
||||||
} catch {
|
|
||||||
print("------🚨 Error------")
|
|
||||||
print("\(error.localizedDescription)")
|
|
||||||
Darwin.exit(EXIT_FAILURE)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
struct Tweak: AsyncParsableCommand {
|
|
||||||
static let configuration = CommandConfiguration(
|
static let configuration = CommandConfiguration(
|
||||||
commandName: "wechattweak",
|
commandName: "wechattweak",
|
||||||
abstract: "A command-line tool for tweaking WeChat.",
|
abstract: "A command-line tool for tweaking WeChat.",
|
||||||
subcommands: [
|
subcommands: [
|
||||||
|
Versions.self,
|
||||||
Patch.self
|
Patch.self
|
||||||
],
|
]
|
||||||
defaultSubcommand: Self.self
|
|
||||||
)
|
)
|
||||||
|
|
||||||
|
mutating func run() async throws {
|
||||||
|
print(Tweak.helpMessage())
|
||||||
|
Darwin.exit(EXIT_SUCCESS)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Task {
|
Task {
|
||||||
|
|
|
||||||
110
config.json
110
config.json
|
|
@ -168,5 +168,115 @@
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"version": "32288",
|
||||||
|
"targets": [
|
||||||
|
{
|
||||||
|
"identifier": "revoke",
|
||||||
|
"entries": [
|
||||||
|
{
|
||||||
|
"arch": "arm64",
|
||||||
|
"addr": "103db34c0",
|
||||||
|
"asm": "00008052C0035FD6"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"identifier": "startUpdater",
|
||||||
|
"entries": [
|
||||||
|
{
|
||||||
|
"arch": "arm64",
|
||||||
|
"addr": "1001e9ed0",
|
||||||
|
"asm": "00008052C0035FD6"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"identifier": "startBackgroundUpdatesCheck",
|
||||||
|
"entries": [
|
||||||
|
{
|
||||||
|
"arch": "arm64",
|
||||||
|
"addr": "1001ecb10",
|
||||||
|
"asm": "00008052C0035FD6"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"identifier": "checkForUpdates",
|
||||||
|
"entries": [
|
||||||
|
{
|
||||||
|
"arch": "arm64",
|
||||||
|
"addr": "1001ec73c",
|
||||||
|
"asm": "00008052C0035FD6"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"identifier": "enableAutoUpdate",
|
||||||
|
"entries": [
|
||||||
|
{
|
||||||
|
"arch": "arm64",
|
||||||
|
"addr": "1001ecfc0",
|
||||||
|
"asm": "00008052C0035FD6"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"identifier": "automaticallyDownloadsUpdates",
|
||||||
|
"entries": [
|
||||||
|
{
|
||||||
|
"arch": "arm64",
|
||||||
|
"addr": "1001f59e0",
|
||||||
|
"asm": "00008052C0035FD6"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"identifier": "canCheckForUpdate",
|
||||||
|
"entries": [
|
||||||
|
{
|
||||||
|
"arch": "arm64",
|
||||||
|
"addr": "1001f59e0",
|
||||||
|
"asm": "00008052C0035FD6"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"identifier": "multiInstance",
|
||||||
|
"entries": [
|
||||||
|
{
|
||||||
|
"arch": "arm64",
|
||||||
|
"addr": "1001e1a74",
|
||||||
|
"asm": "20008052C0035FD6"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"version": "31960",
|
||||||
|
"targets": [
|
||||||
|
{
|
||||||
|
"identifier": "revoke",
|
||||||
|
"entries": [
|
||||||
|
{
|
||||||
|
"arch": "arm64",
|
||||||
|
"addr": "10408a408",
|
||||||
|
"asm": "00008052C0035FD6"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"identifier": "multiInstance",
|
||||||
|
"entries": [
|
||||||
|
{
|
||||||
|
"arch": "arm64",
|
||||||
|
"addr": "1001e4a38",
|
||||||
|
"asm": "20008052C0035FD6"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user