Skip to content

Commit c3894f3

Browse files
committed
remove ios build + more install scripts
1 parent 685b798 commit c3894f3

7 files changed

Lines changed: 499 additions & 56 deletions

File tree

.github/workflows/build.yaml

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ jobs:
1919
aarch64-unknown-linux-musl
2020
x86_64-pc-windows-gnu
2121
aarch64-apple-darwin
22-
aarch64-apple-ios
2322
- name: Determine crate version
2423
id: crate_version
2524
run: |
@@ -36,7 +35,6 @@ jobs:
3635
cp target/aarch64-unknown-linux-musl/release/timesplit "dist/timesplit-${PACKAGE_VERSION}-aarch64-unknown-linux-musl"
3736
cp target/x86_64-pc-windows-gnu/release/timesplit.exe "dist/timesplit-${PACKAGE_VERSION}-x86_64-pc-windows-gnu.exe"
3837
cp target/aarch64-apple-darwin/release/timesplit "dist/timesplit-${PACKAGE_VERSION}-aarch64-apple-darwin"
39-
cp target/aarch64-apple-ios/release/timesplit "dist/timesplit-${PACKAGE_VERSION}-aarch64-apple-ios"
4038
4139
- name: Create draft release
4240
id: create_release
@@ -90,15 +88,6 @@ jobs:
9088
asset_name: timesplit-${{ steps.crate_version.outputs.package_version }}-aarch64-apple-darwin
9189
asset_content_type: application/octet-stream
9290

93-
- name: "Upload release asset: aarch64-apple-ios"
94-
uses: actions/upload-release-asset@v1
95-
env:
96-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
97-
with:
98-
upload_url: ${{ steps.create_release.outputs.upload_url }}
99-
asset_path: dist/timesplit-${{ steps.crate_version.outputs.package_version }}-aarch64-apple-ios
100-
asset_name: timesplit-${{ steps.crate_version.outputs.package_version }}-aarch64-apple-ios
101-
asset_content_type: application/octet-stream
10291
- name: Upload x86_64-unknown-linux-musl binary
10392
uses: actions/upload-artifact@v4
10493
with:
@@ -126,10 +115,3 @@ jobs:
126115
name: timesplit-${{ steps.crate_version.outputs.package_version }}-aarch64-apple-darwin
127116
path: dist/timesplit-${{ steps.crate_version.outputs.package_version }}-aarch64-apple-darwin
128117
if-no-files-found: error
129-
130-
- name: Upload aarch64-apple-ios binary
131-
uses: actions/upload-artifact@v4
132-
with:
133-
name: timesplit-${{ steps.crate_version.outputs.package_version }}-aarch64-apple-ios
134-
path: dist/timesplit-${{ steps.crate_version.outputs.package_version }}-aarch64-apple-ios
135-
if-no-files-found: error

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[package]
22
name = "timesplit"
33
description = "The easy way to use multiple WakaTime compatible instances at once!"
4-
version = "0.3.2"
4+
version = "0.3.3"
55
edition = "2024"
66
license = "GPL-3.0"
77
readme = "README.md"

README.md

Lines changed: 40 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
<p align="center">The easy way to use multiple WakaTime compatible instances at once!</p>
44

55
<p align="center">
6+
<a href="https://crates.io/crates/timesplit"><img alt="Crates.io Total Downloads" src="https://img.shields.io/crates/d/timesplit?style=flat-square"></a>
67
<a href="https://github.com/ImShyMike/timesplit/actions/workflows/build.yaml"><img alt="GitHub Actions Workflow Status" src="https://img.shields.io/github/actions/workflow/status/ImShyMike/timesplit/build.yaml?style=flat-square"></a>
78
<a href="https://crates.io/crates/timesplit"><img alt="GitHub last commit" src="https://img.shields.io/github/last-commit/ImShyMike/timesplit?style=flat-square&color=green"></a>
89
<a href="https://crates.io/crates/timesplit"><img alt="Crates.io Version" src="https://img.shields.io/crates/v/timesplit?style=flat-square&color=yellow"></a>
@@ -36,21 +37,48 @@ curl -fsSL https://raw.githubusercontent.com/ImShyMike/timesplit/refs/heads/main
3637
Download the install script and run it:
3738

3839
```bash
39-
$ curl -s -o install.sh https://raw.githubusercontent.com/ImShyMike/timesplit/refs/heads/main/install.sh
40+
$ curl -o install.sh https://raw.githubusercontent.com/ImShyMike/timesplit/refs/heads/main/install.sh
4041
$ ./install.sh
4142
Usage: ./install.sh [COMMAND]
4243

4344
Commands:
44-
install Install timesplit and set up autorun
45-
uninstall Remove timesplit and stop autorun
46-
update Update timesplit to the latest version
45+
install Install timesplit and set up autorun (requires sudo)
46+
uninstall Remove timesplit and stop autorun (requires sudo)
47+
update Update timesplit to the latest version (requires sudo)
4748
status Check installation and service status
4849
help Show this help message
4950
```
5051

51-
### Windows/MacOS
52+
### Windows
5253

53-
This will need manual installation for now :(
54+
One liner: (needs an elevated PowerShell window)
55+
56+
```powershell
57+
iwr -useb https://raw.githubusercontent.com/ImShyMike/timesplit/refs/heads/main/install.ps1 | iex; .\install.ps1 update
58+
```
59+
60+
### macOS
61+
62+
One liner:
63+
64+
```bash
65+
curl -fsSL https://raw.githubusercontent.com/ImShyMike/timesplit/refs/heads/main/install_macos.sh | sudo bash -s -- update
66+
```
67+
68+
Download the install script and run it:
69+
70+
```bash
71+
$ curl -o install_macos.sh https://raw.githubusercontent.com/ImShyMike/timesplit/refs/heads/main/install_macos.sh
72+
$ sudo ./install_macos.sh
73+
Usage: ./install_macos.sh [COMMAND]
74+
75+
Commands:
76+
install Install timesplit and set up autorun (requires sudo)
77+
uninstall Remove timesplit and stop autorun (requires sudo)
78+
update Update timesplit to the latest version (requires sudo)
79+
status Check installation and service status
80+
help Show this help message
81+
```
5482

5583
## Usage
5684

@@ -62,7 +90,10 @@ api_key = 39949664-5a5f-4c7d-95b2-44a864f67b6a
6290
api_url = http://localhost:25893
6391
```
6492

65-
<sup>(This snippet uses `timesplit`'s default port)</sup>
93+
_(This snippet uses `timesplit`'s default port.)_
94+
95+
> [!WARNING]
96+
> The api key must be a valid UUID to avoid compatibility issues!
6697
6798
## Configuration
6899

@@ -89,13 +120,12 @@ This program is know to be compatible with the following backend servers:
89120

90121
- [WakaTime](https://github.com/wakatime)
91122
- [Wakapi](https://github.com/muety/wakapi)
92-
- [Rustytime](https://github.com/ImShyMike/rustytime)
93-
<br><sup>you should check this one out ;)</sup>
123+
- [Rustytime](https://github.com/ImShyMike/rustytime) (you should check this one out ;))
94124
- [Hackatime](https://github.com/hackclub/hackatime)
95125
- [Hackatime (old)](https://github.com/hackclub/archived-hacktime)
96126
- [OtterTime](https://github.com/SkyfallWasTaken/ottertime)
97127

98-
<sub>(all of the above servers were tested using the vscode extension)</sub>
128+
All of the above servers were tested using the VS Code extension.
99129

100130
Others will likely work, this is just a list of verified working servers.
101131

install.ps1

Lines changed: 193 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,193 @@
1+
param(
2+
[string]$Command = 'help'
3+
)
4+
5+
$ProgramName = 'timesplit'
6+
$InstallDir = Join-Path -Path ${env:ProgramFiles} -ChildPath $ProgramName
7+
$InstallPath = Join-Path -Path $InstallDir -ChildPath "$ProgramName.exe"
8+
$TaskName = 'TimeSplit'
9+
$GhApi = 'https://api.github.com/repos/ImShyMike/timesplit/releases/latest'
10+
11+
function Write-Info([string]$m){ Write-Host "$m" -ForegroundColor Yellow }
12+
function Write-Success([string]$m){ Write-Host "$m" -ForegroundColor Green }
13+
function Write-Err([string]$m){ Write-Host "$m" -ForegroundColor Red }
14+
15+
function Ensure-Admin {
16+
$isAdmin = ([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)
17+
if (-not $isAdmin) {
18+
Write-Err "This script must be run as Administrator (open PowerShell as Admin)."
19+
exit 1
20+
}
21+
}
22+
23+
function Get-DownloadInfo {
24+
Write-Info "Querying GitHub for latest release..."
25+
try {
26+
$release = Invoke-RestMethod -Uri $GhApi -UseBasicParsing -ErrorAction Stop
27+
} catch {
28+
Write-Err "Failed to fetch release information from GitHub: $_"
29+
return $null
30+
}
31+
32+
$tag = $release.tag_name
33+
if (-not $tag) {
34+
Write-Err "Unable to determine release tag name from GitHub response."
35+
return $null
36+
}
37+
38+
$version = $tag.TrimStart('v')
39+
$expectedName = "$ProgramName-$version-x86_64-pc-windows-gnu.exe"
40+
41+
$asset = $release.assets | Where-Object { $_.name -eq $expectedName } | Select-Object -First 1
42+
43+
if ($null -eq $asset) {
44+
Write-Err "Expected asset '$expectedName' not found in release '$tag'."
45+
return $null
46+
}
47+
48+
Write-Info "Selected asset: $($asset.name)"
49+
return [PSCustomObject]@{
50+
Url = $asset.browser_download_url
51+
Name = $asset.name
52+
Version = $version
53+
}
54+
}
55+
56+
function Create-ScheduledTask-PowerShell {
57+
param([string]$exePath)
58+
try {
59+
$action = New-ScheduledTaskAction -Execute $exePath -Argument 'run'
60+
$trigger = New-ScheduledTaskTrigger -AtStartup
61+
Register-ScheduledTask -TaskName $TaskName -Action $action -Trigger $trigger -RunLevel Highest -User 'SYSTEM' -Force | Out-Null
62+
Write-Success "Scheduled Task '$TaskName' created (PowerShell ScheduledTask API)."
63+
Start-ScheduledTask -TaskName $TaskName -ErrorAction SilentlyContinue
64+
return $true
65+
} catch {
66+
Write-Err "PowerShell ScheduledTask creation failed: $_"
67+
return $false
68+
}
69+
}
70+
71+
function Create-ScheduledTask-Schtasks {
72+
param([string]$exePath)
73+
try {
74+
$quoted = '"' + $exePath + '" run'
75+
$cmd = "schtasks /Create /SC ONSTART /TN \"$TaskName\" /TR $quoted /RL HIGHEST /F /RU SYSTEM"
76+
Write-Info "Running: $cmd"
77+
$proc = Start-Process -FilePath schtasks -ArgumentList "/Create","/SC","ONSTART","/TN","$TaskName","/TR",$quoted,"/RL","HIGHEST","/F","/RU","SYSTEM" -NoNewWindow -PassThru -Wait -ErrorAction Stop
78+
Write-Success "Scheduled Task '$TaskName' created (schtasks)."
79+
return $true
80+
} catch {
81+
Write-Err "schtasks creation failed: $_"
82+
return $false
83+
}
84+
}
85+
86+
function Install-Program {
87+
Ensure-Admin
88+
89+
if (-not [Environment]::Is64BitOperatingSystem) {
90+
Write-Err "Unsupported architecture. Windows releases are currently available only for x86_64."
91+
exit 1
92+
}
93+
94+
$downloadInfo = Get-DownloadInfo
95+
if (-not $downloadInfo) { exit 1 }
96+
97+
$tmp = Join-Path -Path $env:TEMP -ChildPath $downloadInfo.Name
98+
Write-Info "Downloading $ProgramName $($downloadInfo.Version) from $($downloadInfo.Url) to $tmp"
99+
try {
100+
Invoke-WebRequest -Uri $downloadInfo.Url -OutFile $tmp -UseBasicParsing -ErrorAction Stop
101+
} catch {
102+
Write-Err "Download failed: $_"
103+
exit 1
104+
}
105+
106+
Write-Info "Installing to $InstallDir"
107+
New-Item -ItemType Directory -Path $InstallDir -Force | Out-Null
108+
try {
109+
Move-Item -Path $tmp -Destination $InstallPath -Force
110+
} catch {
111+
Write-Err "Failed to move binary into place: $_"
112+
exit 1
113+
}
114+
115+
Write-Success "Binary installed to $InstallPath (version $($downloadInfo.Version))"
116+
117+
# Try PowerShell ScheduledTask API first, fallback to schtasks.exe
118+
if (Get-Command -Name Register-ScheduledTask -ErrorAction SilentlyContinue) {
119+
if (-not (Create-ScheduledTask-PowerShell -exePath $InstallPath)) {
120+
Write-Info "Falling back to schtasks.exe"
121+
Create-ScheduledTask-Schtasks -exePath $InstallPath | Out-Null
122+
}
123+
} else {
124+
Write-Info "Register-ScheduledTask not available; using schtasks.exe"
125+
Create-ScheduledTask-Schtasks -exePath $InstallPath | Out-Null
126+
}
127+
128+
Write-Success "$ProgramName installed and scheduled to run at startup."
129+
Write-Info "Use 'install.ps1 status' to check the installation."
130+
}
131+
132+
function Uninstall-Program {
133+
Ensure-Admin
134+
135+
Write-Info "Removing scheduled task (if present)"
136+
if (Get-Command -Name Unregister-ScheduledTask -ErrorAction SilentlyContinue) {
137+
try { Unregister-ScheduledTask -TaskName $TaskName -Confirm:$false -ErrorAction SilentlyContinue }
138+
catch { }
139+
}
140+
141+
# Also try schtasks delete
142+
try { schtasks /Delete /TN $TaskName /F > $null 2>&1 } catch { }
143+
144+
if (Test-Path $InstallDir) {
145+
try {
146+
Remove-Item -Path $InstallDir -Recurse -Force
147+
Write-Success "Removed $InstallDir"
148+
} catch {
149+
Write-Err "Failed to remove $InstallDir: $_"
150+
}
151+
} else {
152+
Write-Info "$InstallDir not present"
153+
}
154+
155+
Write-Success "$ProgramName uninstalled."
156+
}
157+
158+
function Show-Status {
159+
if (Test-Path $InstallPath) {
160+
Write-Success "$ProgramName is installed at $InstallPath"
161+
} else {
162+
Write-Err "$ProgramName is not installed"
163+
}
164+
165+
Write-Info "Scheduled task status:"
166+
if (Get-Command -Name Get-ScheduledTask -ErrorAction SilentlyContinue) {
167+
try {
168+
$task = Get-ScheduledTask -TaskName $TaskName -ErrorAction Stop
169+
$task | Format-List | Out-Host
170+
} catch {
171+
Write-Info "Scheduled task '$TaskName' not found via PowerShell API."
172+
}
173+
}
174+
175+
try {
176+
schtasks /Query /TN $TaskName 2>$null
177+
} catch {
178+
Write-Info "No schtasks entry for $TaskName"
179+
}
180+
}
181+
182+
function Show-Usage {
183+
Write-Host "Usage: install.ps1 [install|uninstall|update|status|help]"
184+
}
185+
186+
switch ($Command.ToLower()) {
187+
'install' { Install-Program }
188+
'uninstall' { Uninstall-Program }
189+
'update' { Uninstall-Program; Install-Program }
190+
'status' { Show-Status }
191+
'help' { Show-Usage }
192+
default { Write-Err "Invalid command: $Command`n"; Show-Usage; exit 1 }
193+
}

0 commit comments

Comments
 (0)