Skip to content

Commit 19d9923

Browse files
committed
Merge branch 'release/1.2.4'
2 parents c163245 + 3b64db2 commit 19d9923

File tree

9 files changed

+185
-128
lines changed

9 files changed

+185
-128
lines changed

.github/workflows/build.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
name: Build
22
on:
3-
[push]
3+
push:
4+
pull_request_target:
5+
types: [labeled]
46
jobs:
57
build:
68
name: Build and Test
@@ -26,7 +28,7 @@ jobs:
2628
name: artifacts
2729
path: target/*.jar
2830
- name: Create Release
29-
uses: softprops/action-gh-release@v1
31+
uses: softprops/action-gh-release@v2
3032
if: startsWith(github.ref, 'refs/tags/')
3133
with:
3234
prerelease: true

.github/workflows/dependency-check.yml

Lines changed: 8 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -10,54 +10,11 @@ on:
1010

1111
jobs:
1212
check-dependencies:
13-
name: Check dependencies
14-
runs-on: macos-latest
15-
steps:
16-
- uses: actions/checkout@v4
17-
with:
18-
show-progress: false
19-
- name: Setup Java
20-
uses: actions/setup-java@v4
21-
with:
22-
distribution: 'temurin'
23-
java-version: 17
24-
cache: 'maven'
25-
- name: Cache NVD DB
26-
uses: actions/cache@v4
27-
with:
28-
path: ~/.m2/repository/org/owasp/dependency-check-data/
29-
key: dependency-check-${{ github.run_id }}
30-
restore-keys: |
31-
dependency-check
32-
env:
33-
SEGMENT_DOWNLOAD_TIMEOUT_MINS: 5
34-
- name: Run org.owasp:dependency-check plugin
35-
id: dependency-check
36-
continue-on-error: true
37-
run: mvn -B validate -Pdependency-check
38-
env:
39-
NVD_API_KEY: ${{ secrets.NVD_API_KEY }}
40-
- name: Upload report on failure
41-
if: steps.dependency-check.outcome == 'failure'
42-
uses: actions/upload-artifact@v4
43-
with:
44-
name: dependency-check-report
45-
path: target/dependency-check-report.html
46-
if-no-files-found: error
47-
- name: Slack Notification on regular check
48-
if: github.event_name == 'schedule' && steps.dependency-check.outcome == 'failure'
49-
uses: rtCamp/action-slack-notify@v2
50-
env:
51-
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_URL }}
52-
SLACK_USERNAME: 'Cryptobot'
53-
SLACK_ICON: false
54-
SLACK_ICON_EMOJI: ':bot:'
55-
SLACK_CHANNEL: 'cryptomator-desktop'
56-
SLACK_TITLE: "Vulnerabilities in ${{ github.event.repository.name }} detected."
57-
SLACK_MESSAGE: "Download the <https://github.com/${{ github.repository }}/actions/run/${{ github.run_id }}|report> for more details."
58-
SLACK_FOOTER: false
59-
MSG_MINIMAL: true
60-
- name: Failing workflow on release branch
61-
if: github.event_name == 'push' && steps.dependency-check.outcome == 'failure'
62-
shell: bash
63-
run: exit 1
13+
uses: skymatic/workflows/.github/workflows/run-dependency-check.yml@v1
14+
with:
15+
runner-os: 'macos-latest'
16+
java-distribution: 'temurin'
17+
java-version: 21
18+
secrets:
19+
nvd-api-key: ${{ secrets.NVD_API_KEY }}
20+
slack-webhook-url: ${{ secrets.SLACK_WEBHOOK_URL }}

pom.xml

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<modelVersion>4.0.0</modelVersion>
66
<groupId>org.cryptomator</groupId>
77
<artifactId>integrations-mac</artifactId>
8-
<version>1.2.3</version>
8+
<version>1.2.4</version>
99

1010
<name>Cryptomator Integrations for macOS</name>
1111
<description>Provides optional macOS services used by Cryptomator</description>
@@ -30,16 +30,16 @@
3030
<project.jdk.version>17</project.jdk.version>
3131

3232
<!-- runtime dependencies -->
33-
<api.version>1.3.0</api.version>
34-
<slf4j.version>2.0.11</slf4j.version>
33+
<api.version>1.3.1</api.version>
34+
<slf4j.version>2.0.13</slf4j.version>
3535

3636
<!-- test dependencies -->
37-
<junit.jupiter.version>5.10.1</junit.jupiter.version>
38-
<mockito.version>5.10.0</mockito.version>
37+
<junit.jupiter.version>5.10.2</junit.jupiter.version>
38+
<mockito.version>5.12.0</mockito.version>
3939

4040
<!-- build plugin dependencies -->
41-
<dependency-check.version>9.0.9</dependency-check.version>
42-
<nexus-staging.version>1.6.13</nexus-staging.version>
41+
<dependency-check.version>9.2.0</dependency-check.version>
42+
<nexus-staging.version>1.6.14</nexus-staging.version>
4343
</properties>
4444

4545
<licenses>
@@ -104,7 +104,7 @@
104104
<plugin>
105105
<groupId>org.apache.maven.plugins</groupId>
106106
<artifactId>maven-compiler-plugin</artifactId>
107-
<version>3.12.1</version>
107+
<version>3.13.0</version>
108108
<configuration>
109109
<compilerArgs>
110110
<arg>-h</arg>
@@ -116,7 +116,7 @@
116116
<plugin>
117117
<groupId>org.apache.maven.plugins</groupId>
118118
<artifactId>maven-enforcer-plugin</artifactId>
119-
<version>3.4.1</version>
119+
<version>3.5.0</version>
120120
<executions>
121121
<execution>
122122
<id>check-preconditions</id>
@@ -145,7 +145,7 @@
145145
<plugin>
146146
<groupId>org.codehaus.mojo</groupId>
147147
<artifactId>exec-maven-plugin</artifactId>
148-
<version>3.1.1</version>
148+
<version>3.3.0</version>
149149
<executions>
150150
<execution>
151151
<goals>
@@ -203,7 +203,7 @@
203203
</plugin>
204204
<plugin>
205205
<artifactId>maven-source-plugin</artifactId>
206-
<version>3.3.0</version>
206+
<version>3.3.1</version>
207207
<executions>
208208
<execution>
209209
<id>attach-sources</id>
@@ -215,7 +215,7 @@
215215
</plugin>
216216
<plugin>
217217
<artifactId>maven-javadoc-plugin</artifactId>
218-
<version>3.6.3</version>
218+
<version>3.7.0</version>
219219
<executions>
220220
<execution>
221221
<id>attach-javadocs</id>
@@ -307,7 +307,7 @@
307307
<plugins>
308308
<plugin>
309309
<artifactId>maven-gpg-plugin</artifactId>
310-
<version>3.1.0</version>
310+
<version>3.2.4</version>
311311
<executions>
312312
<execution>
313313
<id>sign-artifacts</id>
@@ -368,7 +368,7 @@
368368
<plugin>
369369
<groupId>org.apache.maven.plugins</groupId>
370370
<artifactId>maven-deploy-plugin</artifactId>
371-
<version>3.1.1</version>
371+
<version>3.1.2</version>
372372
</plugin>
373373
</plugins>
374374
</build>

src/main/native/Integrations.xcodeproj/project.pbxproj

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
objects = {
88

99
/* Begin PBXBuildFile section */
10+
74BEF1852C0384FB006731AC /* SKYLaunchService.m in Sources */ = {isa = PBXBuildFile; fileRef = 74BEF1842C0384FB006731AC /* SKYLaunchService.m */; };
11+
74BEF1862C0384FB006731AC /* SKYLaunchService.h in Headers */ = {isa = PBXBuildFile; fileRef = 74BEF1832C0384FB006731AC /* SKYLaunchService.h */; };
1012
74CF2E7B254C295A006266D6 /* org_cryptomator_macos_autostart_MacLaunchServices_Native.m in Sources */ = {isa = PBXBuildFile; fileRef = 74CF2E7A254C295A006266D6 /* org_cryptomator_macos_autostart_MacLaunchServices_Native.m */; };
1113
9E0819C91D75CABC000C89E6 /* org_cryptomator_macos_keychain_MacKeychain_Native.m in Sources */ = {isa = PBXBuildFile; fileRef = 9E0819C71D75CABC000C89E6 /* org_cryptomator_macos_keychain_MacKeychain_Native.m */; };
1214
9E21340025542735006EA872 /* org_cryptomator_macos_uiappearance_AppAppearance_Native.m in Sources */ = {isa = PBXBuildFile; fileRef = 9E2133FF25542735006EA872 /* org_cryptomator_macos_uiappearance_AppAppearance_Native.m */; };
@@ -19,6 +21,8 @@
1921
/* End PBXBuildFile section */
2022

2123
/* Begin PBXFileReference section */
24+
74BEF1832C0384FB006731AC /* SKYLaunchService.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SKYLaunchService.h; sourceTree = "<group>"; };
25+
74BEF1842C0384FB006731AC /* SKYLaunchService.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SKYLaunchService.m; sourceTree = "<group>"; };
2226
74CF2E7A254C295A006266D6 /* org_cryptomator_macos_autostart_MacLaunchServices_Native.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = org_cryptomator_macos_autostart_MacLaunchServices_Native.m; sourceTree = "<group>"; };
2327
9E0819B71D748ECC000C89E6 /* libIntegrations.dylib */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.dylib"; includeInIndex = 0; path = libIntegrations.dylib; sourceTree = BUILT_PRODUCTS_DIR; };
2428
9E0819C71D75CABC000C89E6 /* org_cryptomator_macos_keychain_MacKeychain_Native.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = org_cryptomator_macos_keychain_MacKeychain_Native.m; sourceTree = "<group>"; };
@@ -54,6 +58,8 @@
5458
9E21341025542ECE006EA872 /* SKYAppearanceNotifier.m */,
5559
9E213409255429CA006EA872 /* SKYAppearanceObserver.h */,
5660
9E21340A255429CA006EA872 /* SKYAppearanceObserver.m */,
61+
74BEF1832C0384FB006731AC /* SKYLaunchService.h */,
62+
74BEF1842C0384FB006731AC /* SKYLaunchService.m */,
5763
9E0819B81D748ECC000C89E6 /* Products */,
5864
);
5965
sourceTree = "<group>";
@@ -74,6 +80,7 @@
7480
buildActionMask = 2147483647;
7581
files = (
7682
9E21341125542ECE006EA872 /* SKYAppearanceNotifier.h in Headers */,
83+
74BEF1862C0384FB006731AC /* SKYLaunchService.h in Headers */,
7784
9E21340B255429CA006EA872 /* SKYAppearanceObserver.h in Headers */,
7885
);
7986
runOnlyForDeploymentPostprocessing = 0;
@@ -135,6 +142,7 @@
135142
isa = PBXSourcesBuildPhase;
136143
buildActionMask = 2147483647;
137144
files = (
145+
74BEF1852C0384FB006731AC /* SKYLaunchService.m in Sources */,
138146
9EACB1B425557865000F3214 /* org_cryptomator_macos_tray_ActivationPolicy_Native.m in Sources */,
139147
74CF2E7B254C295A006266D6 /* org_cryptomator_macos_autostart_MacLaunchServices_Native.m in Sources */,
140148
9E21340C255429CA006EA872 /* SKYAppearanceObserver.m in Sources */,

src/main/native/SKYLaunchService.h

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
//
2+
// SKYLaunchService.h
3+
// Integrations
4+
//
5+
// Created by Tobias Hagemann on 26.05.24.
6+
// Copyright © 2024 Cryptomator. All rights reserved.
7+
//
8+
9+
#import <Foundation/Foundation.h>
10+
11+
@interface SKYLaunchService : NSObject
12+
13+
+ (BOOL)isLoginItemEnabled;
14+
+ (BOOL)enableLoginItem;
15+
+ (BOOL)disableLoginItem;
16+
17+
@end

src/main/native/SKYLaunchService.m

Lines changed: 128 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,128 @@
1+
//
2+
// SKYLaunchService.m
3+
// Integrations
4+
//
5+
// Created by Tobias Hagemann on 26.05.24.
6+
// Copyright © 2024 Cryptomator. All rights reserved.
7+
//
8+
9+
#import "SKYLaunchService.h"
10+
#import <ServiceManagement/ServiceManagement.h>
11+
12+
@implementation SKYLaunchService
13+
14+
+ (BOOL)isLoginItemEnabled {
15+
if (@available(macOS 13, *)) {
16+
if (SMAppService.mainAppService.status == SMAppServiceStatusEnabled) {
17+
return YES;
18+
} else if ([self isLegacyLoginItemEnabled]) {
19+
// migrate legacy login item
20+
[self disableLegacyLoginItem];
21+
return [self enableLoginItem];
22+
} else {
23+
return NO;
24+
}
25+
} else { // macOS < 13
26+
return [self isLegacyLoginItemEnabled];
27+
}
28+
}
29+
30+
+ (BOOL)enableLoginItem {
31+
if (@available(macOS 13, *)) {
32+
NSError *error;
33+
if ([SMAppService.mainAppService registerAndReturnError:&error]) {
34+
return YES;
35+
} else {
36+
NSLog(@"Failed to register login item: %@", error.localizedDescription);
37+
return NO;
38+
}
39+
} else { // macOS < 13
40+
return [self enableLegacyLoginItem];
41+
}
42+
}
43+
44+
+ (BOOL)disableLoginItem {
45+
if (@available(macOS 13, *)) {
46+
NSError *error;
47+
if ([SMAppService.mainAppService unregisterAndReturnError:&error]) {
48+
return YES;
49+
} else {
50+
NSLog(@"Failed to unregister login item: %@", error.localizedDescription);
51+
return NO;
52+
}
53+
} else { // macOS < 13
54+
return [self disableLegacyLoginItem];
55+
}
56+
}
57+
58+
#pragma mark - Legacy
59+
60+
+ (BOOL)isLegacyLoginItemEnabled {
61+
LSSharedFileListRef sharedFileList = LSSharedFileListCreate(NULL, kLSSharedFileListSessionLoginItems, NULL);
62+
NSString *applicationPath = NSBundle.mainBundle.bundlePath;
63+
if (sharedFileList) {
64+
UInt32 seedValue;
65+
NSArray *sharedFileListArray = CFBridgingRelease(LSSharedFileListCopySnapshot(sharedFileList, &seedValue));
66+
for (id sharedFile in sharedFileListArray) {
67+
LSSharedFileListItemRef sharedFileListItem = (__bridge LSSharedFileListItemRef)sharedFile;
68+
CFURLRef applicationPathURL = NULL;
69+
LSSharedFileListItemResolve(sharedFileListItem, 0, (CFURLRef *)&applicationPathURL, NULL);
70+
if (applicationPathURL != NULL) {
71+
NSString *resolvedApplicationPath = [(__bridge NSURL *)applicationPathURL path];
72+
CFRelease(applicationPathURL);
73+
if ([resolvedApplicationPath compare:applicationPath] == NSOrderedSame) {
74+
CFRelease(sharedFileList);
75+
return YES;
76+
}
77+
}
78+
}
79+
CFRelease(sharedFileList);
80+
} else {
81+
NSLog(@"Unable to create the shared file list.");
82+
}
83+
return NO;
84+
}
85+
86+
+ (BOOL)enableLegacyLoginItem {
87+
LSSharedFileListRef sharedFileList = LSSharedFileListCreate(NULL, kLSSharedFileListSessionLoginItems, NULL);
88+
NSString *applicationPath = NSBundle.mainBundle.bundlePath;
89+
NSURL *applicationPathURL = [NSURL fileURLWithPath:applicationPath];
90+
if (sharedFileList) {
91+
LSSharedFileListItemRef sharedFileListItem = LSSharedFileListInsertItemURL(sharedFileList, kLSSharedFileListItemLast, NULL, NULL, (__bridge CFURLRef)applicationPathURL, NULL, NULL);
92+
if (sharedFileListItem) {
93+
CFRelease(sharedFileListItem);
94+
}
95+
CFRelease(sharedFileList);
96+
return YES;
97+
} else {
98+
NSLog(@"Unable to create the shared file list.");
99+
return NO;
100+
}
101+
}
102+
103+
+ (BOOL)disableLegacyLoginItem {
104+
LSSharedFileListRef sharedFileList = LSSharedFileListCreate(NULL, kLSSharedFileListSessionLoginItems, NULL);
105+
NSString *applicationPath = NSBundle.mainBundle.bundlePath;
106+
if (sharedFileList) {
107+
UInt32 seedValue;
108+
NSArray *sharedFileListArray = CFBridgingRelease(LSSharedFileListCopySnapshot(sharedFileList, &seedValue));
109+
for (id sharedFile in sharedFileListArray) {
110+
LSSharedFileListItemRef sharedFileListItem = (__bridge LSSharedFileListItemRef)sharedFile;
111+
CFURLRef applicationPathURL;
112+
if (LSSharedFileListItemResolve(sharedFileListItem, 0, &applicationPathURL, NULL) == noErr) {
113+
NSString *resolvedApplicationPath = [(__bridge NSURL *)applicationPathURL path];
114+
if ([resolvedApplicationPath compare:applicationPath] == NSOrderedSame) {
115+
LSSharedFileListItemRemove(sharedFileList, sharedFileListItem);
116+
}
117+
CFRelease(applicationPathURL);
118+
}
119+
}
120+
CFRelease(sharedFileList);
121+
return YES;
122+
} else {
123+
NSLog(@"Unable to create the shared file list.");
124+
return NO;
125+
}
126+
}
127+
128+
@end

0 commit comments

Comments
 (0)