Compare commits
10 Commits
v0.1.0-alp
...
v0.1.0-alp
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
40fda06dbd | ||
|
|
694711ea07 | ||
|
|
2efebfdce8 | ||
|
|
02942f421a | ||
|
|
fd2186b14b | ||
|
|
2a4e13c58d | ||
|
|
33d8d1b64b | ||
|
|
5b849f9820 | ||
|
|
1c3d0a5320 | ||
|
|
97b0e0bf1e |
29
.github/workflows/aur-publish.yml
vendored
29
.github/workflows/aur-publish.yml
vendored
@@ -4,6 +4,12 @@ on:
|
||||
push:
|
||||
tags:
|
||||
- "v*"
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
tag:
|
||||
description: "Tag to publish to AUR (e.g. v0.1.0-alpha.8)"
|
||||
required: true
|
||||
type: string
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
@@ -19,17 +25,24 @@ jobs:
|
||||
run: |
|
||||
pacman -Syu --noconfirm
|
||||
pacman -S --noconfirm --needed base-devel git openssh curl
|
||||
useradd -m -u 1000 builder || true
|
||||
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
ref: ${{ inputs.tag || github.ref_name }}
|
||||
|
||||
- name: Generate PKGBUILD (deskify-bin)
|
||||
run: bash packaging/generate-pkgbuild-bin.sh "${GITHUB_REF_NAME}"
|
||||
run: bash packaging/generate-pkgbuild-bin.sh "${{ inputs.tag || github.ref_name }}"
|
||||
|
||||
- name: Generate .SRCINFO
|
||||
run: |
|
||||
cd packaging
|
||||
makepkg --printsrcinfo > .SRCINFO
|
||||
rm -rf /home/builder/work
|
||||
mkdir -p /home/builder/work
|
||||
cp -R . /home/builder/work
|
||||
chown -R builder:builder /home/builder/work
|
||||
su - builder -c "cd /home/builder/work/packaging && makepkg --printsrcinfo > .SRCINFO"
|
||||
cp /home/builder/work/packaging/.SRCINFO packaging/.SRCINFO
|
||||
|
||||
- name: Configure SSH for AUR
|
||||
env:
|
||||
@@ -40,7 +53,10 @@ jobs:
|
||||
chmod 700 ~/.ssh
|
||||
printf "%s\n" "${AUR_SSH_PRIVATE_KEY}" > ~/.ssh/aur
|
||||
chmod 600 ~/.ssh/aur
|
||||
ssh-keyscan -t rsa,ecdsa,ed25519 aur.archlinux.org >> ~/.ssh/known_hosts
|
||||
touch ~/.ssh/known_hosts
|
||||
chmod 600 ~/.ssh/known_hosts
|
||||
# Ensure host key is present for non-interactive git/ssh.
|
||||
ssh-keyscan -t rsa,ecdsa,ed25519 aur.archlinux.org >> ~/.ssh/known_hosts 2>/dev/null
|
||||
cat >> ~/.ssh/config <<'EOF'
|
||||
Host aur.archlinux.org
|
||||
User aur
|
||||
@@ -53,6 +69,8 @@ jobs:
|
||||
AUR_USERNAME: ${{ secrets.AUR_USERNAME }}
|
||||
AUR_EMAIL: ${{ secrets.AUR_EMAIL }}
|
||||
run: |
|
||||
export GIT_SSH_COMMAND="ssh -i ~/.ssh/aur -o IdentitiesOnly=yes -o UserKnownHostsFile=$HOME/.ssh/known_hosts -o StrictHostKeyChecking=yes"
|
||||
|
||||
git config --global user.name "${AUR_USERNAME:-deskify-bot}"
|
||||
git config --global user.email "${AUR_EMAIL:-noreply@example.invalid}"
|
||||
|
||||
@@ -69,6 +87,5 @@ jobs:
|
||||
fi
|
||||
|
||||
git add PKGBUILD .SRCINFO
|
||||
git commit -m "Update deskify-bin to ${GITHUB_REF_NAME}"
|
||||
git commit -m "Update deskify-bin to ${{ inputs.tag || github.ref_name }}"
|
||||
git push
|
||||
|
||||
|
||||
18
README.md
18
README.md
@@ -192,6 +192,16 @@ Notes:
|
||||
- The `tauri` backend still requires Tauri/WebKitGTK system dependencies to build wrappers locally.
|
||||
- The `chromium` backend does not require Tauri prerequisites (but it requires an installed Chromium-based browser).
|
||||
|
||||
### Arch Linux (AUR)
|
||||
|
||||
An AUR package is available (prebuilt binary package):
|
||||
|
||||
```bash
|
||||
yay -S deskify-bin
|
||||
```
|
||||
|
||||
⚠️ The AUR package tracks **alpha** tags (`v0.1.0-alpha.N`). Expect occasional breaking changes during early development.
|
||||
|
||||
### Option B: Build from source (Tauri mode)
|
||||
|
||||
### 1. System Dependencies
|
||||
@@ -352,6 +362,14 @@ Note for Chromium backend:
|
||||
|
||||
- `--no-decorations` is best-effort and may be ignored by the browser/window manager.
|
||||
- `--width` and `--height` are applied together (`--window-size`) only when both are provided.
|
||||
- Deskify auto-detects a Chromium-based browser from `PATH`, but some distros ship Chromium-based browser commands (Chrome/Chromium/Brave, etc.) as wrapper scripts or use different binary names/paths (for example on BigLinux). If launches fail, set `--browser-bin` to a real browser binary.
|
||||
|
||||
Troubleshooting (find the real browser binary):
|
||||
|
||||
```bash
|
||||
command -v chrome chromium google-chrome google-chrome-stable brave-browser 2>/dev/null
|
||||
ls -la /usr/bin/chrome /usr/bin/chromium /usr/bin/google-chrome /usr/bin/google-chrome-stable 2>/dev/null
|
||||
```
|
||||
|
||||
### Managing Apps (`list` & `remove`)
|
||||
You can view all applications generated by `deskify`:
|
||||
|
||||
@@ -1,15 +1,16 @@
|
||||
pkgname=deskify-bin
|
||||
pkgver=0.1.0_alpha.7
|
||||
pkgver=0.1.0.alpha.8
|
||||
pkgrel=1
|
||||
pkgdesc="Turn websites into Linux desktop apps (prebuilt binary package)"
|
||||
arch=('x86_64')
|
||||
url="https://github.com/spalencsar/deskify"
|
||||
license=('MIT')
|
||||
depends=('glibc')
|
||||
optdepends=('chromium: for --backend chromium')
|
||||
provides=('deskify')
|
||||
conflicts=('deskify')
|
||||
|
||||
_tag="v0.1.0-alpha.7"
|
||||
_tag="v0.1.0-alpha.8"
|
||||
source=("deskify::https://github.com/spalencsar/deskify/releases/download/${_tag}/deskify-linux-x86_64"
|
||||
"LICENSE::https://raw.githubusercontent.com/spalencsar/deskify/${_tag}/LICENSE")
|
||||
|
||||
|
||||
@@ -25,6 +25,19 @@ trap 'rm -rf "${tmp_dir}"' EXIT
|
||||
asset_path="${tmp_dir}/deskify-linux-x86_64"
|
||||
license_path="${tmp_dir}/LICENSE"
|
||||
|
||||
wait_seconds="${WAIT_FOR_ASSET_SECONDS:-300}"
|
||||
interval_seconds="${WAIT_FOR_ASSET_INTERVAL_SECONDS:-5}"
|
||||
deadline=$((SECONDS + wait_seconds))
|
||||
|
||||
while ! curl -fsI "${ASSET_URL}" >/dev/null 2>&1; do
|
||||
if (( SECONDS >= deadline )); then
|
||||
echo "Error: release asset not available yet: ${ASSET_URL}" >&2
|
||||
echo "Tip: the GitHub Release workflow may still be building. Re-run the AUR workflow once the asset exists." >&2
|
||||
exit 1
|
||||
fi
|
||||
sleep "${interval_seconds}"
|
||||
done
|
||||
|
||||
curl -fL -o "${asset_path}" "${ASSET_URL}"
|
||||
curl -fL -o "${license_path}" "${LICENSE_URL}"
|
||||
|
||||
|
||||
70
src/main.rs
70
src/main.rs
@@ -26,6 +26,7 @@ enum Backend {
|
||||
)]
|
||||
#[serde(rename_all = "lowercase")]
|
||||
enum ProfileScope {
|
||||
#[serde(alias = "default")]
|
||||
Isolated,
|
||||
Shared,
|
||||
}
|
||||
@@ -264,9 +265,17 @@ fn read_app_config(id: &str) -> Result<Option<DeskifyAppConfig>> {
|
||||
}
|
||||
let content = fs::read_to_string(&path)
|
||||
.with_context(|| format!("Failed to read app config {}", path.display()))?;
|
||||
let cfg: DeskifyAppConfig =
|
||||
serde_json::from_str(&content).context("Failed to parse app config JSON")?;
|
||||
Ok(Some(cfg))
|
||||
match serde_json::from_str::<DeskifyAppConfig>(&content) {
|
||||
Ok(cfg) => Ok(Some(cfg)),
|
||||
Err(err) => {
|
||||
eprintln!(
|
||||
"Warning: Failed to parse app config {} ({}). Falling back to desktop entry metadata.",
|
||||
path.display(),
|
||||
err
|
||||
);
|
||||
Ok(None)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn write_app_config_from_args(args: &BuildArgs) -> Result<()> {
|
||||
@@ -396,10 +405,37 @@ fn find_binary_in_path(name: &str) -> Option<PathBuf> {
|
||||
None
|
||||
}
|
||||
|
||||
fn chromium_binary_works(path: &Path) -> Result<()> {
|
||||
let output = Command::new(path)
|
||||
.arg("--version")
|
||||
.output()
|
||||
.with_context(|| format!("Failed to execute browser binary {}", path.display()))?;
|
||||
if output.status.success() {
|
||||
return Ok(());
|
||||
}
|
||||
let stderr = String::from_utf8_lossy(&output.stderr).trim().to_string();
|
||||
let stdout = String::from_utf8_lossy(&output.stdout).trim().to_string();
|
||||
let details = if !stderr.is_empty() {
|
||||
stderr
|
||||
} else if !stdout.is_empty() {
|
||||
stdout
|
||||
} else {
|
||||
format!("exit code {}", output.status)
|
||||
};
|
||||
Err(anyhow!(
|
||||
"Browser binary exists but failed to run: {} ({})",
|
||||
path.display(),
|
||||
details
|
||||
))
|
||||
}
|
||||
|
||||
fn resolve_chromium_binary(explicit: Option<&str>) -> Result<PathBuf> {
|
||||
if let Some(path) = explicit {
|
||||
let candidate = PathBuf::from(path);
|
||||
if candidate.is_file() {
|
||||
chromium_binary_works(&candidate).with_context(|| {
|
||||
"The specified browser binary does not appear to be usable. If it's a wrapper script, ensure the underlying browser exists."
|
||||
})?;
|
||||
return Ok(candidate);
|
||||
}
|
||||
return Err(anyhow!(
|
||||
@@ -409,7 +445,9 @@ fn resolve_chromium_binary(explicit: Option<&str>) -> Result<PathBuf> {
|
||||
}
|
||||
|
||||
for candidate in chromium_candidates() {
|
||||
if let Some(path) = find_binary_in_path(candidate) {
|
||||
if let Some(path) = find_binary_in_path(candidate)
|
||||
&& chromium_binary_works(&path).is_ok()
|
||||
{
|
||||
return Ok(path);
|
||||
}
|
||||
}
|
||||
@@ -1435,6 +1473,8 @@ mod tests {
|
||||
is_deskify_desktop_entry, sanitize_app_id, validate_remove_id,
|
||||
};
|
||||
use std::path::Path;
|
||||
use std::{fs, os::unix::fs::PermissionsExt};
|
||||
use tempfile::tempdir;
|
||||
|
||||
#[test]
|
||||
fn sanitize_app_id_replaces_spaces_and_strips_symbols() {
|
||||
@@ -1525,4 +1565,26 @@ mod tests {
|
||||
assert!(exec.contains("--force-dark-mode"));
|
||||
assert!(exec.contains("--user-agent="));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn profile_scope_accepts_default_alias() {
|
||||
let scope: ProfileScope = serde_json::from_str("\"default\"").unwrap();
|
||||
assert_eq!(scope, ProfileScope::Isolated);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn resolve_chromium_binary_rejects_broken_explicit_path() {
|
||||
let dir = tempdir().unwrap();
|
||||
let script = dir.path().join("broken-browser");
|
||||
fs::write(&script, "#!/bin/sh\nexit 1\n").unwrap();
|
||||
let mut perms = fs::metadata(&script).unwrap().permissions();
|
||||
perms.set_mode(0o755);
|
||||
fs::set_permissions(&script, perms).unwrap();
|
||||
|
||||
let err = super::resolve_chromium_binary(Some(script.to_str().unwrap()))
|
||||
.err()
|
||||
.unwrap()
|
||||
.to_string();
|
||||
assert!(err.contains("failed to run") || err.contains("does not appear to be usable"));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user