Skip to content

Commit ce36527

Browse files
committed
1.6
1 parent 30b27ce commit ce36527

File tree

9 files changed

+186
-9
lines changed

9 files changed

+186
-9
lines changed

.gitignore

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
*.dmg
2+
*.delta
3+
*.bkp
4+
Releases/*.html
5+
required.swift
6+
Releases/old_updates/
7+
*.tmp

IsThereNet.xcodeproj/project.pbxproj

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
C781D4432B4592590050D04A /* Preview Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = C781D4422B4592590050D04A /* Preview Assets.xcassets */; };
1313
C781D44D2B4815510050D04A /* fping in Resources */ = {isa = PBXBuildFile; fileRef = C781D44C2B4815510050D04A /* fping */; };
1414
C7AD8E8F2C36A6E5008E4182 /* ColorCode in Frameworks */ = {isa = PBXBuildFile; productRef = C7AD8E8E2C36A6E5008E4182 /* ColorCode */; };
15+
C7ED2D842C49AA55006D058F /* Sparkle in Frameworks */ = {isa = PBXBuildFile; productRef = C7ED2D832C49AA55006D058F /* Sparkle */; };
1516
/* End PBXBuildFile section */
1617

1718
/* Begin PBXFileReference section */
@@ -30,6 +31,7 @@
3031
buildActionMask = 2147483647;
3132
files = (
3233
C7AD8E8F2C36A6E5008E4182 /* ColorCode in Frameworks */,
34+
C7ED2D842C49AA55006D058F /* Sparkle in Frameworks */,
3335
);
3436
runOnlyForDeploymentPostprocessing = 0;
3537
};
@@ -92,6 +94,7 @@
9294
name = IsThereNet;
9395
packageProductDependencies = (
9496
C7AD8E8E2C36A6E5008E4182 /* ColorCode */,
97+
C7ED2D832C49AA55006D058F /* Sparkle */,
9598
);
9699
productName = IsThereNet;
97100
productReference = C781D4382B4592580050D04A /* IsThereNet.app */;
@@ -123,6 +126,7 @@
123126
mainGroup = C781D42F2B4592570050D04A;
124127
packageReferences = (
125128
C7AD8E8D2C36A6E5008E4182 /* XCRemoteSwiftPackageReference "WFColorCode" */,
129+
C7ED2D822C49AA55006D058F /* XCRemoteSwiftPackageReference "Sparkle" */,
126130
);
127131
productRefGroup = C781D4392B4592580050D04A /* Products */;
128132
projectDirPath = "";
@@ -308,7 +312,7 @@
308312
CODE_SIGN_ENTITLEMENTS = IsThereNet/IsThereNet.entitlements;
309313
CODE_SIGN_STYLE = Automatic;
310314
COMBINE_HIDPI_IMAGES = YES;
311-
CURRENT_PROJECT_VERSION = 10;
315+
CURRENT_PROJECT_VERSION = 1.6;
312316
DEAD_CODE_STRIPPING = YES;
313317
DEVELOPMENT_ASSET_PATHS = "\"IsThereNet/Preview Content\"";
314318
DEVELOPMENT_TEAM = RDDXV84A73;
@@ -326,7 +330,7 @@
326330
"@executable_path/../Frameworks",
327331
);
328332
MACOSX_DEPLOYMENT_TARGET = 11.0;
329-
MARKETING_VERSION = 1.5;
333+
MARKETING_VERSION = 1.6;
330334
PRODUCT_BUNDLE_IDENTIFIER = com.lowtechguys.IsThereNet;
331335
PRODUCT_NAME = "$(TARGET_NAME)";
332336
SWIFT_EMIT_LOC_STRINGS = YES;
@@ -342,7 +346,7 @@
342346
CODE_SIGN_ENTITLEMENTS = IsThereNet/IsThereNet.entitlements;
343347
CODE_SIGN_STYLE = Automatic;
344348
COMBINE_HIDPI_IMAGES = YES;
345-
CURRENT_PROJECT_VERSION = 10;
349+
CURRENT_PROJECT_VERSION = 1.6;
346350
DEAD_CODE_STRIPPING = YES;
347351
DEVELOPMENT_ASSET_PATHS = "\"IsThereNet/Preview Content\"";
348352
DEVELOPMENT_TEAM = RDDXV84A73;
@@ -360,7 +364,7 @@
360364
"@executable_path/../Frameworks",
361365
);
362366
MACOSX_DEPLOYMENT_TARGET = 11.0;
363-
MARKETING_VERSION = 1.5;
367+
MARKETING_VERSION = 1.6;
364368
PRODUCT_BUNDLE_IDENTIFIER = com.lowtechguys.IsThereNet;
365369
PRODUCT_NAME = "$(TARGET_NAME)";
366370
SWIFT_EMIT_LOC_STRINGS = YES;
@@ -400,6 +404,14 @@
400404
minimumVersion = 2.10.0;
401405
};
402406
};
407+
C7ED2D822C49AA55006D058F /* XCRemoteSwiftPackageReference "Sparkle" */ = {
408+
isa = XCRemoteSwiftPackageReference;
409+
repositoryURL = "https://github.com/sparkle-project/Sparkle";
410+
requirement = {
411+
kind = upToNextMajorVersion;
412+
minimumVersion = 2.6.4;
413+
};
414+
};
403415
/* End XCRemoteSwiftPackageReference section */
404416

405417
/* Begin XCSwiftPackageProductDependency section */
@@ -408,6 +420,11 @@
408420
package = C7AD8E8D2C36A6E5008E4182 /* XCRemoteSwiftPackageReference "WFColorCode" */;
409421
productName = ColorCode;
410422
};
423+
C7ED2D832C49AA55006D058F /* Sparkle */ = {
424+
isa = XCSwiftPackageProductDependency;
425+
package = C7ED2D822C49AA55006D058F /* XCRemoteSwiftPackageReference "Sparkle" */;
426+
productName = Sparkle;
427+
};
411428
/* End XCSwiftPackageProductDependency section */
412429
};
413430
rootObject = C781D4302B4592570050D04A /* Project object */;

IsThereNet.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved

Lines changed: 9 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

IsThereNet/Info.plist

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
33
<plist version="1.0">
4-
<dict/>
4+
<dict>
5+
<key>SUPublicEDKey</key>
6+
<string>lqnO6tg2A9evTIFo2SC9ArZ6NS84gtBshcAWdwh12xQ=</string>
7+
<key>SUFeedURL</key>
8+
<string>https://files.lowtechguys.com/istherenet/appcast.xml</string>
9+
<key>SUEnableAutomaticChecks</key>
10+
<true/>
11+
<key>SUScheduledCheckInterval</key>
12+
<integer>259200</integer>
13+
</dict>
514
</plist>

IsThereNet/IsThereNetApp.swift

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import Network
1515
import os.log
1616
import ServiceManagement
1717
import SwiftUI
18+
import Sparkle
1819

1920
private func mainAsyncAfter(_ duration: TimeInterval, _ action: @escaping () -> Void) -> DispatchWorkItem {
2021
let workItem = DispatchWorkItem { action() }
@@ -171,7 +172,7 @@ private var lastPingStatus: PingStatus? {
171172

172173
if let command = CONFIG.shellCommandOnStatusChange, !command.isEmpty {
173174
let cmd = "STATUS=\(lastPingStatus); \nPING_TIME=\(lastPingStatus.time.intround); \n\(command)"
174-
guard let task = shellProc(args: ["-c", cmd]) else {
175+
guard shellProc(args: ["-c", cmd]) != nil else {
175176
log("Failed to run shell command: \n\(cmd)")
176177
return
177178
}
@@ -378,7 +379,11 @@ private var pingRestartTask: DispatchWorkItem? {
378379

379380
@main
380381
struct IsThereNetApp: App {
381-
init() { start() }
382+
private let updaterController: SPUStandardUpdaterController
383+
init() {
384+
updaterController = SPUStandardUpdaterController(startingUpdater: true, updaterDelegate: nil, userDriverDelegate: nil)
385+
start()
386+
}
382387

383388
var body: some Scene { Settings { EmptyView() }}
384389
}

Makefile

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
define n
2+
3+
4+
endef
5+
6+
.EXPORT_ALL_VARIABLES:
7+
8+
BETA=
9+
DELTAS=5
10+
11+
ifeq (, $(VERSION))
12+
VERSION=$(shell rg -o --no-filename 'MARKETING_VERSION = ([^;]+).+' -r '$$1' *.xcodeproj/project.pbxproj | head -1 | sd 'b\d+' '')
13+
endif
14+
15+
ifneq (, $(BETA))
16+
FULL_VERSION:=$(VERSION)b$(BETA)
17+
else
18+
FULL_VERSION:=$(VERSION)
19+
endif
20+
21+
RELEASE_NOTES_FILES := $(wildcard ReleaseNotes/*.md)
22+
ENV=Release
23+
DERIVED_DATA_DIR=$(shell ls -td $$HOME/Library/Developer/Xcode/DerivedData/IsThereNet-* | head -1)
24+
25+
.PHONY: build upload release setversion appcast
26+
27+
print-% : ; @echo $* = $($*)
28+
29+
build: SHELL=fish
30+
build:
31+
make-app --build --devid --dmg -s IsThereNet -t IsThereNet -c Release --version $(FULL_VERSION)
32+
xcp /tmp/apps/IsThereNet-$(FULL_VERSION).dmg Releases/
33+
34+
upload:
35+
rsync -avzP Releases/*.{delta,dmg} hetzner:/static/lowtechguys/releases/ || true
36+
rsync -avz Releases/*.html hetzner:/static/lowtechguys/ReleaseNotes/
37+
rsync -avzP Releases/appcast.xml hetzner:/static/lowtechguys/istherenet/
38+
cfcli -d lowtechguys.com purge
39+
40+
release:
41+
gh release create v$(VERSION) -F ReleaseNotes/$(VERSION).md "Releases/IsThereNet-$(VERSION).dmg#IsThereNet.dmg"
42+
43+
appcast: Releases/IsThereNet-$(FULL_VERSION).html
44+
rm Releases/IsThereNet.dmg || true
45+
ifneq (, $(BETA))
46+
rm Releases/IsThereNet$(FULL_VERSION)*.delta >/dev/null 2>/dev/null || true
47+
generate_appcast --channel beta --maximum-versions 10 --maximum-deltas $(DELTAS) --link "https://lowtechguys.com/istherenet" --full-release-notes-url "https://github.com/FuzzyIdeas/IsThereNet/releases" --release-notes-url-prefix https://files.lowtechguys.com/ReleaseNotes/ --download-url-prefix "https://files.lowtechguys.com/releases/" -o Releases/appcast.xml Releases
48+
else
49+
rm Releases/IsThereNet$(FULL_VERSION)*.delta >/dev/null 2>/dev/null || true
50+
rm Releases/IsThereNet-*b*.dmg >/dev/null 2>/dev/null || true
51+
rm Releases/IsThereNet*b*.delta >/dev/null 2>/dev/null || true
52+
generate_appcast --maximum-versions 10 --maximum-deltas $(DELTAS) --link "https://lowtechguys.com/istherenet" --full-release-notes-url "https://github.com/FuzzyIdeas/IsThereNet/releases" --release-notes-url-prefix https://files.lowtechguys.com/ReleaseNotes/ --download-url-prefix "https://files.lowtechguys.com/releases/" -o Releases/appcast.xml Releases
53+
cp Releases/IsThereNet-$(FULL_VERSION).dmg Releases/IsThereNet.dmg
54+
endif
55+
56+
57+
setversion: OLD_VERSION=$(shell rg -o --no-filename 'MARKETING_VERSION = ([^;]+).+' -r '$$1' *.xcodeproj/project.pbxproj | head -1)
58+
setversion: SHELL=fish
59+
setversion:
60+
ifneq (, $(FULL_VERSION))
61+
sdf '((?:CURRENT_PROJECT|MARKETING)_VERSION) = $(OLD_VERSION);' '$$1 = $(FULL_VERSION);'
62+
endif
63+
64+
Releases/IsThereNet-%.html: ReleaseNotes/$(VERSION)*.md
65+
@echo Compiling $^ to $@
66+
ifneq (, $(BETA))
67+
pandoc -f gfm -o $@ --standalone --metadata title="IsThereNet $(FULL_VERSION) - Release Notes" --css https://files.lowtechguys.com/release.css $(shell ls -t ReleaseNotes/$(VERSION)*.md)
68+
else
69+
pandoc -f gfm -o $@ --standalone --metadata title="IsThereNet $(FULL_VERSION) - Release Notes" --css https://files.lowtechguys.com/release.css ReleaseNotes/$(VERSION).md
70+
endif

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,15 +62,15 @@ If you want to monitor more complex network conditions, you can use a few differ
6262
IsThereNet logs internet connection status changes to:
6363

6464
- the system log (accessible via Console.app)
65-
- to a file in `~/Library/Containers/com.lowtechguys.IsThereNet/Data/Library/Caches/IsThereNet.log`
65+
- to a file in `~/.logs/istherenet.log`
6666
- to the command line if you run the binary directly
6767

6868
## Config
6969

7070
To keep the no-UI approach, the app can be configured through editing a JSON file. The file is located at:
7171

7272
```sh
73-
~/Library/Containers/com.lowtechguys.IsThereNet/Data/Library/Application Support/config.json
73+
~/.config/istherenet/config.json
7474
```
7575

7676
The config file looks like this:

ReleaseNotes/1.6.md

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
## Auto-updater
2+
3+
Since v1.6, IsThereNet will automatically check for updates every 3 days.
4+
5+
## Multi-monitor support
6+
7+
The status line can now be shown on all screens.
8+
9+
There's also a new `screen` config key which can be set to:
10+
11+
- `all` (default): show status line on all screens
12+
- `main` (previous behaviour): show status line only on the main screen
13+
- screen name: can be part of the name like *"built-in"* or "Dell"
14+
15+
## Run command on status change
16+
17+
IsThereNet can now run a shell command when the connection status changes.
18+
19+
To configure this, the config key `shellCommandOnStatusChange` was added.
20+
21+
The command is run using the following invocation:
22+
23+
```sh
24+
/bin/zsh -c "
25+
STATUS=CONNECTED; # can be one of CONNECTED, DISCONNECTED, SLOW
26+
PING_TIME=18; # can be 0 for DISCONNECTED or >0 for CONNECTED or SLOW
27+
shellCommandOnStatusChange
28+
"
29+
```
30+
31+
The app is also no longer sandboxed to allow for shell commands to run with more permissions.
32+
33+
NOTE: if you want to run a Shortcut instead, you can use the `/usr/bin/shortcuts run` command-line.
34+
35+
## Simpler paths
36+
37+
Because we're no longer limited by the sandbox, we've moved the config and logs to shorter paths that don't have spaces in them:
38+
39+
| Description | Path |
40+
|------------------------|-------------------------------------|
41+
| Config | `~/.config/istherenet/config.json` |
42+
| App Logs | `~/.logs/istherenet.log` |
43+
| Shell command logs | `~/.logs/istherenet-shell-cmd.log` |

Releases/appcast.xml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<?xml version="1.0" standalone="yes"?>
2+
<rss xmlns:sparkle="http://www.andymatuschak.org/xml-namespaces/sparkle" version="2.0">
3+
<channel>
4+
<title>IsThereNet</title>
5+
<item>
6+
<title>1.6</title>
7+
<pubDate>Thu, 18 Jul 2024 23:27:54 +0300</pubDate>
8+
<link>https://lowtechguys.com/istherenet</link>
9+
<sparkle:fullReleaseNotesLink>https://github.com/FuzzyIdeas/IsThereNet/releases</sparkle:fullReleaseNotesLink>
10+
<sparkle:version>10</sparkle:version>
11+
<sparkle:shortVersionString>1.6</sparkle:shortVersionString>
12+
<sparkle:minimumSystemVersion>11.0</sparkle:minimumSystemVersion>
13+
<sparkle:releaseNotesLink>https://files.lowtechguys.com/ReleaseNotes/IsThereNet-1.6.html</sparkle:releaseNotesLink>
14+
<enclosure url="https://files.lowtechguys.com/releases/IsThereNet-1.6.dmg" length="2460917" type="application/octet-stream" sparkle:edSignature="k7tER//FCeoF66pQ2aytC6dT8/QtcsMsHBk3lnwXMJkjSFutdE4tiUnoDoPKqyR8UcrAusgAkKV3sEGwHZdCAA=="/>
15+
</item>
16+
</channel>
17+
</rss>

0 commit comments

Comments
 (0)