Commit b22b34e8 authored by Aral Balkan's avatar Aral Balkan

Include dist folder (excluding binaries and nexe builds)

This is to test HTML source code integrity validation.
parent d9b650e0
node_modules
dist
dist/nexe
dist/binaries
tmp
binaries
module.exports = (request, response) => { response.end('20200823174121') }
module.exports = (request, response) => { response.end('20200710135219') }
module.exports = (request, response) => { response.end('20201211164025') }
This diff is collapsed.
#!/bin/bash
######################################################################
#
# Site.js installer for Linux (x86 and ARM) and macOS.
#
# Usage:
#
# wget -qO- https://sitejs.org/install | bash
#
# Or:
#
# curl -s https://sitejs.org/install | bash
#
# For alpha, replace bash with bash -s -- alpha
# For beta, replace bash with bash -s -- beta
#
# Copyright (c) 2019-2020 Aral Balkan.
# Released under the AGPL version 3.0 or later license.
# Made with ♥ by Small Technology Foundation (https://small-tech.org)
#
# Like this? Fund us! (https://small-tech.org/fund-us)
#
######################################################################
# Use either wget or curl to download the Site.js binary,
# whichever exists on the system (favour wget).
which wget > /dev/null
if [ $? -eq 0 ]
then
# wget exists, we’ll use that.
download="wget -q"
else
which curl > /dev/null
if [ $? -eq 0 ]
then
# curl exists, we’ll use that.
download="curl -Os"
else
echo
echo " ❌ The installation script needs either wget or curl installed to continue."
echo
exit 1
fi
fi
set -e
function cleanUp {
popd > /dev/null
rm -rf /tmp/sitejs.org
}
releaseChannel=$1
# Release is the default release type (others are alpha and beta).
if [[ "$releaseChannel" == "" ]]; then
releaseChannel='release'
fi
alphaBinaryVersion=20200823174121
alphaPackageVersion=14.3.0
alphaSourceVersion=90f059c
betaBinaryVersion=20200710135219
betaPackageVersion=14.1.1
betaSourceVersion=afde7bd
releaseBinaryVersion=20201211164025
releasePackageVersion=16.0.3
releaseSourceVersion=d712fe3
binaryVersionVariableName="${releaseChannel}BinaryVersion"
packageVersionVariableName="${releaseChannel}PackageVersion"
sourceVersionVariableName="${releaseChannel}SourceVersion"
binaryVersion=${!binaryVersionVariableName}
packageVersion=${!packageVersionVariableName}
sourceVersion=${!sourceVersionVariableName}
if [[ "$binaryVersion" == "00000000000000" ]]; then
echo " ❌ Sorry, no Site.js ${releaseChannel} binaries have been released yet."
cleanUp
exit 1
fi
echo
echo " 📡 Downloading Site.js version ${binaryVersion} (${packageVersion}/${sourceVersion})…"
# Mark alpha and beta releases prominently.
if [[ "$releaseChannel" == "alpha" ]]; then
# Writes ALPHA in large red block letters.
echo -e '\033[31m'
echo ' █████  ██  ██████  ██  ██  █████'
echo ' ██   ██ ██  ██   ██ ██  ██ ██   ██ '
echo ' ███████ ██  ██████  ███████ ███████ '
echo ' ██   ██ ██  ██      ██   ██ ██   ██ '
echo ' ██  ██ ███████ ██  ██  ██ ██  ██'
echo -e '\033[0m'
elif [[ "$releaseChannel" == "beta" ]]; then
# Writes BETA in large yellow block letters.
echo -e '\033[33m'
echo ' ██████  ███████ ████████  █████ '
echo ' ██   ██ ██         ██    ██   ██ '
echo ' ██████  █████  ██  ███████ '
echo ' ██   ██ ██     ██  ██   ██ '
echo ' ██████  ███████  ██  ██  ██'
echo -e '\033[0m'
fi
# Setup.
rm -rf /tmp/sitejs.org
mkdir -p /tmp/sitejs.org
pushd /tmp/sitejs.org > /dev/null
# Download the release.
if [[ "$OSTYPE" == "linux-gnu" || "$OSTYPE" == "linux-gnueabihf" ]]; then
cpuArchitecture=`uname -m`
if [[ "$cpuArchitecture" == "x86_64" ]]; then
# Linux on x64.
$download "https://sitejs.org/binaries/${releaseChannel}/linux/${binaryVersion}.tar.gz"
elif [[ "$cpuArchitecture" == "armv7l" || "$cpuArchitecture" == "armv6l" ]]; then
# Linux on ARM. Tested on Raspberry Pi Zero W (armv6l), 3B+ and 4B (both reporting armv7l).
$download "https://sitejs.org/binaries/${releaseChannel}/linux-arm/${binaryVersion}.tar.gz"
elif [[ "$cpuArchitecture" == "aarch64" ]]; then
# Linux on ARM64. Tested with Pinebook Pro.
$download "https://sitejs.org/binaries/${releaseChannel}/linux-arm64/${binaryVersion}.tar.gz"
else
# Error: unsupported architecture.
echo
echo " ❌ Error: this architecture is not supported on Linux (only x86_64, armv6l, and armv7l are)."
echo
cleanUp
exit 1
fi
elif [[ "$OSTYPE" == "darwin"* ]]; then
# macOS
$download "https://sitejs.org/binaries/${releaseChannel}/macos/${binaryVersion}.tar.gz"
else
# Error: Unsupported operating system.
echo
echo " ❌ Error: this operating system is not supported."
echo
cleanUp
exit 1
fi
# Install.
echo " 📦 Installing…"
gzip -d "${binaryVersion}.tar.gz"
tar -xf "${binaryVersion}.tar"
# Ensure /usr/local/bin directory exists (it does not by default on macOS)
sudo mkdir -p /usr/local/bin/
# Install the Site.js binary.
sudo mv site /usr/local/bin/
cleanUp
echo " 🎉 Done!"
echo
##########################################################################################
#
# Site.js 20201211164025 (16.0.3/d712fe3) Installer for Windows 10 (PowerShell)
#
# To use:
#
# iex(iwr -UseBasicParsing https://sitejs.org/windows).Content
#
# Copyright (c) 2019-2020 Aral Balkan.
# Released under the AGPL version 3.0 or later license.
# Made with <3 by Small Technology Foundation (https://small-tech.org)
# Like this? Fund us! (https://small-tech.org/fund-us)
#
##########################################################################################
# This is where the binary will be installed to.
$installationDirectory = 'C:\Program Files\site.js'
# The address to download the installation script from.
$installationScriptUrl = 'https://sitejs.org/install.txt'
# Installation script local file name.
$installationScriptFileName = 'install-site.js.ps1'
# The address to download the tar-gzipped archive of the Site.js binary from.
$archiveUrl = 'https://sitejs.org/binaries/release/windows/20201211164025.tar.gz'
# Emoji encodings (because Powershell is from the Stone Age and cannot handle
# emoji literals in strings)
$satelliteBytes = 240, 159, 147, 161
$packageBytes = 240, 159, 147, 166
$tadaBytes = 240, 159, 142, 137
$satelliteEmoji = [System.Text.Encoding]::UTF8.GetString($satelliteBytes)
$packageEmoji = [System.Text.Encoding]::UTF8.GetString($packageBytes)
$tadaEmoji = [System.Text.Encoding]::UTF8.GetString($tadaBytes)
$ellipsis = [char]0x2026
# Adds to the specified environment path without creating duplicates.
# Courtesy of https://gist.github.com/mkropat/c1226e0cc2ca941b23a9
# Via https://stackoverflow.com/questions/714877/setting-windows-powershell-environment-variables
function Add-EnvPath {
param(
[Parameter(Mandatory=$true)]
[string] $Path,
[ValidateSet('Machine', 'User', 'Session')]
[string] $Container = 'Session'
)
if ($Container -ne 'Session') {
$containerMapping = @{
Machine = [EnvironmentVariableTarget]::Machine
User = [EnvironmentVariableTarget]::User
}
$containerType = $containerMapping[$Container]
$persistedPaths = [Environment]::GetEnvironmentVariable('Path', $containerType) -split ';'
if ($persistedPaths -notcontains $Path) {
$persistedPaths = $persistedPaths + $Path | Where-Object { $_ }
[Environment]::SetEnvironmentVariable('Path', $persistedPaths -join ';', $containerType)
}
}
$envPaths = $env:Path -split ';'
if ($envPaths -notcontains $Path) {
$envPaths = $envPaths + $Path | Where-Object { $_ }
$env:Path = $envPaths -join ';'
}
}
# Switch to the temp folder. This is where we will always be working from
# so as not to pollute any persistent directories.
Push-Location "~\AppData\Local\Temp\"
# Check if we're running with elevated privileges, if not, start a new
# PowerShell windows with elevated privileges and continue there.
if (!([Security.Principal.WindowsPrincipal] `
[Security.Principal.WindowsIdentity]::GetCurrent() `
).IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)) {
#
# Installer is running with regular privileges.
#
#
# Installer is running with regular privileges. Start a new PowerShell session with elevated privileges.
#
Write-Output ''
Write-Output " $satelliteEmoji Downloading Site.js 20201211164025 (16.0.3/d712fe3)$ellipsis"
# We need to start a new PowerShell session with elevated privileges but if we're running in memory
# only after being downloaded by the installation command, we don't have a copy of ourselves to run.
# So download the latest version of this script and save it there so that we can run it with elevated privileges.
Invoke-WebRequest $installationScriptUrl -OutFile $installationScriptFileName
# Run the downloaded version of ourself with elevated privileges.
$currentPath = (Get-Item -Path ".\").FullName
Start-Process -Verb RunAs powershell.exe -Wait -ArgumentList "$currentPath/$installationScriptFileName"
# We're back from the privileged window. Update this window's path immediately so that
# the person can use the site command right away from the current session.
$env:Path += ";$installationDirectory"
# Recreate the output from the other window for consistency with other platforms.
Write-Output " $packageEmoji Installing$ellipsis"
Write-Output " $tadaEmoji Done! "
Write-Output ''
} else {
#
# Installer is running with elevated privileges.
#
Write-Output "`n`n`n`n`n`n"
Write-Output ' Installing Site.js using administrator privileges...'
Write-Output ''
Write-Output ' * Downloading Site.js 20201211164025 (16.0.3/d712fe3)...'
# Download the latest Site.js archive.
Invoke-WebRequest -Uri $archiveUrl -OutFile '20201211164025.tar.gz'
Write-Output ''
Write-Output ' * Extracting binary...'
# Gunzip and untar the binary.
tar -xf 20201211164025.tar.gz
Write-Output ''
Write-Output ' * Installing binary...'
# Ensure that the folder we want to copy the binary to exists.
New-Item -Force -ItemType directory -Path $installationDirectory | Out-Null
Copy-Item -Force -Path ./site.exe -Destination $installationDirectory | Out-Null
Write-Output ''
Write-Output ' * Adding to system path...'
# Persist the installation directory to the system path
# (if it doesn't already exist).
Add-EnvPath -Container Machine -Path $installationDirectory
Write-Output ''
Write-Output ' * Done!'
Write-Output ''
# Give people a chance to read the output.
Start-Sleep -Seconds 1
}
# Revert to whatever directory the person was in originally.
Pop-Location
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment