Skip to content

Commit b2e6dc6

Browse files
committed
feat: allow configuring local resolved hosts, add CI workflows, bump to 0.1.3
- Allow configuring local resolved hosts - Add installer and AppleScript CI workflows - Include manager in AppleScript workflow paths - Refactor
1 parent 1c5c23c commit b2e6dc6

11 files changed

Lines changed: 226 additions & 48 deletions

File tree

Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
name: Installer Smoke
2+
3+
on:
4+
push:
5+
branches: [main]
6+
paths:
7+
- "install-macos.sh"
8+
- "install-windows.ps1"
9+
- "pyproject.toml"
10+
- "setup.py"
11+
- "README.md"
12+
- "src/**"
13+
- ".github/workflows/installer-smoke.yml"
14+
pull_request:
15+
paths:
16+
- "install-macos.sh"
17+
- "install-windows.ps1"
18+
- "pyproject.toml"
19+
- "setup.py"
20+
- "README.md"
21+
- "src/**"
22+
- ".github/workflows/installer-smoke.yml"
23+
workflow_dispatch:
24+
25+
permissions:
26+
contents: read
27+
28+
jobs:
29+
macos-installer:
30+
name: macOS installer
31+
runs-on: macos-latest
32+
33+
steps:
34+
- name: Check out repository
35+
uses: actions/checkout@v4
36+
37+
- name: Set up Python
38+
uses: actions/setup-python@v5
39+
with:
40+
python-version: "3.13"
41+
42+
- name: Run installer
43+
env:
44+
SLICER_URI_BRIDGE_PROJECT_SPEC: ${{ github.workspace }}
45+
HOME: ${{ runner.temp }}/home
46+
XDG_CONFIG_HOME: ${{ runner.temp }}/xdg-config
47+
URI_BRIDGE_MACOS_APP_DIR: ${{ runner.temp }}/Applications
48+
run: |
49+
mkdir -p "$HOME" "$XDG_CONFIG_HOME" "$URI_BRIDGE_MACOS_APP_DIR"
50+
bash install-macos.sh
51+
52+
- name: Verify installation
53+
env:
54+
HOME: ${{ runner.temp }}/home
55+
XDG_CONFIG_HOME: ${{ runner.temp }}/xdg-config
56+
URI_BRIDGE_MACOS_APP_DIR: ${{ runner.temp }}/Applications
57+
run: |
58+
export PATH="$HOME/.local/bin:$PATH"
59+
command -v slicer-uri-bridge
60+
slicer-uri-bridge --version
61+
slicer-uri-bridge status
62+
test -f "$URI_BRIDGE_MACOS_APP_DIR/SlicerURIBridge.app/Contents/Info.plist"
63+
64+
windows-installer:
65+
name: Windows installer
66+
runs-on: windows-latest
67+
68+
steps:
69+
- name: Check out repository
70+
uses: actions/checkout@v4
71+
72+
- name: Set up Python
73+
uses: actions/setup-python@v5
74+
with:
75+
python-version: "3.13"
76+
77+
- name: Run installer
78+
shell: powershell
79+
env:
80+
SLICER_URI_BRIDGE_PROJECT_SPEC: ${{ github.workspace }}
81+
LOCALAPPDATA: ${{ runner.temp }}\LocalAppData
82+
APPDATA: ${{ runner.temp }}\AppData
83+
run: .\install-windows.ps1
84+
85+
- name: Verify installation
86+
shell: powershell
87+
env:
88+
LOCALAPPDATA: ${{ runner.temp }}\LocalAppData
89+
APPDATA: ${{ runner.temp }}\AppData
90+
run: |
91+
$bridge = Join-Path $env:LOCALAPPDATA 'slicer-uri-bridge\venv\Scripts\slicer-uri-bridge.exe'
92+
if (-not (Test-Path -LiteralPath $bridge)) {
93+
throw "Bridge command was not installed: $bridge"
94+
}
95+
96+
& $bridge --version
97+
& $bridge status
98+
99+
$command = (Get-Item -LiteralPath 'HKCU:\Software\Classes\bambustudioopen\shell\open\command').GetValue('')
100+
if ($command -notmatch 'slicer_uri_bridge\.handler') {
101+
throw "Unexpected bambustudioopen handler command: $command"
102+
}
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: macOS AppleScript
2+
3+
on:
4+
push:
5+
branches: [main]
6+
paths:
7+
- "src/slicer_uri_bridge/manager.py"
8+
- "src/slicer_uri_bridge/resources/macos-launcher.applescript"
9+
- "tests/test_manager_macos.py"
10+
- ".github/workflows/macos-applescript.yml"
11+
pull_request:
12+
paths:
13+
- "src/slicer_uri_bridge/manager.py"
14+
- "src/slicer_uri_bridge/resources/macos-launcher.applescript"
15+
- "tests/test_manager_macos.py"
16+
- ".github/workflows/macos-applescript.yml"
17+
workflow_dispatch:
18+
19+
permissions:
20+
contents: read
21+
22+
jobs:
23+
osacompile:
24+
name: osacompile integration
25+
runs-on: macos-latest
26+
27+
steps:
28+
- name: Check out repository
29+
uses: actions/checkout@v4
30+
31+
- name: Set up Python
32+
uses: actions/setup-python@v5
33+
with:
34+
python-version: "3.13"
35+
36+
- name: Install package
37+
run: python -m pip install -e .
38+
39+
- name: Run macOS AppleScript tests
40+
run: python -m unittest tests.test_manager_macos

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@
22

33
All notable changes to this project are documented here.
44

5+
## v0.1.3 - 2026-06-03
6+
7+
### Added
8+
9+
- Add `allow_local_resolved_hosts` as a security setting for cases where you intentionally want to allow downloads from trusted hosts that resolve to local addresses.
10+
511
## v0.1.2 - 2026-05-20
612

713
### Added

README.md

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
[![Python 3.11+](https://img.shields.io/badge/python-3.11%2B-blue.svg)](https://www.python.org/downloads/)
55
[![License: MIT](https://img.shields.io/badge/license-MIT-green.svg)](https://opensource.org/licenses/MIT)
66
[![Platform: Windows | macOS | Linux](https://img.shields.io/badge/platform-Windows%20%7C%20macOS%20%7C%20Linux-lightgrey.svg)]()
7+
[![Tests](https://img.shields.io/github/actions/workflow/status/mbv06/slicer-uri-bridge/ci.yml?label=tests)](https://github.com/mbv06/slicer-uri-bridge/actions/workflows/ci.yml)
78

89
[Installation](#installation) · [Security Model](#security-model) · [Changelog](CHANGELOG.md)
910

@@ -58,7 +59,7 @@ First, install Python 3.11 or newer on the target system:
5859
Then install the package from GitHub:
5960

6061
```bash
61-
python -m pip install https://github.com/mbv06/slicer-uri-bridge/archive/refs/heads/main.zip
62+
python -m pip install --upgrade https://github.com/mbv06/slicer-uri-bridge/archive/refs/heads/main.zip
6263
```
6364

6465
Installation only installs the CLI and Python package. It does not register URI handlers automatically.
@@ -92,22 +93,30 @@ slicer-uri-bridge status
9293

9394
## Uninstall
9495

95-
Unregister all URI handlers managed by this package:
96+
First, unregister all URI handlers managed by this package:
9697

9798
```bash
9899
slicer-uri-bridge unregister --auto
99100
```
100101

101-
You can also delete the config and log files manually. Find their location with:
102+
Then remove the installed package or app files for your installation type.
103+
104+
Manual install:
102105

103106
```bash
104-
slicer-uri-bridge config-path
107+
python -m pip uninstall slicer-uri-bridge
108+
```
109+
110+
Automatic Windows install:
111+
112+
```powershell
113+
Remove-Item -LiteralPath (Join-Path $env:LOCALAPPDATA 'slicer-uri-bridge') -Recurse -Force
105114
```
106115

107-
Then remove the package:
116+
Automatic macOS install:
108117

109118
```bash
110-
pip uninstall slicer-uri-bridge
119+
rm -rf "$HOME/.local/share/slicer-uri-bridge" "$HOME/Applications/SlicerURIBridge.app"; rm -f "$HOME/.local/bin/slicer-uri-bridge"
111120
```
112121

113122
## How It Works
@@ -133,7 +142,7 @@ The bridge validates downloads before opening them:
133142

134143
* only HTTPS URLs are allowed unless `allow_plain_http = true`
135144
* URLs with embedded credentials are rejected
136-
* resolved hosts must not point to local/private/reserved addresses
145+
* resolved hosts must not point to local/private/reserved addresses unless `allow_local_resolved_hosts = true`
137146
* redirect targets are revalidated
138147
* downloaded files must use an allowed model extension
139148
* empty files and obvious executable formats are refused

install-macos.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ set -euo pipefail
1515
#
1616
# To update later, run this installer again.
1717

18-
PROJECT_SPEC="https://github.com/mbv06/slicer-uri-bridge/archive/refs/heads/main.zip"
18+
PROJECT_SPEC="${SLICER_URI_BRIDGE_PROJECT_SPEC:-https://github.com/mbv06/slicer-uri-bridge/archive/refs/heads/main.zip}"
1919

2020
APP_HOME="${HOME}/.local/share/slicer-uri-bridge"
2121
VENV="${APP_HOME}/venv"

install-windows.ps1

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@
2121
Set-StrictMode -Version Latest
2222
$ErrorActionPreference = 'Stop'
2323

24-
$ProjectSpec = 'https://github.com/mbv06/slicer-uri-bridge/archive/refs/heads/main.zip'
24+
$DefaultProjectSpec = 'https://github.com/mbv06/slicer-uri-bridge/archive/refs/heads/main.zip'
25+
$ProjectSpec = if ($env:SLICER_URI_BRIDGE_PROJECT_SPEC) { $env:SLICER_URI_BRIDGE_PROJECT_SPEC } else { $DefaultProjectSpec }
2526
$AppHome = Join-Path $env:LOCALAPPDATA 'slicer-uri-bridge'
2627
$VenvDir = Join-Path $AppHome 'venv'
2728
$ScriptsDir = Join-Path $VenvDir 'Scripts'

pyproject.toml

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ build-backend = "setuptools.build_meta"
44

55
[project]
66
name = "slicer-uri-bridge"
7-
version = "0.1.2"
8-
description = "Register slicer URI handlers and bridge slicer links to Bambu Studio."
7+
version = "0.1.3"
8+
description = "Register slicer URI handlers and bridge slicer links to your favorite slicer app."
99
readme = "README.md"
1010
requires-python = ">=3.11"
1111
license = { text = "MIT" }
@@ -15,9 +15,6 @@ authors = [
1515
keywords = ["uri-handler", "slicer", "bambu-studio", "cura", "prusaslicer", "orcaslicer"]
1616
classifiers = [
1717
"Programming Language :: Python :: 3",
18-
"Programming Language :: Python :: 3.11",
19-
"Programming Language :: Python :: 3.12",
20-
"Programming Language :: Python :: 3.13",
2118
"Operating System :: Microsoft :: Windows",
2219
"Operating System :: MacOS",
2320
"Operating System :: POSIX :: Linux",

0 commit comments

Comments
 (0)