This repository has been archived by the owner on Aug 28, 2024. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Alexandra
authored and
Alexandra
committed
Dec 8, 2022
0 parents
commit bba0f7f
Showing
60 changed files
with
3,149 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
ko_fi: traurige |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
--- | ||
name: Bug report | ||
about: Report a bug to help improve Kayoko | ||
title: '' | ||
labels: bug | ||
assignees: Traurige | ||
|
||
--- | ||
|
||
**Describe the bug:** | ||
|
||
**Steps to reproduce the behavior:** | ||
|
||
**System information:** | ||
- iOS version: | ||
- Jailbreak: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
--- | ||
name: Feature request | ||
about: Suggest a feature that can help make Kayoko even better | ||
title: '' | ||
labels: enhancement | ||
assignees: Traurige | ||
|
||
--- | ||
|
||
**Describe the requested feature:** | ||
|
||
**System information:** | ||
- iOS version: | ||
- Jailbreak: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
.DS_Store | ||
.theos | ||
packages/ | ||
.vscode |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#import <Foundation/Foundation.h> | ||
#import <notify.h> | ||
|
||
@interface KayokoDaemon : NSObject { | ||
int _token; | ||
} | ||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
#import "KayokoDaemon.h" | ||
|
||
@implementation KayokoDaemon | ||
- (instancetype)init { | ||
self = [super init]; | ||
|
||
if (self) { | ||
notify_register_dispatch("com.apple.pasteboard.notify.changed", &(_token), dispatch_get_main_queue(), ^(int _) { | ||
CFNotificationCenterPostNotification(CFNotificationCenterGetDarwinNotifyCenter(), (CFStringRef)@"dev.traurige.kayoko.daemon.pasteboard.changed", nil, nil, YES); | ||
}); | ||
} | ||
|
||
return self; | ||
} | ||
|
||
- (void)dealloc { | ||
notify_cancel(_token); | ||
[super dealloc]; | ||
} | ||
@end | ||
|
||
int main(int argc, char** argv, char** envp) { | ||
[[KayokoDaemon alloc] init]; | ||
[[NSRunLoop currentRunLoop] run]; | ||
|
||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
TOOL_NAME = kayokod | ||
kayokod_FILES = KayokoDaemon.m | ||
kayokod_INSTALL_PATH = /usr/libexec | ||
kayokod_CODESIGN_FLAGS = -Sentitlements.plist | ||
|
||
include $(THEOS)/makefiles/common.mk | ||
include $(THEOS_MAKE_PATH)/tool.mk |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | ||
<plist version="1.0"> | ||
<dict> | ||
<key>com.apple.springboard.launchapplications</key> | ||
<true/> | ||
</dict> | ||
</plist> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
export ARCHS = arm64 arm64e | ||
export TARGET = iphone:clang:14.4:13.0 | ||
export SYSROOT = $(THEOS)/sdks/iPhoneOS14.4.sdk | ||
export PREFIX = $(THEOS)/toolchain/Xcode.xctoolchain/usr/bin/ | ||
|
||
INSTALL_TARGET_PROCESSES = SpringBoard | ||
SUBPROJECTS = Tweak/Core Tweak/Helper Daemon Preferences | ||
|
||
include $(THEOS)/makefiles/common.mk | ||
include $(THEOS_MAKE_PATH)/aggregate.mk |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#import <UIKit/UIKit.h> | ||
|
||
@interface PasteboardItem : NSObject | ||
@property(atomic, assign)NSString* bundleIdentifier; | ||
@property(atomic, assign)NSString* displayName; | ||
@property(atomic, assign)NSString* content; | ||
@property(atomic, assign)NSString* imageName; | ||
@property(atomic, assign)BOOL hasPlainText; | ||
@property(atomic, assign)BOOL hasLink; | ||
@property(atomic, assign)BOOL hasMusicLink; | ||
@property(atomic, assign)BOOL hasColor; | ||
@property(atomic, assign)BOOL hasImage; | ||
- (instancetype)initWithBundleIdentifier:(NSString *)bundleIdentifier andContent:(NSString *)content withImageNamed:(NSString *)imageName; | ||
+ (PasteboardItem *)itemFromDictionary:(NSDictionary *)dictionary; | ||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
#import "PasteboardItem.h" | ||
|
||
@implementation PasteboardItem | ||
- (instancetype)initWithBundleIdentifier:(NSString *)bundleIdentifier andContent:(NSString *)content withImageNamed:(NSString *)imageName { | ||
self = [super init]; | ||
|
||
if (self) { | ||
[self setBundleIdentifier:bundleIdentifier]; | ||
[self setContent:content]; | ||
[self setImageName:imageName]; | ||
[self setHasLink:[content hasPrefix:@"http://"] || [content hasPrefix:@"https://"]]; | ||
[self setHasMusicLink:[self contentHasMusicLink:content]]; | ||
[self setHasColor:![self hasLink] && ![self hasMusicLink] && [self contentHasColor:content]]; | ||
[self setHasImage:imageName && ![imageName isEqualToString:@""]]; | ||
[self setHasPlainText:![self hasLink] && ![self hasMusicLink] && ![self hasColor] && ![self hasImage]]; | ||
} | ||
|
||
return self; | ||
} | ||
|
||
+ (PasteboardItem *)itemFromDictionary:(NSDictionary *)dictionary { | ||
return [[PasteboardItem alloc] initWithBundleIdentifier:dictionary[@"bundleIdentifier"] andContent:dictionary[@"content"] withImageNamed:dictionary[@"imageName"]]; | ||
} | ||
|
||
- (BOOL)contentHasMusicLink:(NSString *)content { | ||
NSArray* linkPrefixes = @[ | ||
@"https://music.apple.com/", | ||
@"https://open.spotify.com/", | ||
@"https://music.youtube.com/", | ||
@"https://soundcloud.com/", | ||
@"https://music.amazon.com/", | ||
@"https://www.pandora.com/", | ||
@"https://www.deezer.com/", | ||
@"https://napster.com/", | ||
@"https://listen.tidal.com/", | ||
@"https://music.yandex.ru/" | ||
]; | ||
|
||
for (NSString* prefix in linkPrefixes) { | ||
if ([content hasPrefix:prefix]) { | ||
return YES; | ||
} | ||
} | ||
|
||
return NO; | ||
} | ||
|
||
- (BOOL)contentHasColor:(NSString *)content { | ||
NSString* hexRegex = @"^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$"; | ||
NSString* rgbRegex = @"^rgb\\(\\s*([0-9]{1,3})\\s*,\\s*([0-9]{1,3})\\s*,\\s*([0-9]{1,3})\\s*\\)$"; | ||
NSString* rgbaRegex = @"^rgba\\(\\s*([0-9]{1,3})\\s*,\\s*([0-9]{1,3})\\s*,\\s*([0-9]{1,3})\\s*,\\s*([0-9]{1,3}|[0-9]{1,3}\\.[0-9]{1,3})\\s*\\)$"; | ||
NSArray* regexes = @[hexRegex, rgbRegex, rgbaRegex]; | ||
|
||
for (NSString* regex in regexes) { | ||
NSRegularExpression* expression = [NSRegularExpression regularExpressionWithPattern:regex options:0 error:nil]; | ||
if ([expression firstMatchInString:content options:0 range:NSMakeRange(0, [content length])]) { | ||
return YES; | ||
} | ||
} | ||
|
||
return NO; | ||
} | ||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
// | ||
// PasteboardManager.h | ||
// Kayoko | ||
// | ||
// Created by Alexandra (@Traurige) | ||
// | ||
|
||
#import <UIKit/UIKit.h> | ||
#import "PasteboardItem.h" | ||
#import "../Utils/CommonUtil.h" | ||
#import "../Utils/ImageUtil.h" | ||
#import "../Preferences/PreferenceKeys.h" | ||
|
||
static NSString* const kHistoryPath = @"/var/mobile/Documents/dev.traurige/Kayoko/history.json"; | ||
static NSString* const kHistoryImagesPath = @"/var/mobile/Documents/dev.traurige/Kayoko/images/"; | ||
static NSString* const kHistoryKeyHistory = @"history"; | ||
static NSString* const kHistoryKeyFavorites = @"favorites"; | ||
|
||
@interface PasteboardManager : NSObject { | ||
UIPasteboard* _pasteboard; | ||
NSUInteger _lastChangeCount; | ||
NSFileManager* _fileManager; | ||
} | ||
@property(atomic, assign)NSUInteger maximumHistoryAmount; | ||
@property(atomic, assign)BOOL saveText; | ||
@property(atomic, assign)BOOL saveImages; | ||
@property(atomic, assign)BOOL automaticallyPaste; | ||
+ (instancetype)sharedInstance; | ||
- (void)pullPasteboardChanges; | ||
- (void)addPasteboardItem:(PasteboardItem *)item toHistoryWithKey:(NSString *)historyKey; | ||
- (void)addSongDotLinkItemFromItem:(PasteboardItem *)item; | ||
- (void)addTranslateItemFromItem:(PasteboardItem *)item; | ||
- (void)updatePasteboardWithItem:(PasteboardItem *)item fromHistoryWithKey:(NSString *)historyKey shouldAutoPaste:(BOOL)shouldAutoPaste; | ||
- (void)removePasteboardItem:(PasteboardItem *)item fromHistoryWithKey:(NSString *)historyKey shouldRemoveImage:(BOOL)shouldRemoveImage; | ||
- (NSMutableArray *)itemsFromHistoryWithKey:(NSString *)historyKey; | ||
@end | ||
|
||
@interface SBApplication : NSObject | ||
@property(nonatomic, readonly)NSString* bundleIdentifier; | ||
@end | ||
|
||
@interface UIApplication (Private) | ||
- (SBApplication *)_accessibilityFrontMostApplication; | ||
@end |
Oops, something went wrong.