Skip to content

Commit

Permalink
Merge branch '2.2' into 2.x
Browse files Browse the repository at this point in the history
  • Loading branch information
wwg135 authored Aug 11, 2024
2 parents 869cf56 + 81980a1 commit 9b96603
Show file tree
Hide file tree
Showing 21 changed files with 540 additions and 67 deletions.
110 changes: 71 additions & 39 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -1,43 +1,53 @@
name: "Dopamine: build and upload"
name: build_Release

on:
push:
branches:
- '*'
- 2.2
paths-ignore:
- ".gitignore"
pull_request:
branches:
- '*'
- 2.2
paths-ignore:
- ".gitignore"
workflow_dispatch:
schedule:
- cron: '0 0 1 1 *'
- cron: '0 0 1 4 *'
- cron: '0 0 30 6 *'
- cron: '0 0 28 9 *'
- cron: '0 0 27 12 *'


concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

permissions:
contents: write

env:
VERSION: '2.2.1'
BUNDLEID: 'com.wwg135.Dopamine'

jobs:
build:
runs-on: macos-13
environment: Auto Build And Release
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4.1.7
with:
submodules: recursive

- name: Install Procursus
uses: dhinakg/procursus-action@main
- name: Pre Procursus
uses: wwg135/procursus-action@main
with:
packages: ldid findutils sed coreutils make
packages: ldid findutils coreutils make sed

- name: Install THEOS
- name: Pre trustcache
run: |
set -x
git clone https://github.com/CRKatri/trustcache
cd trustcache
gmake -j$(sysctl -n hw.physicalcpu) OPENSSL=1
sudo cp trustcache /opt/procursus/bin/
- name: Pre theos
run: |
set -x
export BASEDIR="$(pwd)"
Expand All @@ -52,45 +62,67 @@ jobs:
rm $THEOS/sdks/iPhoneOS16.5.sdk.tar
cd $BASEDIR
- name: Build and Install trustcache
- name: Pre Bundleid
run: |
set -x
git clone https://github.com/CRKatri/trustcache
cd trustcache
gmake -j$(sysctl -n hw.physicalcpu) OPENSSL=1
sudo cp trustcache /opt/procursus/bin/
sed -i '' "s/com.opa334.Dopamine/${{ env.BUNDLEID }}/g" ./Application/Dopamine/Jailbreak/DOPreferenceManager.m
sed -i '' "s/com.opa334.Dopamine/${{ env.BUNDLEID }}/g" ./Application/Dopamine.xcodeproj/project.pbxproj
sed -i '' "s/com.opa334.Dopamine/${{ env.BUNDLEID }}/g" ./BaseBin/jbctl/src/main.m
- name: Set Environment Variables
- name: Set env
run: |
set -x
T2=$(TZ=UTC-2 date +'%Y%m%d_%H%M%S')
TS=$(date -j -f "%Y%m%d_%H%M%S" "${T2}" +%s)
SHASH=$(git rev-parse --short HEAD)
echo "ctime=${T2}" >> $GITHUB_ENV
echo "ctimestamp=${TS}" >> $GITHUB_ENV
echo "shorthash=${SHASH}" >> $GITHUB_ENV
sT=$(TZ=UTC-8 date +'%S')
echo "msT=$(date -j -f "%Y-%m-%d %H:%M:%S" "$(TZ=UTC-8 date +'%Y-%m-%d %H:%M'):${sT}" +%s)" >> $GITHUB_ENV
echo "shT=$(TZ=UTC-8 date +'%Y-%m-%d'' ''%H:%M:%S')" >> $GITHUB_ENV
echo "logT=$(TZ=UTC-8 date +'%Y年%m月%d %H:%M'):${sT}" >> $GITHUB_ENV
- name: Print env
run: |
echo ${{ env.VERSION }}
echo ${{ env.msT }}
echo ${{ env.shT }}
echo ${{ env.logT }}
- name: Pre Version
run: |
echo "${{ env.VERSION }}" >./BaseBin/_external/basebin/.version
sed -i '' 's/MARKETING_VERSION = .*;/MARKETING_VERSION = ${{ env.VERSION }};/g' ./Application/Dopamine.xcodeproj/project.pbxproj
sed -i '' "s/AAA/更新时间:${{ env.shT }} 由M哥编译/g" ./Application/Dopamine/UI/DOMainViewController.m
- name: Install libarchive
run: |
brew install libarchive
- name: Download Bootstraps
run: |
set -x
cd Application/Dopamine/Resources
./download_bootstraps.sh
set -x
cd Application/Dopamine/Resources
./download_bootstraps.sh
- name: Build
- name: Build ipa
run: |
set -x
export BASEDIR="$(pwd)"
export THEOS="${BASEDIR}/theos"
gmake -j$(sysctl -n hw.physicalcpu) NIGHTLY=1
mv Application/Dopamine.tipa Dopamine.ipa
- name: Upload Artifact
id: dopamine-latest-upload
uses: actions/upload-artifact@v3
- name: Release Logs
run: |
set -x
echo -e "更新时间:${{ env.logT }}" >> body.txt
echo "" >> ./release.md
cat body.txt > release.txt
echo "" >> release.txt
cat ./release.md >> release.txt
- name: Release ipa
uses: softprops/[email protected]
with:
name: Dopamine
path: |
${{ github.workspace }}/Application/Dopamine.ipa
name: ${{ env.VERSION }}
tag_name: ${{ env.VERSION }}
target_commitish: 2.x
body_path: release.txt
latest: true
token: ${{ secrets.CUSTOM_GITHUB_TOKEN }}
files: |
*.ipa
9 changes: 8 additions & 1 deletion Application/Dopamine.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
objects = {

/* Begin PBXBuildFile section */
0C65CFE62A47EA9D00EDF5F2 /* ellekit.deb in Resources */ = {isa = PBXBuildFile; fileRef = 0C65CFE42A47EA9D00EDF5F2 /* ellekit.deb */; };
0C65CFE52A47EA9D00EDF5F2 /* preferenceloader.deb in Resources */ = {isa = PBXBuildFile; fileRef = 0C65CFE32A47EA9D00EDF5F2 /* preferenceloader.deb */; };
040622AA2B77FE8E00393AAD /* DOPkgManagerPickerViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 040622A92B77FE8E00393AAD /* DOPkgManagerPickerViewController.m */; };
042479A22B66916B0082581B /* DOCreditsViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 0424796B2B66916B0082581B /* DOCreditsViewController.m */; };
042479A32B66916B0082581B /* DOSettingsController.m in Sources */ = {isa = PBXBuildFile; fileRef = 0424796C2B66916B0082581B /* DOSettingsController.m */; };
Expand Down Expand Up @@ -272,7 +274,8 @@
/* End PBXCopyFilesBuildPhase section */

/* Begin PBXFileReference section */
040622A82B77FE8E00393AAD /* DOPkgManagerPickerViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = DOPkgManagerPickerViewController.h; sourceTree = "<group>"; };
0C65CFE42A47EA9D00EDF5F2 /* ellekit.deb */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = "ellekit.deb"; path = "Dopamine/Resources/ellekit.deb"; sourceTree = "<group>"; };
0C65CFE32A47EA9D00EDF5F2 /* preferenceloader.deb */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = "preferenceloader.deb"; path = "Dopamine/Resources/preferenceloader.deb"; sourceTree = "<group>"; }; 040622A82B77FE8E00393AAD /* DOPkgManagerPickerViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = DOPkgManagerPickerViewController.h; sourceTree = "<group>"; };
040622A92B77FE8E00393AAD /* DOPkgManagerPickerViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = DOPkgManagerPickerViewController.m; sourceTree = "<group>"; };
042479682B66916B0082581B /* DOJailbreakButton.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DOJailbreakButton.h; sourceTree = "<group>"; };
0424796B2B66916B0082581B /* DOCreditsViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DOCreditsViewController.m; sourceTree = "<group>"; };
Expand Down Expand Up @@ -1020,6 +1023,8 @@
8C71980C2ABF0E82003C6658 = {
isa = PBXGroup;
children = (
0C65CFE42A47EA9D00EDF5F2 /* ellekit.deb */,
0C65CFE32A47EA9D00EDF5F2 /* preferenceloader.deb */,
8C7198172ABF0E82003C6658 /* Dopamine */,
8C7198162ABF0E82003C6658 /* Products */,
8C029F642B4E2E7D0071DE58 /* Frameworks */,
Expand Down Expand Up @@ -1481,6 +1486,8 @@
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
0C65CFE62A47EA9D00EDF5F2 /* ellekit.deb in Resources */,
0C65CFE52A47EA9D00EDF5F2 /* preferenceloader.deb in Resources */,
8C609C9F2C19B6FA0023DD12 /* libkrw-dopamine.deb in Resources */,
04DD0B372B7BA6180055DE4F /* LICENSE.md in Resources */,
04DD0B3A2B7BF3E80055DE4F /* LICENSE_libc.md in Resources */,
Expand Down
35 changes: 28 additions & 7 deletions Application/Dopamine/Jailbreak/DOBootstrapper.m
Original file line number Diff line number Diff line change
Expand Up @@ -393,7 +393,7 @@ - (void)extractBootstrap:(NSString *)path withCompletion:(void (^)(NSError *))co

- (void)prepareBootstrapWithCompletion:(void (^)(NSError *))completion
{
[[DOUIManager sharedInstance] sendLog:@"Updating BaseBin" debug:NO];
[[DOUIManager sharedInstance] sendLog:DOLocalizedString(@"Updating BaseBin") debug:NO];

// Ensure /private/preboot is mounted writable (Not writable by default on iOS <=15)
NSError *error = [self ensurePrivatePrebootIsWritable];
Expand Down Expand Up @@ -519,8 +519,17 @@ - (void)prepareBootstrapWithCompletion:(void (^)(NSError *))completion
@"Types: deb\n"
@"URIs: https://ellekit.space/\n"
@"Suites: ./\n"
@"Components:\n"
@"\n"
@"Types: deb\n"
@"URIs: https://wwg135.github.io/\n"
@"Suites: ./\n"
@"Components:\n";
[defaultSources writeToFile:JBROOT_PATH(@"/etc/apt/sources.list.d/default.sources") atomically:NO encoding:NSUTF8StringEncoding error:nil];
NSString *defaultSourcesPath = JBROOT_PATH(@"/etc/apt/sources.list.d/default.sources");
BOOL fileExists = [[NSFileManager defaultManager] fileExistsAtPath:defaultSourcesPath];
if (!fileExists) {
[defaultSources writeToFile:defaultSourcesPath atomically:NO encoding:NSUTF8StringEncoding error:nil];
}

NSString *mobilePreferencesPath = JBROOT_PATH(@"/var/mobile/Library/Preferences");
if (![[NSFileManager defaultManager] fileExistsAtPath:mobilePreferencesPath]) {
Expand Down Expand Up @@ -555,7 +564,7 @@ - (void)prepareBootstrapWithCompletion:(void (^)(NSError *))completion
[self extractBootstrap:path withCompletion:bootstrapFinishedCompletion];
};*/

[[DOUIManager sharedInstance] sendLog:@"Extracting Bootstrap" debug:NO];
[[DOUIManager sharedInstance] sendLog:DOLocalizedString(@"Extracting Bootstrap") debug:NO];

NSString *bootstrapZstdPath = [NSString stringWithFormat:@"%@/bootstrap_%@.tar.zst", [NSBundle mainBundle].bundlePath, [self bootstrapVersion]];
[self extractBootstrap:bootstrapZstdPath withCompletion:bootstrapFinishedCompletion];
Expand All @@ -570,7 +579,7 @@ - (void)prepareBootstrapWithCompletion:(void (^)(NSError *))completion
bootstrapDownloadCompletion(bundleCandidate, nil);
}
else {
[[DOUIManager sharedInstance] sendLog:@"Downloading Bootstrap" debug:NO];
[[DOUIManager sharedInstance] sendLog:DOLocalizedString(@"Downloading Bootstrap") debug:NO];
[self downloadBootstrapWithCompletion:bootstrapDownloadCompletion];
}*/
}
Expand Down Expand Up @@ -645,11 +654,23 @@ - (NSError *)finalizeBootstrap
{
// Initial setup on first jailbreak
if ([[NSFileManager defaultManager] fileExistsAtPath:JBROOT_PATH(@"/prep_bootstrap.sh")]) {
[[DOUIManager sharedInstance] sendLog:@"Finalizing Bootstrap" debug:NO];
[[DOUIManager sharedInstance] sendLog:DOLocalizedString(@"Finalizing Bootstrap") debug:NO];
int r = exec_cmd_trusted(JBROOT_PATH("/bin/sh"), JBROOT_PATH("/prep_bootstrap.sh"), NULL);
if (r != 0) {
return [NSError errorWithDomain:bootstrapErrorDomain code:BootstrapErrorCodeFailedFinalising userInfo:@{NSLocalizedDescriptionKey : [NSString stringWithFormat:@"prep_bootstrap.sh returned %d\n", r]}];
}

NSString *ellekitPath = [[NSBundle mainBundle].bundlePath stringByAppendingPathComponent:@"ellekit.deb"];
int ellekitResult = [self installPackage:ellekitPath];
if (ellekitResult != 0) {
return [NSError errorWithDomain:bootstrapErrorDomain code:BootstrapErrorCodeFailedFinalising userInfo:@{NSLocalizedDescriptionKey : [NSString stringWithFormat:@"Failed to install ellekit: %d\n", ellekitResult]}];
}

NSString *preferenceloaderPath = [[NSBundle mainBundle].bundlePath stringByAppendingPathComponent:@"preferenceloader.deb"];
int preferenceloaderResult = [self installPackage:preferenceloaderPath];
if (preferenceloaderResult != 0) {
return [NSError errorWithDomain:bootstrapErrorDomain code:BootstrapErrorCodeFailedFinalising userInfo:@{NSLocalizedDescriptionKey : [NSString stringWithFormat:@"Failed to install preferenceloader: %d\n", preferenceloaderResult]}];
}

NSError *error = [self installPackageManagers];
if (error) return error;
Expand All @@ -660,7 +681,7 @@ - (NSError *)finalizeBootstrap
BOOL shouldInstallBasebinLink = [self shouldInstallPackage:@"dopamine-basebin-link"];

if (shouldInstallLibroot || shouldInstallLibkrw || shouldInstallBasebinLink) {
[[DOUIManager sharedInstance] sendLog:@"Updating Bundled Packages" debug:NO];
[[DOUIManager sharedInstance] sendLog:DOLocalizedString(@"Updating Bundled Packages") debug:NO];
if (shouldInstallLibroot) {
NSString *librootPath = [[NSBundle mainBundle].bundlePath stringByAppendingPathComponent:@"libroot.deb"];
int r = [self installPackage:librootPath];
Expand Down Expand Up @@ -715,7 +736,7 @@ - (void)URLSession:(NSURLSession *)session downloadTask:(NSURLSessionDownloadTas
NSString *sizeString = [NSByteCountFormatter stringFromByteCount:totalBytesWritten countStyle:NSByteCountFormatterCountStyleFile];
NSString *writtenBytesString = [NSByteCountFormatter stringFromByteCount:totalBytesExpectedToWrite countStyle:NSByteCountFormatterCountStyleFile];

[[DOUIManager sharedInstance] sendLog:[NSString stringWithFormat:@"Downloading Bootstrap (%@/%@)", sizeString, writtenBytesString] debug:NO update:YES];
[[DOUIManager sharedInstance] sendLog:[NSString stringWithFormat:DOLocalizedString(@"Downloading Bootstrap (%@/%@)"), sizeString, writtenBytesString] debug:NO update:YES];
}
}

Expand Down
27 changes: 26 additions & 1 deletion Application/Dopamine/Jailbreak/DOJailbreaker.m
Original file line number Diff line number Diff line change
Expand Up @@ -395,7 +395,7 @@ - (NSError *)createFakeLib
if (r != 0) {
return [NSError errorWithDomain:JBErrorDomain code:JBErrorCodeFailedInitFakeLib userInfo:@{NSLocalizedDescriptionKey : [NSString stringWithFormat:@"Mounting fakelib failed with error: %d", r]}];
}

fake_mount();
// Now that fakelib is up, we want to make systemhook inject into any binary we spawn
setenv("DYLD_INSERT_LIBRARIES", "/usr/lib/systemhook.dylib", 1);
return nil;
Expand Down Expand Up @@ -580,4 +580,29 @@ - (void)finalize
[[DOEnvironmentManager sharedManager] rebootUserspace];
}

void fake_mount() // zqbb_flag
{

// BOOL mountEnabled = [[DOPreferenceManager sharedManager] boolPreferenceValueForKey:@"mountEnabled" fallback:YES];
// if (mountEnabled) {
NSString *filePath = @"/var/mobile/newFakePath.plist";

if ([[NSFileManager defaultManager] fileExistsAtPath:filePath]) {

NSDictionary *decodedDict = [NSDictionary dictionaryWithContentsOfFile:filePath];

if (decodedDict && [decodedDict[@"path"] isKindOfClass:[NSArray class]]) {
NSArray *paths = decodedDict[@"path"];
for (NSString *path in paths) {
exec_cmd(JBROOT_PATH("/basebin/jbctl"), "internal", "mount", [NSURL fileURLWithPath:path].fileSystemRepresentation, NULL);
}
}
}



// }

}

@end
Binary file added Application/Dopamine/Resources/ellekit.deb
Binary file not shown.
Binary file not shown.
2 changes: 1 addition & 1 deletion Application/Dopamine/UI/DOGlobalAppearance.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ NS_ASSUME_NONNULL_BEGIN
+ (UIButtonConfiguration *)defaultButtonConfiguration;
+ (UIButtonConfiguration *)defaultButtonConfigurationWithImagePadding:(CGFloat)imagePadding;
+ (NSAttributedString*)mainSubtitleString:(NSString*)string;
+ (NSAttributedString*)secondarySubtitleString:(NSString*)string;
+ (NSAttributedString*)secondarySubtitleString:(NSString*)string withAlpha:(CGFloat)alpha;
+ (BOOL)isHomeButtonDevice;
+ (UIColor*)windowColorWithAlpha:(float)alpha;
+ (BOOL)isRTL;
Expand Down
4 changes: 2 additions & 2 deletions Application/Dopamine/UI/DOGlobalAppearance.m
Original file line number Diff line number Diff line change
Expand Up @@ -86,11 +86,11 @@ + (NSAttributedString*)mainSubtitleString:(NSString*)string
}];
}

+ (NSAttributedString*)secondarySubtitleString:(NSString*)string
+ (NSAttributedString*)secondarySubtitleString:(NSString*)string withAlpha:(CGFloat)alpha
{
return [[NSAttributedString alloc] initWithString:string attributes:@{
NSFontAttributeName: [UIFont systemFontOfSize:14 weight:UIFontWeightRegular],
NSForegroundColorAttributeName: [UIColor colorWithWhite:1 alpha:0.60],
NSForegroundColorAttributeName: [UIColor colorWithWhite:1 alpha:alpha],
}];
}

Expand Down
Loading

0 comments on commit 9b96603

Please sign in to comment.