Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
.DS_Store
.theos
.theos
CLAUDE.md
packages/*.deb
64 changes: 64 additions & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
# AGENTS.md

This file provides guidance to Codex (Codex.ai/code) when working with code in this repository.

## 构建命令

需要先安装 [Theos](https://github.com/theos/theos) 和 [cyan](https://github.com/asdfzxcvbn/pyzule-rw)。

```bash
# Sideloaded(需要 packages/com.atebits.Tweetie2.ipa)
./build.sh --sideloaded

# TrollStore(需要 packages/com.atebits.Tweetie2.ipa)
./build.sh --trollstore

# Rootless .deb
./build.sh --rootless

# Rootfull .deb
./build.sh --rootfull
```

直接调用 make:
```bash
make # debug build
make package # 打包 .deb
make clean # 清理构建产物
```

## 架构概览

这是一个 **iOS Theos tweak**,通过 Cydia Substrate 注入 Twitter/X 客户端进程,使用 Logos(`.x` 文件)语法 hook Objective-C 方法。

### 核心文件

- **`Tweak.x`** — 所有 hook 的入口,使用 `%hook`/`%orig` 语法拦截 Twitter 私有类方法
- **`BHTManager.m/.h`** — 功能开关管理器,所有设置读写通过 `NSUserDefaults` 完成,方法均为类方法(`+`)
- **`SettingsViewController.m/.h`** — 设置界面,基于 Cephei 框架(`HBListController`)
- **`TWHeaders.h`** — Twitter 私有类/协议的头文件声明

### 子模块/依赖目录

| 目录 | 用途 |
|------|------|
| `BHDownload/` | 视频下载逻辑 |
| `BHTBundle/` | Bundle 资源加载 |
| `ffmpeg/` | FFmpegKit 头文件(`.a` 静态库在 `lib/`) |
| `JGProgressHUD/` | 进度 HUD UI 组件 |
| `SAMKeychain/` | Keychain 访问(用于 Padlock 功能) |
| `Colours/` | 颜色工具 |
| `CustomTabBar/` | 自定义 Tab Bar |
| `ThemeColor/` | 主题颜色 |
| `AppIcon/` | 应用图标切换 |
| `keychainfix/` | Sideload 模式下的 Keychain 修复子项目 |

### 设置键(NSUserDefaults)

`BHTManager` 中每个 `+` 方法对应一个 `NSUserDefaults` 布尔键,例如 `dw_v`(下载视频)、`hide_promoted`(隐藏广告)等。首次启动时在 `T1AppDelegate` hook 中设置默认值(key: `FirstRun_4.3`)。

### 构建变体

- **Sideloaded/TrollStore**:`make SIDELOADED=1`,额外编译 `keychainfix` 子项目,用 `cyan` 注入 IPA
- **Rootless**:`THEOS_PACKAGE_SCHEME=rootless make package`
- **Rootfull**:`make package`(默认)
1 change: 1 addition & 0 deletions BHTManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
+ (BOOL)FollowConfirm;
+ (BOOL)HidePromoted;
+ (BOOL)HideTopics;
+ (BOOL)HideReposts;
+ (BOOL)DisableVODCaptions;
+ (BOOL)Padlock;
+ (BOOL)changeFont;
Expand Down
3 changes: 3 additions & 0 deletions BHTManager.m
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,9 @@ + (BOOL)HidePromoted {
+ (BOOL)HideTopics {
return [[NSUserDefaults standardUserDefaults] boolForKey:@"hide_topics"];
}
+ (BOOL)HideReposts {
return [[NSUserDefaults standardUserDefaults] boolForKey:@"hide_reposts"];
}
+ (BOOL)DisableVODCaptions {
return [[NSUserDefaults standardUserDefaults] boolForKey:@"dis_VODCaptions"];
}
Expand Down
64 changes: 64 additions & 0 deletions CLAUDE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
# CLAUDE.md

This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.

## 构建命令

需要先安装 [Theos](https://github.com/theos/theos) 和 [cyan](https://github.com/asdfzxcvbn/pyzule-rw)。

```bash
# Sideloaded(需要 packages/com.atebits.Tweetie2.ipa)
./build.sh --sideloaded

# TrollStore(需要 packages/com.atebits.Tweetie2.ipa)
./build.sh --trollstore

# Rootless .deb
./build.sh --rootless

# Rootfull .deb
./build.sh --rootfull
```

直接调用 make:
```bash
make # debug build
make package # 打包 .deb
make clean # 清理构建产物
```

## 架构概览

这是一个 **iOS Theos tweak**,通过 Cydia Substrate 注入 Twitter/X 客户端进程,使用 Logos(`.x` 文件)语法 hook Objective-C 方法。

### 核心文件

- **`Tweak.x`** — 所有 hook 的入口,使用 `%hook`/`%orig` 语法拦截 Twitter 私有类方法
- **`BHTManager.m/.h`** — 功能开关管理器,所有设置读写通过 `NSUserDefaults` 完成,方法均为类方法(`+`)
- **`SettingsViewController.m/.h`** — 设置界面,基于 Cephei 框架(`HBListController`)
- **`TWHeaders.h`** — Twitter 私有类/协议的头文件声明

### 子模块/依赖目录

| 目录 | 用途 |
|------|------|
| `BHDownload/` | 视频下载逻辑 |
| `BHTBundle/` | Bundle 资源加载 |
| `ffmpeg/` | FFmpegKit 头文件(`.a` 静态库在 `lib/`) |
| `JGProgressHUD/` | 进度 HUD UI 组件 |
| `SAMKeychain/` | Keychain 访问(用于 Padlock 功能) |
| `Colours/` | 颜色工具 |
| `CustomTabBar/` | 自定义 Tab Bar |
| `ThemeColor/` | 主题颜色 |
| `AppIcon/` | 应用图标切换 |
| `keychainfix/` | Sideload 模式下的 Keychain 修复子项目 |

### 设置键(NSUserDefaults)

`BHTManager` 中每个 `+` 方法对应一个 `NSUserDefaults` 布尔键,例如 `dw_v`(下载视频)、`hide_promoted`(隐藏广告)等。首次启动时在 `T1AppDelegate` hook 中设置默认值(key: `FirstRun_4.3`)。

### 构建变体

- **Sideloaded/TrollStore**:`make SIDELOADED=1`,额外编译 `keychainfix` 子项目,用 `cyan` 注入 IPA
- **Rootless**:`THEOS_PACKAGE_SCHEME=rootless make package`
- **Rootfull**:`make package`(默认)
3 changes: 3 additions & 0 deletions SettingsViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,8 @@ - (NSArray *)specifiers {
PSSpecifier *mediaUpload4k = [self newSwitchCellWithTitle:[[BHTBundle sharedBundle] localizedStringForKey:@"MEDIA_UPLOAD_4K_ENABLED_OPTION_TITLE"] detailTitle:[[BHTBundle sharedBundle] localizedStringForKey:@"MEDIA_UPLOAD_4K_ENABLED_OPTION_DETAIL_TITLE"] key:@"media_upload_4k_enabled" defaultValue:false changeAction:nil];

PSSpecifier *hideTopics = [self newSwitchCellWithTitle:[[BHTBundle sharedBundle] localizedStringForKey:@"HIDE_TOPICS_OPTION_TITLE"] detailTitle:[[BHTBundle sharedBundle] localizedStringForKey:@"HIDE_TOPICS_OPTION_DETAIL_TITLE"] key:@"hide_topics" defaultValue:false changeAction:nil];

PSSpecifier *hideReposts = [self newSwitchCellWithTitle:[[BHTBundle sharedBundle] localizedStringForKey:@"HIDE_REPOSTS_OPTION_TITLE"] detailTitle:[[BHTBundle sharedBundle] localizedStringForKey:@"HIDE_REPOSTS_OPTION_DETAIL_TITLE"] key:@"hide_reposts" defaultValue:false changeAction:nil];

PSSpecifier *hideWhoToFollow = [self newSwitchCellWithTitle:[[BHTBundle sharedBundle] localizedStringForKey:@"HIDE_WHO_FOLLOW_OPTION"] detailTitle:[[BHTBundle sharedBundle] localizedStringForKey:@"HIDE_WHO_FOLLOW_OPTION_DETAIL_TITLE"] key:@"hide_who_to_follow" defaultValue:false changeAction:nil];

Expand Down Expand Up @@ -275,6 +277,7 @@ - (NSArray *)specifiers {
dmReplyLater,
mediaUpload4k,
hideTopics,
hideReposts,
hideWhoToFollow,
hideTopicsToFollow,
hideTrendVideos,
Expand Down
1 change: 1 addition & 0 deletions TWHeaders.h
Original file line number Diff line number Diff line change
Expand Up @@ -378,6 +378,7 @@ static NSString *_lastCopiedURL;
@interface T1URTTimelineStatusItemViewModel : NSObject
@property(nonatomic, readonly) NSString *text;
@property(nonatomic, readonly) _Bool isPromoted;
@property(nonatomic, readonly) _Bool isRetweet;
@property(nonatomic, retain) id <TFNTwitterStatusBanner> banner;
@end

Expand Down
Loading