Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Graphical Installer #4

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"plugins": ["@babel/syntax-dynamic-import"],
"presets": [
[
"@babel/preset-env",
{
"modules": false
}
]
]
}
69 changes: 69 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
name: Build Alby Installer
on:
push:
branches:
- master
pull_request:
release:
types: [published]

jobs:
BuildFat:
name: Build for linux x86_64
runs-on: ubuntu-18.04
env:
ALBY_COMPANION_VERSION: "latest"
ALBY_COMPANION_FILE: "linux-x86_64.tar.gz"

steps:
- name: Install dependencies
run: sudo apt update && sudo apt install -y cmake build-essential qt5-default

- name: Clone the repo
uses: actions/checkout@v2
with:
fetch-depth: 1

- name: Build
run: |
./build.sh

- name: Upload nodegui packer output
uses: actions/upload-artifact@master
with:
name: AlbyInstaller-x86_64-linux-broken
path: deploy/appimage/AlbyInstaller-x86_64.AppImage-broken

- name: Upload installer
uses: actions/upload-artifact@master
with:
name: AlbyInstaller-x86_64-linux
path: deploy/appimage/AlbyInstaller-x86_64.AppImage

DeployRelease:
needs: [BuildFat]
name: Deploy Release
runs-on: ubuntu-18.04
if: github.event_name == 'release'
steps:
- name: Download artifacts
uses: actions/download-artifact@master
with:
name: AlbyInstaller-x86_64-linux
path: dist/
- name: Deploy to GitHub Releases
run: |
echo "${GITHUB_EVENT_PATH}"
cat ${GITHUB_EVENT_PATH}
releaseId=$(jq --raw-output '.release.id' ${GITHUB_EVENT_PATH})

filename="AlbyInstaller-x86_64-linux"
mv ./dist/AlbyInstaller* $filename

url="https://uploads.github.com/repos/${GITHUB_REPOSITORY}/releases/$releaseId/assets?name=$(basename $filename)"
echo "Upload to $url"
curl -L \
-H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
-H "Content-Type: application/octet-stream" \
--data-binary @"$filename" \
"$url"
18 changes: 16 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,16 @@
alby
alby.tar.gz
*.svg
dist
node_modules
build
deploy/linux/build
deploy/linux/alby-installer-linux/assets
deploy/linux/alby-installer-linux/dist
deploy/appimage
deploy/tmp
deploy/appimage/tmp
x.git
tmp
deploy/linux/alby-installer-linux/version.json
deploy/linux/alby-installer-linux/release.*
deploy/linux/alby-installer-linux/.env.sh
deploy/linux/alby-installer-linux/.env
65 changes: 49 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,31 +1,64 @@
# Alby installer for Linux
# Alby Linux Installer

This installer configures Alby for your browser on Linux and allows your to connect Alby to nodes behind Tor.
This is the Extension and Companion Installer for [Alby](http://getalby.com/).

## Chrome

Open the terminal in this directory and run:
![light mode](./screenshot/Screenshot%20from%202022-06-13%2013-46-50.png)

$ ./chrome.sh
![dark mode](./screenshot/Screenshot%20from%202022-06-13%2013-46-20.png)

## Firefox

Open the terminal in this directory and run:

$ ./firefox.sh
## Usage
1. Download the latest release from the [release page](https://github.com/getAlby/alby-installer-linux/releases)
2. Set the execution permission with
`chmod +x ./AlbyInstaller-x86_64-linux`
3. Launch `AlbyInstaller-x86_64-linux` and click enable

## Brave
## Build
### Requirements
- NodeJS >= v16.15.0
- NPM >= 8.5.5
- Qt5
- curl

Open the terminal in this directory and run:
### Commands
```bash
npm i # Download node modules
npm run build # Build the app
npm run debug # Debug the app

$ ./brave.sh
./build.sh # Build distributable AppImage in deploy/appimage/
```

## Chromium
## Advanced usage

Open the terminal in this directory and run:

$ ./chromium.sh
### Configuration

## Help
The installer can be configured by setting the following environment variables

Please contact [email protected] for help.
VARIABLE | DESCRIPTION | VALID VALUES | default
------------- | ------------- | ------------- | -------------
DARK_MODE | Enable/Disable dark mode | 0 = light mode; 1 = dark mode | Light or, when possible, guessed from system configuration
ALBY_COMPANION_REPO | Github repository of the alby companion | owner/repo | getAlby/alby-companion-rs
ALBY_COMPANION_VERSION | Version metadata | see [Version Metadata](#version-metadata) | latest from github
ALBY_COMPANION_VERSION_FILE | Same as ALBY_COMPANION_VERSION but loaded from a file | see [Version Metadata](#version-metadata) | latest from github
ALBY_COMPANION_FILE | Local path of the archive with the compation | Path to a tar.gz file | downloaded using the provided metadata in ALBY_COMPANION_VERSION or ALBY_COMPANION_VERSION_FILE


### Version Metadata
The version metadata is a json file structured as follow

```json
{
"name":"v1.0.0", // version name
"assets":[{
"name":"something-something-OS_ARCH.tar.gz",
"browser_download_url": "https://download.url/XXXXX", // tar.gz archive
"size": 100000 // in bytes
}]
}
```

The installer expects to find a text file at `${browser_download_url}.sha256sum` containing the sha256 checksum of the archive. Both `browser_download_url` and its checksum are ignored when `ALBY_COMPANION_FILE` is used.
77 changes: 77 additions & 0 deletions build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
set -e
npm i

rm -Rf deploy/linux/build || true
rm -Rf dist || true
rm deploy/linux/alby-installer-linux/.env.sh || true

npm run build
rm -Rf deploy/linux/alby-installer-linux/assets || true
cp -Rf src/assets deploy/linux/alby-installer-linux


if [ "$ALBY_COMPANION_VERSION" != "" ]
then
if [ "$ALBY_COMPANION_REPO" = "" ];
then
ALBY_COMPANION_REPO="getAlby/alby-companion-rs"
fi

if [ "$ALBY_COMPANION_VERSION" = "latest" ];
then
curl -L "https://api.github.com/repos/$ALBY_COMPANION_REPO/releases/latest" -o deploy/linux/alby-installer-linux/version.json
else
curl -L "https://api.github.com/repos/$ALBY_COMPANION_REPO/releases/tags/$ALBY_COMPANION_VERSION" -o deploy/linux/alby-installer-linux/version.json
fi

echo "export ALBY_COMPANION_VERSION_FILE='version.json'" >> deploy/linux/alby-installer-linux/.env.sh

if [ "$ALBY_COMPANION_FILE" != "" ];
then
osarch=`echo $ALBY_COMPANION_FILE | cut -d'.' -f1`
ext=`echo $ALBY_COMPANION_FILE | cut -d'.' -f2-`
os=`echo $osarch | cut -d"-" -f1`
arch=`echo $osarch | cut -d"-" -f2`

releases=`cat deploy/linux/alby-installer-linux/version.json | grep browser_download_url | cut -d'"' -f4`
for release in $releases;
do
if [[ "$release" == *"-$os"* ]] && [[ "$release" == *"_$arch"* ]] && [[ "$release" == *"_$arch"* ]] && [[ "$release" == *".$ext" ]] ;
then
echo "Dwonload release $release"
curl -L "$release" -o deploy/linux/alby-installer-linux/$ALBY_COMPANION_FILE
echo "export ALBY_COMPANION_FILE='$ALBY_COMPANION_FILE'" >> deploy/linux/alby-installer-linux/.env.sh
fi
done

fi
fi

if [ "$DARK_MODE" != "" ];
then
echo "export DARK_MODE='$DARK_MODE'" >> deploy/linux/alby-installer-linux/.env.sh
fi

if [ "$ALBY_COMPANION_REPO" != "" ];
then
echo "export ALBY_COMPANION_REPO='$ALBY_COMPANION_REPO'" >> deploy/linux/alby-installer-linux/.env.sh
fi


npx nodegui-packer --pack dist

# Workaround nodegui-packer issue(?) rebuild appimage
rm -Rf deploy/appimage || true
mkdir -p deploy/appimage
cd deploy/appimage
cp ../linux/build/alby-installer-linux/AlbyInstaller-x86_64.AppImage AlbyInstaller-x86_64.AppImage-broken
./AlbyInstaller-x86_64.AppImage-broken --appimage-extract
rm squashfs-root/AppRun || true
rm squashfs-root/*.AppImage || true
cp ../linux/alby-installer-linux/AppRun squashfs-root/

# Repack
mkdir -p tmp
curl -L "https://github.com/AppImage/AppImageKit/releases/download/continuous/appimagetool-x86_64.AppImage" -o tmp/appimagetool
chmod +x tmp/appimagetool
./tmp/appimagetool squashfs-root/
2 changes: 2 additions & 0 deletions cli/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
alby
alby.tar.gz
31 changes: 31 additions & 0 deletions cli/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Alby installer for Linux

This installer configures Alby for your browser on Linux and allows your to connect Alby to nodes behind Tor.

## Chrome

Open the terminal in this directory and run:

$ ./chrome.sh

## Firefox

Open the terminal in this directory and run:

$ ./firefox.sh

## Brave

Open the terminal in this directory and run:

$ ./brave.sh

## Chromium

Open the terminal in this directory and run:

$ ./chromium.sh

## Help

Please contact [email protected] for help.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
1 change: 1 addition & 0 deletions deploy/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"appName":"alby-installer-linux"}
8 changes: 8 additions & 0 deletions deploy/linux/alby-installer-linux/AppRun
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/bash
echo "AppDir: $APPDIR"
cd "$APPDIR"
if [ -f ".env.sh" ];
then
source .env.sh
fi
exec ./qode ./index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[Desktop Entry]
Type=Application
Name=AlbyInstaller
Exec=AppRun %F
Icon=alby_icon
Comment=Installer for Alby Companion
Terminal=true
Categories=Utility;
Binary file added deploy/linux/alby-installer-linux/alby_icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 6 additions & 0 deletions deploy/linux/alby-installer-linux/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
const path = require("path");
// Fix so that linux resources are found correctly
// since webpack will bundle them such that the expected path is /dist from cwd
process.chdir(path.resolve(path.dirname(process.execPath)));
// Now start loading the actual bundle
require("./dist");
3 changes: 3 additions & 0 deletions deploy/linux/alby-installer-linux/qode.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"distPath": "./index.js"
}
Loading