Merge branch 'main' of https://github.com/spacedriveapp/spacedrive into eng-193-add-menu-item-for-opening-settings
36
.cspell/backend_custom_words.txt
Normal file
|
@ -0,0 +1,36 @@
|
||||||
|
tauri
|
||||||
|
rustup
|
||||||
|
aarch
|
||||||
|
sdcore
|
||||||
|
dotenv
|
||||||
|
dotenvy
|
||||||
|
prismjs
|
||||||
|
actix
|
||||||
|
rtype
|
||||||
|
healthcheck
|
||||||
|
sdserver
|
||||||
|
ipfs
|
||||||
|
impls
|
||||||
|
crdt
|
||||||
|
quicktime
|
||||||
|
creationdate
|
||||||
|
imageops
|
||||||
|
thumbnailer
|
||||||
|
HEXLOWER
|
||||||
|
chrono
|
||||||
|
walkdir
|
||||||
|
thiserror
|
||||||
|
thumbstrip
|
||||||
|
repr
|
||||||
|
Deque
|
||||||
|
oneshot
|
||||||
|
sdlibrary
|
||||||
|
sdconfig
|
||||||
|
DOTFILE
|
||||||
|
sysinfo
|
||||||
|
initialising
|
||||||
|
struct
|
||||||
|
UHLC
|
||||||
|
CRDTs
|
||||||
|
PRRTT
|
||||||
|
filesystems
|
84
.cspell/frontend_custom_words.txt
Normal file
|
@ -0,0 +1,84 @@
|
||||||
|
pnpm
|
||||||
|
titlebar
|
||||||
|
consts
|
||||||
|
pallete
|
||||||
|
unlisten
|
||||||
|
svgr
|
||||||
|
middlewares
|
||||||
|
clsx
|
||||||
|
SDWEB
|
||||||
|
tryghost
|
||||||
|
tsparticles
|
||||||
|
Opencollective
|
||||||
|
Waitlist
|
||||||
|
heroicons
|
||||||
|
roadmap
|
||||||
|
semibold
|
||||||
|
noreferer
|
||||||
|
Rescan
|
||||||
|
subpackage
|
||||||
|
photoslibrary
|
||||||
|
fontsource
|
||||||
|
audiomp
|
||||||
|
audioogg
|
||||||
|
audiowav
|
||||||
|
browserslist
|
||||||
|
bsconfig
|
||||||
|
cheader
|
||||||
|
compodoc
|
||||||
|
cssmap
|
||||||
|
dartlang
|
||||||
|
dockerdebug
|
||||||
|
folderlight
|
||||||
|
folderopen
|
||||||
|
fontotf
|
||||||
|
fontttf
|
||||||
|
fontwoff
|
||||||
|
gopackage
|
||||||
|
haml
|
||||||
|
imagegif
|
||||||
|
imageico
|
||||||
|
imagejpg
|
||||||
|
imagepng
|
||||||
|
ipynb
|
||||||
|
jsmap
|
||||||
|
lighteditorconfig
|
||||||
|
nestjscontroller
|
||||||
|
nestjs
|
||||||
|
nestjsdecorator
|
||||||
|
nestjsfilter
|
||||||
|
nestjsguard
|
||||||
|
nestjsmodule
|
||||||
|
nestjsservice
|
||||||
|
npmlock
|
||||||
|
nuxt
|
||||||
|
opengl
|
||||||
|
photoshop
|
||||||
|
postcssconfig
|
||||||
|
powershelldata
|
||||||
|
reactjs
|
||||||
|
rjson
|
||||||
|
symfony
|
||||||
|
testjs
|
||||||
|
tmpl
|
||||||
|
typescriptdef
|
||||||
|
windi
|
||||||
|
yarnerror
|
||||||
|
unlisten
|
||||||
|
imagewebp
|
||||||
|
powershellmodule
|
||||||
|
reactts
|
||||||
|
testts
|
||||||
|
zustand
|
||||||
|
overscan
|
||||||
|
webp
|
||||||
|
headlessui
|
||||||
|
falsey
|
||||||
|
nums
|
||||||
|
lacie
|
||||||
|
classname
|
||||||
|
wunsub
|
||||||
|
immer
|
||||||
|
tada
|
||||||
|
moti
|
||||||
|
pressable
|
42
.cspell/project_words.txt
Normal file
|
@ -0,0 +1,42 @@
|
||||||
|
spacedrive
|
||||||
|
spacedriveapp
|
||||||
|
vdfs
|
||||||
|
haoyuan
|
||||||
|
brendonovich
|
||||||
|
codegen
|
||||||
|
elon
|
||||||
|
deel
|
||||||
|
haden
|
||||||
|
akar
|
||||||
|
benja
|
||||||
|
haris
|
||||||
|
mehrzad
|
||||||
|
OSSC
|
||||||
|
josephjacks
|
||||||
|
rauch
|
||||||
|
ravikant
|
||||||
|
neha
|
||||||
|
narkhede
|
||||||
|
allred
|
||||||
|
lütke
|
||||||
|
tobiaslutke
|
||||||
|
justinhoffman
|
||||||
|
rywalker
|
||||||
|
zacharysmith
|
||||||
|
sanjay
|
||||||
|
poonen
|
||||||
|
mytton
|
||||||
|
davidmytton
|
||||||
|
richelsen
|
||||||
|
lesterlee
|
||||||
|
alluxio
|
||||||
|
augusto
|
||||||
|
marietti
|
||||||
|
vijay
|
||||||
|
sharma
|
||||||
|
naveen
|
||||||
|
noco
|
||||||
|
rspc
|
||||||
|
rspcws
|
||||||
|
stringly
|
||||||
|
specta
|
7
.github/CODEOWNERS
vendored
|
@ -8,9 +8,11 @@
|
||||||
|
|
||||||
# frontend apps (Rust bridges and tech functionality -- no real visual implications)
|
# frontend apps (Rust bridges and tech functionality -- no real visual implications)
|
||||||
/apps/desktop/ @jamiepine @Brendonovich @oscartbeaumont
|
/apps/desktop/ @jamiepine @Brendonovich @oscartbeaumont
|
||||||
/apps/mobile/ @jamiepine @Brendonovich @oscartbeaumont
|
|
||||||
/apps/web/ @jamiepine @maxichrome
|
/apps/web/ @jamiepine @maxichrome
|
||||||
|
|
||||||
|
# mobile
|
||||||
|
/apps/mobile/ @jamiepine @Brendonovich @oscartbeaumont @utkubakir
|
||||||
|
|
||||||
# core logic
|
# core logic
|
||||||
/core/ @jamiepine @Brendonovich @oscartbeaumont
|
/core/ @jamiepine @Brendonovich @oscartbeaumont
|
||||||
/packages/macos/ @jamiepine @Brendonovich @oscartbeaumont
|
/packages/macos/ @jamiepine @Brendonovich @oscartbeaumont
|
||||||
|
@ -22,8 +24,9 @@
|
||||||
/apps/landing/ @jamiepine @maxichrome
|
/apps/landing/ @jamiepine @maxichrome
|
||||||
|
|
||||||
# UI
|
# UI
|
||||||
/packages/interface/ @jamiepine @maxichrome
|
/packages/interface/ @jamiepine @maxichrome @utkubakir
|
||||||
/packages/ui/ @jamiepine @maxichrome
|
/packages/ui/ @jamiepine @maxichrome
|
||||||
|
/packages/assets/ @jamiepine @utkubakir
|
||||||
|
|
||||||
# base config files
|
# base config files
|
||||||
/* @jamiepine
|
/* @jamiepine
|
||||||
|
|
189
.github/scripts/setup-system.ps1
vendored
|
@ -1,10 +1,181 @@
|
||||||
Write-Host "This script is currently being used by CI and will need some more work before anyone can use it like the 'setup-system.sh' script for macOS and Linux!"
|
# Get ci parameter to check if running with ci
|
||||||
|
param(
|
||||||
|
[Parameter()]
|
||||||
|
[Switch]$ci
|
||||||
|
)
|
||||||
|
|
||||||
$VCINSTALLDIR = $(& "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe" -latest -property installationPath)
|
# Get temp folder
|
||||||
Add-Content $env:GITHUB_ENV "LIBCLANG_PATH=${VCINSTALLDIR}\VC\Tools\LLVM\x64\bin`n"
|
$temp = [System.IO.Path]::GetTempPath()
|
||||||
Invoke-WebRequest "https://www.gyan.dev/ffmpeg/builds/ffmpeg-release-full-shared.7z" -OutFile ffmpeg-release-full-shared.7z
|
|
||||||
7z x ffmpeg-release-full-shared.7z
|
# Get current running dir
|
||||||
mkdir ffmpeg
|
$currentLocation = $((Get-Location).path)
|
||||||
mv ffmpeg-*/* ffmpeg/
|
|
||||||
Add-Content $env:GITHUB_ENV "FFMPEG_DIR=${pwd}\ffmpeg`n"
|
# Check to see if a command exists (eg if an app is installed)
|
||||||
Add-Content $env:GITHUB_PATH "${pwd}\ffmpeg\bin`n"
|
Function CheckCommand {
|
||||||
|
|
||||||
|
Param ($command)
|
||||||
|
|
||||||
|
$oldPreference = $ErrorActionPreference
|
||||||
|
|
||||||
|
$ErrorActionPreference = 'stop'
|
||||||
|
|
||||||
|
try { if (Get-Command $command) { RETURN $true } }
|
||||||
|
|
||||||
|
Catch { RETURN $false }
|
||||||
|
|
||||||
|
Finally { $ErrorActionPreference = $oldPreference }
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
Write-Host "Spacedrive Development Environment Setup" -ForegroundColor Magenta
|
||||||
|
Write-Host @"
|
||||||
|
|
||||||
|
To set up your machine for Spacedrive development, this script will do the following:
|
||||||
|
|
||||||
|
1) Check for Rust and Cargo
|
||||||
|
|
||||||
|
2) Install pnpm (if not installed)
|
||||||
|
|
||||||
|
3) Install the latest version of Node.js using pnpm
|
||||||
|
|
||||||
|
4) Install LLVM (compiler for ffmpeg-rust)
|
||||||
|
|
||||||
|
4) Download ffmpeg and set as an environment variable
|
||||||
|
|
||||||
|
"@
|
||||||
|
|
||||||
|
Write-Host "Checking for Rust and Cargo..." -ForegroundColor Yellow
|
||||||
|
Start-Sleep -Milliseconds 150
|
||||||
|
|
||||||
|
$cargoCheck = CheckCommand cargo
|
||||||
|
|
||||||
|
if ($cargoCheck -eq $false) {
|
||||||
|
Write-Host @"
|
||||||
|
Cargo is not installed.
|
||||||
|
|
||||||
|
To use Spacedrive on Windows, Cargo needs to be installed.
|
||||||
|
The Visual Studio C++ Build tools are also required.
|
||||||
|
Instructions can be found here:
|
||||||
|
|
||||||
|
https://tauri.app/v1/guides/getting-started/prerequisites/#setting-up-windows
|
||||||
|
|
||||||
|
Once you have installed Cargo, re-run this script.
|
||||||
|
|
||||||
|
"@
|
||||||
|
Exit
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
Write-Host "Cargo is installed."
|
||||||
|
}
|
||||||
|
|
||||||
|
Write-Host
|
||||||
|
Write-Host "Checking for pnpm..." -ForegroundColor Yellow
|
||||||
|
Start-Sleep -Milliseconds 150
|
||||||
|
|
||||||
|
$pnpmCheck = CheckCommand pnpm
|
||||||
|
if ($pnpmCheck -eq $false) {
|
||||||
|
|
||||||
|
Write-Host "pnpm is not installed. Installing now."
|
||||||
|
Write-Host "Running the pnpm installer..."
|
||||||
|
|
||||||
|
#pnpm installer taken from https://pnpm.io
|
||||||
|
Invoke-WebRequest https://get.pnpm.io/install.ps1 -useb | Invoke-Expression
|
||||||
|
|
||||||
|
# Reset the PATH env variables to make sure pnpm is accessible
|
||||||
|
$env:PNPM_HOME = [System.Environment]::GetEnvironmentVariable("PNPM_HOME", "User")
|
||||||
|
$env:Path = [System.Environment]::ExpandEnvironmentVariables([System.Environment]::GetEnvironmentVariable("Path", "User"))
|
||||||
|
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
Write-Host "pnpm is installed."
|
||||||
|
}
|
||||||
|
|
||||||
|
# A GitHub Action takes care of installing node, so this isn't necessary if running in the ci.
|
||||||
|
if ($ci -eq $True) {
|
||||||
|
Write-Host
|
||||||
|
Write-Host "Running with Ci, skipping Node install." -ForegroundColor Yellow
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
Write-Host
|
||||||
|
Write-Host "Using pnpm to install the latest version of Node..." -ForegroundColor Yellow
|
||||||
|
Write-Host "This will set your global Node version to the latest!"
|
||||||
|
Start-Sleep -Milliseconds 150
|
||||||
|
|
||||||
|
# Runs the pnpm command to use the latest version of node, which also installs it
|
||||||
|
Start-Process -Wait -FilePath "pnpm" -ArgumentList "env use --global latest" -PassThru -Verb runAs
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# The ci has LLVM installed already, so we instead just set the env variables.
|
||||||
|
if ($ci -eq $True) {
|
||||||
|
Write-Host
|
||||||
|
Write-Host "Running with Ci, skipping LLVM install." -ForegroundColor Yellow
|
||||||
|
|
||||||
|
$VCINSTALLDIR = $(& "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe" -latest -property installationPath)
|
||||||
|
Add-Content $env:GITHUB_ENV "LIBCLANG_PATH=${VCINSTALLDIR}\VC\Tools\LLVM\x64\bin`n"
|
||||||
|
|
||||||
|
} else {
|
||||||
|
Write-Host
|
||||||
|
Write-Host "Downloading the LLVM installer..." -ForegroundColor Yellow
|
||||||
|
# Downloads latest installer for LLVM
|
||||||
|
$filenamePattern = "*-win64.exe"
|
||||||
|
$releasesUri = "https://api.github.com/repos/llvm/llvm-project/releases/latest"
|
||||||
|
$downloadUri = ((Invoke-RestMethod -Method GET -Uri $releasesUri).assets | Where-Object name -like $filenamePattern ).browser_download_url
|
||||||
|
|
||||||
|
Start-BitsTransfer -Source $downloadUri -Destination "$temp\llvm.exe"
|
||||||
|
|
||||||
|
Write-Host
|
||||||
|
Write-Host "Running the LLVM installer..." -ForegroundColor Yellow
|
||||||
|
Write-Host "Please follow the instructions to install LLVM."
|
||||||
|
Write-Host "Ensure you add LLVM to your PATH."
|
||||||
|
|
||||||
|
Start-Process "$temp\llvm.exe" -Wait
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Write-Host
|
||||||
|
Write-Host "Downloading the latest ffmpeg build..." -ForegroundColor Yellow
|
||||||
|
|
||||||
|
# Downloads the latest shared build of ffmpeg from GitHub
|
||||||
|
# $filenamePattern = "*-full_build-shared.zip"
|
||||||
|
# $releasesUri = "https://api.github.com/repos/GyanD/codexffmpeg/releases/latest"
|
||||||
|
$downloadUri = "https://github.com/GyanD/codexffmpeg/releases/download/5.0.1/ffmpeg-5.0.1-full_build-shared.zip" # ((Invoke-RestMethod -Method GET -Uri $releasesUri).assets | Where-Object name -like $filenamePattern ).browser_download_url
|
||||||
|
$filename = "ffmpeg-5.0.1-full_build-shared.zip" # ((Invoke-RestMethod -Method GET -Uri $releasesUri).assets | Where-Object name -like $filenamePattern ).name
|
||||||
|
$remove = ".zip"
|
||||||
|
$foldername = $filename.Substring(0, ($filename.Length - $remove.Length))
|
||||||
|
|
||||||
|
Start-BitsTransfer -Source $downloadUri -Destination "$temp\ffmpeg.zip"
|
||||||
|
|
||||||
|
Write-Host
|
||||||
|
Write-Host "Expanding ffmpeg zip..." -ForegroundColor Yellow
|
||||||
|
|
||||||
|
Expand-Archive "$temp\ffmpeg.zip" $HOME -ErrorAction SilentlyContinue
|
||||||
|
|
||||||
|
Remove-Item "$temp\ffmpeg.zip"
|
||||||
|
|
||||||
|
Write-Host
|
||||||
|
Write-Host "Setting environment variables..." -ForegroundColor Yellow
|
||||||
|
|
||||||
|
if ($ci -eq $True) {
|
||||||
|
# If running in ci, we need to use GITHUB_ENV and GITHUB_PATH instead of the normal PATH env variables, so we set them here
|
||||||
|
Add-Content $env:GITHUB_ENV "FFMPEG_DIR=$HOME\$foldername`n"
|
||||||
|
Add-Content $env:GITHUB_PATH "$HOME\$foldername\bin`n"
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
# Sets environment variable for ffmpeg
|
||||||
|
[System.Environment]::SetEnvironmentVariable('FFMPEG_DIR', "$HOME\$foldername", [System.EnvironmentVariableTarget]::User)
|
||||||
|
}
|
||||||
|
|
||||||
|
Write-Host
|
||||||
|
Write-Host "Copying Required .dll files..." -ForegroundColor Yellow
|
||||||
|
|
||||||
|
# Create target\debug folder, continue if already exists
|
||||||
|
New-Item -Path $currentLocation\target\debug -ItemType Directory -ErrorAction SilentlyContinue
|
||||||
|
|
||||||
|
# Copies all .dll required for rust-ffmpeg to target\debug folder
|
||||||
|
Get-ChildItem "$HOME\$foldername\bin" -recurse -filter *.dll | Copy-Item -Destination "$currentLocation\target\debug"
|
||||||
|
|
||||||
|
Write-Host
|
||||||
|
Write-Host "Your machine has been setup for Spacedrive development!"
|
||||||
|
|
70
.github/scripts/setup-system.sh
vendored
|
@ -2,17 +2,23 @@
|
||||||
|
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
|
script_failure() {
|
||||||
|
echo "An error occurred while performing the task on line $1" >&2
|
||||||
|
echo "Setup for Spacedrive development failed" >&2
|
||||||
|
}
|
||||||
|
|
||||||
|
trap 'script_failure $LINENO' ERR
|
||||||
|
|
||||||
echo "Setting up your system for Spacedrive development!"
|
echo "Setting up your system for Spacedrive development!"
|
||||||
|
|
||||||
which cargo &> /dev/null
|
if ! which cargo &> /dev/null; then
|
||||||
if [ $? -eq 1 ]; then
|
|
||||||
echo "Rust was not detected on your system. Ensure the 'rustc' and 'cargo' binaries are in your \$PATH."
|
echo "Rust was not detected on your system. Ensure the 'rustc' and 'cargo' binaries are in your \$PATH."
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "${SPACEDRIVE_SKIP_PNPM_CHECK:-}" != "true" ]; then
|
if [ "${SPACEDRIVE_SKIP_PNPM_CHECK:-}" != "true" ]; then
|
||||||
which pnpm &> /dev/null
|
|
||||||
if [ $? -eq 1 ]; then
|
if ! which pnpm &> /dev/null; then
|
||||||
echo "PNPM was not detected on your system. Ensure the 'pnpm' command is in your \$PATH. You are not able to use Yarn or NPM."
|
echo "PNPM was not detected on your system. Ensure the 'pnpm' command is in your \$PATH. You are not able to use Yarn or NPM."
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
@ -20,11 +26,52 @@ else
|
||||||
echo "Skipped PNPM check!"
|
echo "Skipped PNPM check!"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [ "$1" == "mobile" ]; then
|
||||||
|
echo "Setting up for mobile development!"
|
||||||
|
|
||||||
|
# IOS targets
|
||||||
|
if [[ "$OSTYPE" == "darwin"* ]]; then
|
||||||
|
echo "Installing IOS Rust targets..."
|
||||||
|
|
||||||
|
if ! /usr/bin/xcodebuild -version; then
|
||||||
|
echo "Xcode is not installed! Ensure you have it installed!"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
rustup target add aarch64-apple-ios
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Android requires python
|
||||||
|
if ! command -v python3 &> /dev/null
|
||||||
|
then
|
||||||
|
echo "Python3 could not be found. This is required for Android mobile development!"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Android targets
|
||||||
|
echo "Installing Android Rust targets..."
|
||||||
|
rustup target add armv7-linux-androideabi # for arm
|
||||||
|
rustup target add i686-linux-android # for x86
|
||||||
|
rustup target add aarch64-linux-android # for arm64
|
||||||
|
rustup target add x86_64-linux-android # for x86_64
|
||||||
|
rustup target add x86_64-unknown-linux-gnu # for linux-x86-64
|
||||||
|
rustup target add x86_64-apple-darwin # for darwin x86_64 (if you have an Intel MacOS)
|
||||||
|
rustup target add aarch64-apple-darwin # for darwin arm64 (if you have a M1 MacOS)
|
||||||
|
rustup target add x86_64-pc-windows-gnu # for win32-x86-64-gnu
|
||||||
|
rustup target add x86_64-pc-windows-msvc # for win32-x86-64-msvc
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
if [[ "$OSTYPE" == "linux-gnu"* ]]; then
|
if [[ "$OSTYPE" == "linux-gnu"* ]]; then
|
||||||
if which apt-get &> /dev/null; then
|
if which apt-get &> /dev/null; then
|
||||||
echo "Detected 'apt' based distro!"
|
echo "Detected 'apt' based distro!"
|
||||||
DEBIAN_TAURI_DEPS="libwebkit2gtk-4.0-dev build-essential curl wget libssl-dev libgtk-3-dev libappindicator3-dev librsvg2-dev" # Tauri dependencies
|
|
||||||
DEBIAN_FFMPEG_DEPS="libavcodec-dev libavdevice-dev libavfilter-dev libavformat-dev libavresample-dev libavutil-dev libswscale-dev libswresample-dev ffmpeg" # FFMPEG dependencies
|
if [[ "$(lsb_release -si)" == "Pop" ]]; then
|
||||||
|
DEBIAN_FFMPEG_DEPS="libavcodec-dev libavdevice-dev libavfilter-dev libavformat-dev libavutil-dev libswscale-dev libswresample-dev ffmpeg" # FFMPEG dependencies
|
||||||
|
else
|
||||||
|
DEBIAN_FFMPEG_DEPS="libavcodec-dev libavdevice-dev libavfilter-dev libavformat-dev libavresample-dev libavutil-dev libswscale-dev libswresample-dev ffmpeg" # FFMPEG dependencies
|
||||||
|
fi
|
||||||
|
DEBIAN_TAURI_DEPS="libwebkit2gtk-4.0-dev build-essential curl wget libssl-dev libgtk-3-dev libayatana-appindicator3-dev librsvg2-dev" # Tauri dependencies
|
||||||
DEBIAN_BINDGEN_DEPS="pkg-config clang" # Bindgen dependencies - it's used by a dependency of Spacedrive
|
DEBIAN_BINDGEN_DEPS="pkg-config clang" # Bindgen dependencies - it's used by a dependency of Spacedrive
|
||||||
|
|
||||||
sudo apt-get -y update
|
sudo apt-get -y update
|
||||||
|
@ -53,9 +100,16 @@ if [[ "$OSTYPE" == "linux-gnu"* ]]; then
|
||||||
|
|
||||||
echo "Your machine has been setup for Spacedrive development!"
|
echo "Your machine has been setup for Spacedrive development!"
|
||||||
elif [[ "$OSTYPE" == "darwin"* ]]; then
|
elif [[ "$OSTYPE" == "darwin"* ]]; then
|
||||||
brew install ffmpeg
|
if ! brew tap | grep spacedriveapp/deps > /dev/null; then
|
||||||
|
brew tap-new spacedriveapp/deps > /dev/null
|
||||||
|
fi
|
||||||
|
brew extract --force --version 5.0.1 ffmpeg spacedriveapp/deps > /dev/null
|
||||||
|
brew unlink ffmpeg &> /dev/null || true
|
||||||
|
brew install spacedriveapp/deps/ffmpeg@5.0.1 &> /dev/null
|
||||||
|
|
||||||
|
echo "ffmpeg v5.0.1 has been installed and is now being used on your system."
|
||||||
else
|
else
|
||||||
echo "Your OS '$OSTYPE' is not supported by this script. We would welcome a PR or some help adding your OS to this script. https://github.com/spacedriveapp/spacedrive/issues"
|
echo "Your OS '$OSTYPE' is not supported by this script. We would welcome a PR or some help adding your OS to this script. https://github.com/spacedriveapp/spacedrive/issues"
|
||||||
exit 1
|
exit 1
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
20
.github/workflows/ci.yml
vendored
|
@ -36,7 +36,7 @@ jobs:
|
||||||
id: pnpm-cache
|
id: pnpm-cache
|
||||||
run: |
|
run: |
|
||||||
echo "::set-output name=pnpm_cache_dir::$(pnpm store path)"
|
echo "::set-output name=pnpm_cache_dir::$(pnpm store path)"
|
||||||
|
|
||||||
- uses: actions/cache@v3
|
- uses: actions/cache@v3
|
||||||
name: Setup pnpm cache
|
name: Setup pnpm cache
|
||||||
with:
|
with:
|
||||||
|
@ -44,7 +44,7 @@ jobs:
|
||||||
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
|
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
|
||||||
restore-keys: |
|
restore-keys: |
|
||||||
${{ runner.os }}-pnpm-store-
|
${{ runner.os }}-pnpm-store-
|
||||||
|
|
||||||
- name: Install pnpm dependencies
|
- name: Install pnpm dependencies
|
||||||
run: pnpm --frozen-lockfile i
|
run: pnpm --frozen-lockfile i
|
||||||
|
|
||||||
|
@ -81,7 +81,7 @@ jobs:
|
||||||
with:
|
with:
|
||||||
version: 7
|
version: 7
|
||||||
run_install: false
|
run_install: false
|
||||||
|
|
||||||
- name: Install Rust stable
|
- name: Install Rust stable
|
||||||
uses: actions-rs/toolchain@v1
|
uses: actions-rs/toolchain@v1
|
||||||
with:
|
with:
|
||||||
|
@ -89,7 +89,7 @@ jobs:
|
||||||
profile: minimal
|
profile: minimal
|
||||||
override: true
|
override: true
|
||||||
components: rustfmt, rust-src
|
components: rustfmt, rust-src
|
||||||
|
|
||||||
- name: Cache Rust Dependencies
|
- name: Cache Rust Dependencies
|
||||||
uses: Swatinem/rust-cache@v1
|
uses: Swatinem/rust-cache@v1
|
||||||
with:
|
with:
|
||||||
|
@ -98,10 +98,10 @@ jobs:
|
||||||
- name: Run 'setup-system.sh' script
|
- name: Run 'setup-system.sh' script
|
||||||
if: matrix.platform == 'ubuntu-latest' || matrix.platform == 'macos-latest'
|
if: matrix.platform == 'ubuntu-latest' || matrix.platform == 'macos-latest'
|
||||||
run: ./.github/scripts/setup-system.sh
|
run: ./.github/scripts/setup-system.sh
|
||||||
|
|
||||||
- name: Run 'setup-system.ps1' script
|
- name: Run 'setup-system.ps1' script
|
||||||
if: matrix.platform == 'windows-latest'
|
if: matrix.platform == 'windows-latest'
|
||||||
run: ./.github/scripts/setup-system.ps1
|
run: ./.github/scripts/setup-system.ps1 -ci
|
||||||
|
|
||||||
- name: Get pnpm store directory
|
- name: Get pnpm store directory
|
||||||
id: pnpm-cache
|
id: pnpm-cache
|
||||||
|
@ -116,7 +116,7 @@ jobs:
|
||||||
${{ runner.os }}-pnpm-store-
|
${{ runner.os }}-pnpm-store-
|
||||||
- name: Install pnpm dependencies
|
- name: Install pnpm dependencies
|
||||||
run: pnpm --frozen-lockfile i
|
run: pnpm --frozen-lockfile i
|
||||||
|
|
||||||
- name: Cache Prisma codegen
|
- name: Cache Prisma codegen
|
||||||
id: cache-prisma
|
id: cache-prisma
|
||||||
uses: actions/cache@v3
|
uses: actions/cache@v3
|
||||||
|
@ -127,13 +127,13 @@ jobs:
|
||||||
- name: Generate Prisma client
|
- name: Generate Prisma client
|
||||||
working-directory: core
|
working-directory: core
|
||||||
if: steps.cache-prisma.outputs.cache-hit != 'true'
|
if: steps.cache-prisma.outputs.cache-hit != 'true'
|
||||||
run: cargo run --frozen -p prisma-cli --release -- generate
|
run: cargo run -p prisma-cli --release -- generate
|
||||||
|
|
||||||
- name: Cargo fetch
|
- name: Cargo fetch
|
||||||
run: cargo fetch
|
run: cargo fetch
|
||||||
|
|
||||||
- name: Check Core
|
- name: Check Core
|
||||||
run: cargo check --frozen -p sdcore --release
|
run: cargo check -p sdcore --release
|
||||||
|
|
||||||
- name: Bundle Desktop
|
- name: Bundle Desktop
|
||||||
run: pnpm desktop tauri build
|
run: pnpm desktop tauri build
|
||||||
|
@ -141,7 +141,7 @@ jobs:
|
||||||
- name: Build Server
|
- name: Build Server
|
||||||
if: matrix.platform == 'ubuntu-latest'
|
if: matrix.platform == 'ubuntu-latest'
|
||||||
run: |
|
run: |
|
||||||
cargo build --frozen -p server --release
|
cargo build -p server --release
|
||||||
cp ./target/release/server ./apps/server/server
|
cp ./target/release/server ./apps/server/server
|
||||||
|
|
||||||
- name: Determine image name & tag
|
- name: Determine image name & tag
|
||||||
|
|
6
.github/workflows/clippy.yml
vendored
|
@ -47,10 +47,10 @@ jobs:
|
||||||
- name: Generate Prisma client
|
- name: Generate Prisma client
|
||||||
working-directory: core
|
working-directory: core
|
||||||
if: steps.cache-prisma.outputs.cache-hit != 'true'
|
if: steps.cache-prisma.outputs.cache-hit != 'true'
|
||||||
run: cargo run --frozen -p prisma-cli --release -- generate
|
run: cargo run -p prisma-cli --release -- generate
|
||||||
|
|
||||||
- name: Run Clippy
|
- name: Run Clippy
|
||||||
uses: actions-rs/clippy-check@v1
|
uses: actions-rs/clippy-check@v1
|
||||||
with:
|
with:
|
||||||
token: ${{ secrets.GITHUB_TOKEN }}
|
token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
args: --all-features
|
args: --all-features
|
||||||
|
|
2
.github/workflows/org-readme.yml
vendored
|
@ -18,7 +18,7 @@ jobs:
|
||||||
- name: Update README
|
- name: Update README
|
||||||
uses: dmnemec/copy_file_to_another_repo_action@main
|
uses: dmnemec/copy_file_to_another_repo_action@main
|
||||||
env:
|
env:
|
||||||
API_TOKEN_GITHUB: ${{ secrets.REPOS_PAT }}
|
API_TOKEN_GITHUB: ${{ secrets.SD_BOT_PAT }}
|
||||||
with:
|
with:
|
||||||
source_file: 'README.md'
|
source_file: 'README.md'
|
||||||
destination_repo: 'spacedriveapp/.github'
|
destination_repo: 'spacedriveapp/.github'
|
||||||
|
|
4
.gitignore
vendored
|
@ -1,6 +1,7 @@
|
||||||
node_modules
|
node_modules
|
||||||
.next
|
.next
|
||||||
dist
|
dist
|
||||||
|
!apps/desktop/dist
|
||||||
*.tsbuildinfo
|
*.tsbuildinfo
|
||||||
package-lock.json
|
package-lock.json
|
||||||
.eslintcache
|
.eslintcache
|
||||||
|
@ -15,7 +16,6 @@ storybook-static/
|
||||||
cache
|
cache
|
||||||
.env
|
.env
|
||||||
vendor/
|
vendor/
|
||||||
dist
|
|
||||||
data
|
data
|
||||||
node_modules
|
node_modules
|
||||||
packages/turbo-server/data/
|
packages/turbo-server/data/
|
||||||
|
@ -61,4 +61,4 @@ todos.md
|
||||||
examples/*/*.lock
|
examples/*/*.lock
|
||||||
/target
|
/target
|
||||||
|
|
||||||
/sdserver_data
|
/sdserver_data
|
||||||
|
|
1
.vscode/settings.json
vendored
|
@ -12,6 +12,7 @@
|
||||||
"ipfs",
|
"ipfs",
|
||||||
"Keepsafe",
|
"Keepsafe",
|
||||||
"nodestate",
|
"nodestate",
|
||||||
|
"overscan",
|
||||||
"pathctx",
|
"pathctx",
|
||||||
"prismjs",
|
"prismjs",
|
||||||
"proptype",
|
"proptype",
|
||||||
|
|
|
@ -37,27 +37,43 @@ This project uses [Cargo](https://doc.rust-lang.org/cargo/getting-started/instal
|
||||||
|
|
||||||
> Note: MacOS M1 users should choose the customize option in the rustup init script and enter `x86_64-apple-darwin` as the default host triple instead of the default `aarch64-apple-darwin`
|
> Note: MacOS M1 users should choose the customize option in the rustup init script and enter `x86_64-apple-darwin` as the default host triple instead of the default `aarch64-apple-darwin`
|
||||||
|
|
||||||
- `$ git clone https://github.com/spacedriveapp/spacedrive`
|
- `git clone https://github.com/spacedriveapp/spacedrive`
|
||||||
- `$ cd spacedrive`
|
- `cd spacedrive`
|
||||||
- For Linux or MacOS users run: `./.github/scripts/setup-system.sh`
|
- For Linux or MacOS users run: `./.github/scripts/setup-system.sh`
|
||||||
- This will install FFMPEG and any other required dependencies for Spacedrive to build.
|
- This will install FFMPEG and any other required dependencies for Spacedrive to build.
|
||||||
- `$ pnpm i`
|
- For Windows users run using PowerShell: `.\.github\scripts\setup-system.ps1`
|
||||||
- `$ pnpm prep` - Runs all necessary codegen & builds required dependencies.
|
- This will install pnpm, LLVM, FFMPEG and any other required dependencies for Spacedrive to build.
|
||||||
|
- Ensure you run it like documented above as it expects it is executed from the root of the repository.
|
||||||
|
- `pnpm i`
|
||||||
|
- `pnpm prep` - Runs all necessary codegen & builds required dependencies.
|
||||||
|
|
||||||
To quickly run only the desktop app after `prep` you can use:
|
To quickly run only the desktop app after `prep` you can use:
|
||||||
|
|
||||||
- `$ pnpm desktop dev`
|
- `pnpm desktop dev`
|
||||||
|
|
||||||
To run the landing page
|
To run the landing page
|
||||||
|
|
||||||
- `$ pnpm web dev` - runs the web app for the embed
|
- `pnpm web dev` - runs the web app for the embed
|
||||||
- `$ pnpm landing dev`
|
- `pnpm landing dev`
|
||||||
|
|
||||||
If you are having issues ensure you are using the following versions of Rust and Node:
|
If you are having issues ensure you are using the following versions of Rust and Node:
|
||||||
|
|
||||||
- Rust version: **1.60.0**
|
- Rust version: **1.63.0**
|
||||||
- Node version: **17**
|
- Node version: **17**
|
||||||
|
|
||||||
|
##### Mobile app
|
||||||
|
|
||||||
|
To run mobile app
|
||||||
|
|
||||||
|
- Install [Android Studio](https://developer.android.com/studio) for Android and [Xcode](https://apps.apple.com/au/app/xcode/id497799835) for IOS development
|
||||||
|
- `./.github/scripts/setup-system.sh mobile`
|
||||||
|
- The should setup most of the dependencies for the mobile app to build.
|
||||||
|
- You must also ensure [you must have NDK 24.0.8215888 and CMake](https://developer.android.com/studio/projects/install-ndk#default-version) in Android Studio
|
||||||
|
- `cd apps/mobile && pnpm i` - This is a separate workspace, you need to do this!
|
||||||
|
- `pnpm android` - runs on Android Emulator
|
||||||
|
- `pnpm ios` - runs on iOS Emulator
|
||||||
|
- `pnpm dev` - For already bundled app - This is only temporarily supported. The final app will require the Spacedrive Rust code which isn't included in Expo Go.
|
||||||
|
|
||||||
### Pull Request
|
### Pull Request
|
||||||
|
|
||||||
When you're finished with the changes, create a pull request, also known as a PR.
|
When you're finished with the changes, create a pull request, also known as a PR.
|
||||||
|
@ -76,6 +92,16 @@ Congratulations :tada::tada: The Spacedrive team thanks you :sparkles:.
|
||||||
|
|
||||||
Once your PR is merged, your contributions will be included in the next release of the application.
|
Once your PR is merged, your contributions will be included in the next release of the application.
|
||||||
|
|
||||||
|
### Common Errors
|
||||||
|
|
||||||
|
#### `xcrun: error: unable to find utility "xctest", not a developer tool or in PATH`
|
||||||
|
|
||||||
|
You either don't have Xcode installed, or don't have the Xcode command line tools in your `PATH`.
|
||||||
|
|
||||||
|
- Install XCode from the Mac App Store
|
||||||
|
- Run `xcode-select -s /Applications/Xcode.app/Contents/Developer`.
|
||||||
|
This will use Xcode's developer tools instead of macOS's default tools.
|
||||||
|
|
||||||
### Credits
|
### Credits
|
||||||
|
|
||||||
This CONTRIBUTING.md file was modelled after the [github/docs CONTRIBUTING.md](https://github.com/github/docs/blob/main/CONTRIBUTING.md) file, and we thank the original author.
|
This CONTRIBUTING.md file was modelled after the [github/docs CONTRIBUTING.md](https://github.com/github/docs/blob/main/CONTRIBUTING.md) file, and we thank the original author.
|
||||||
|
|
1994
Cargo.lock
generated
|
@ -1,8 +1,13 @@
|
||||||
[workspace]
|
[workspace]
|
||||||
|
resolver = "2"
|
||||||
members = [
|
members = [
|
||||||
"apps/desktop/src-tauri",
|
"apps/desktop/src-tauri",
|
||||||
|
"apps/mobile/rust",
|
||||||
"core",
|
"core",
|
||||||
"core/prisma",
|
"core/prisma",
|
||||||
"core/derive",
|
|
||||||
"apps/server"
|
"apps/server"
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[patch.crates-io]
|
||||||
|
# We use this patch so we can compile for the IOS simulator on M1
|
||||||
|
openssl-sys = { git = "https://github.com/spacedriveapp/rust-openssl" }
|
151
LICENSE
|
@ -1,25 +1,23 @@
|
||||||
Copyright (c) 2021-present Spacedrive Technology Inc.
|
Copyright (c) 2021-present Spacedrive Technology Inc.
|
||||||
|
|
||||||
|
GNU AFFERO GENERAL PUBLIC LICENSE
|
||||||
|
Version 3, 19 November 2007
|
||||||
|
|
||||||
GNU GENERAL PUBLIC LICENSE
|
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
|
||||||
Version 3, 29 June 2007
|
|
||||||
|
|
||||||
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
|
|
||||||
Everyone is permitted to copy and distribute verbatim copies
|
Everyone is permitted to copy and distribute verbatim copies
|
||||||
of this license document, but changing it is not allowed.
|
of this license document, but changing it is not allowed.
|
||||||
|
|
||||||
Preamble
|
Preamble
|
||||||
|
|
||||||
The GNU General Public License is a free, copyleft license for
|
The GNU Affero General Public License is a free, copyleft license for
|
||||||
software and other kinds of works.
|
software and other kinds of works, specifically designed to ensure
|
||||||
|
cooperation with the community in the case of network server software.
|
||||||
|
|
||||||
The licenses for most software and other practical works are designed
|
The licenses for most software and other practical works are designed
|
||||||
to take away your freedom to share and change the works. By contrast,
|
to take away your freedom to share and change the works. By contrast,
|
||||||
the GNU General Public License is intended to guarantee your freedom to
|
our General Public Licenses are intended to guarantee your freedom to
|
||||||
share and change all versions of a program--to make sure it remains free
|
share and change all versions of a program--to make sure it remains free
|
||||||
software for all its users. We, the Free Software Foundation, use the
|
software for all its users.
|
||||||
GNU General Public License for most of our software; it applies also to
|
|
||||||
any other work released this way by its authors. You can apply it to
|
|
||||||
your programs, too.
|
|
||||||
|
|
||||||
When we speak of free software, we are referring to freedom, not
|
When we speak of free software, we are referring to freedom, not
|
||||||
price. Our General Public Licenses are designed to make sure that you
|
price. Our General Public Licenses are designed to make sure that you
|
||||||
|
@ -28,44 +26,34 @@ them if you wish), that you receive source code or can get it if you
|
||||||
want it, that you can change the software or use pieces of it in new
|
want it, that you can change the software or use pieces of it in new
|
||||||
free programs, and that you know you can do these things.
|
free programs, and that you know you can do these things.
|
||||||
|
|
||||||
To protect your rights, we need to prevent others from denying you
|
Developers that use our General Public Licenses protect your rights
|
||||||
these rights or asking you to surrender the rights. Therefore, you have
|
with two steps: (1) assert copyright on the software, and (2) offer
|
||||||
certain responsibilities if you distribute copies of the software, or if
|
you this License which gives you legal permission to copy, distribute
|
||||||
you modify it: responsibilities to respect the freedom of others.
|
and/or modify the software.
|
||||||
|
|
||||||
For example, if you distribute copies of such a program, whether
|
A secondary benefit of defending all users' freedom is that
|
||||||
gratis or for a fee, you must pass on to the recipients the same
|
improvements made in alternate versions of the program, if they
|
||||||
freedoms that you received. You must make sure that they, too, receive
|
receive widespread use, become available for other developers to
|
||||||
or can get the source code. And you must show them these terms so they
|
incorporate. Many developers of free software are heartened and
|
||||||
know their rights.
|
encouraged by the resulting cooperation. However, in the case of
|
||||||
|
software used on network servers, this result may fail to come about.
|
||||||
|
The GNU General Public License permits making a modified version and
|
||||||
|
letting the public access it on a server without ever releasing its
|
||||||
|
source code to the public.
|
||||||
|
|
||||||
Developers that use the GNU GPL protect your rights with two steps:
|
The GNU Affero General Public License is designed specifically to
|
||||||
(1) assert copyright on the software, and (2) offer you this License
|
ensure that, in such cases, the modified source code becomes available
|
||||||
giving you legal permission to copy, distribute and/or modify it.
|
to the community. It requires the operator of a network server to
|
||||||
|
provide the source code of the modified version running there to the
|
||||||
|
users of that server. Therefore, public use of a modified version, on
|
||||||
|
a publicly accessible server, gives the public access to the source
|
||||||
|
code of the modified version.
|
||||||
|
|
||||||
For the developers' and authors' protection, the GPL clearly explains
|
An older license, called the Affero General Public License and
|
||||||
that there is no warranty for this free software. For both users' and
|
published by Affero, was designed to accomplish similar goals. This is
|
||||||
authors' sake, the GPL requires that modified versions be marked as
|
a different license, not a version of the Affero GPL, but Affero has
|
||||||
changed, so that their problems will not be attributed erroneously to
|
released a new version of the Affero GPL which permits relicensing under
|
||||||
authors of previous versions.
|
this license.
|
||||||
|
|
||||||
Some devices are designed to deny users access to install or run
|
|
||||||
modified versions of the software inside them, although the manufacturer
|
|
||||||
can do so. This is fundamentally incompatible with the aim of
|
|
||||||
protecting users' freedom to change the software. The systematic
|
|
||||||
pattern of such abuse occurs in the area of products for individuals to
|
|
||||||
use, which is precisely where it is most unacceptable. Therefore, we
|
|
||||||
have designed this version of the GPL to prohibit the practice for those
|
|
||||||
products. If such problems arise substantially in other domains, we
|
|
||||||
stand ready to extend this provision to those domains in future versions
|
|
||||||
of the GPL, as needed to protect the freedom of users.
|
|
||||||
|
|
||||||
Finally, every program is threatened constantly by software patents.
|
|
||||||
States should not allow patents to restrict development and use of
|
|
||||||
software on general-purpose computers, but in those that do, we wish to
|
|
||||||
avoid the special danger that patents applied to a free program could
|
|
||||||
make it effectively proprietary. To prevent this, the GPL assures that
|
|
||||||
patents cannot be used to render the program non-free.
|
|
||||||
|
|
||||||
The precise terms and conditions for copying, distribution and
|
The precise terms and conditions for copying, distribution and
|
||||||
modification follow.
|
modification follow.
|
||||||
|
@ -74,7 +62,7 @@ modification follow.
|
||||||
|
|
||||||
0. Definitions.
|
0. Definitions.
|
||||||
|
|
||||||
"This License" refers to version 3 of the GNU General Public License.
|
"This License" refers to version 3 of the GNU Affero General Public License.
|
||||||
|
|
||||||
"Copyright" also means copyright-like laws that apply to other kinds of
|
"Copyright" also means copyright-like laws that apply to other kinds of
|
||||||
works, such as semiconductor masks.
|
works, such as semiconductor masks.
|
||||||
|
@ -551,35 +539,45 @@ to collect a royalty for further conveying from those to whom you convey
|
||||||
the Program, the only way you could satisfy both those terms and this
|
the Program, the only way you could satisfy both those terms and this
|
||||||
License would be to refrain entirely from conveying the Program.
|
License would be to refrain entirely from conveying the Program.
|
||||||
|
|
||||||
13. Use with the GNU Affero General Public License.
|
13. Remote Network Interaction; Use with the GNU General Public License.
|
||||||
|
|
||||||
|
Notwithstanding any other provision of this License, if you modify the
|
||||||
|
Program, your modified version must prominently offer all users
|
||||||
|
interacting with it remotely through a computer network (if your version
|
||||||
|
supports such interaction) an opportunity to receive the Corresponding
|
||||||
|
Source of your version by providing access to the Corresponding Source
|
||||||
|
from a network server at no charge, through some standard or customary
|
||||||
|
means of facilitating copying of software. This Corresponding Source
|
||||||
|
shall include the Corresponding Source for any work covered by version 3
|
||||||
|
of the GNU General Public License that is incorporated pursuant to the
|
||||||
|
following paragraph.
|
||||||
|
|
||||||
Notwithstanding any other provision of this License, you have
|
Notwithstanding any other provision of this License, you have
|
||||||
permission to link or combine any covered work with a work licensed
|
permission to link or combine any covered work with a work licensed
|
||||||
under version 3 of the GNU Affero General Public License into a single
|
under version 3 of the GNU General Public License into a single
|
||||||
combined work, and to convey the resulting work. The terms of this
|
combined work, and to convey the resulting work. The terms of this
|
||||||
License will continue to apply to the part which is the covered work,
|
License will continue to apply to the part which is the covered work,
|
||||||
but the special requirements of the GNU Affero General Public License,
|
but the work with which it is combined will remain governed by version
|
||||||
section 13, concerning interaction through a network will apply to the
|
3 of the GNU General Public License.
|
||||||
combination as such.
|
|
||||||
|
|
||||||
14. Revised Versions of this License.
|
14. Revised Versions of this License.
|
||||||
|
|
||||||
The Free Software Foundation may publish revised and/or new versions of
|
The Free Software Foundation may publish revised and/or new versions of
|
||||||
the GNU General Public License from time to time. Such new versions will
|
the GNU Affero General Public License from time to time. Such new versions
|
||||||
be similar in spirit to the present version, but may differ in detail to
|
will be similar in spirit to the present version, but may differ in detail to
|
||||||
address new problems or concerns.
|
address new problems or concerns.
|
||||||
|
|
||||||
Each version is given a distinguishing version number. If the
|
Each version is given a distinguishing version number. If the
|
||||||
Program specifies that a certain numbered version of the GNU General
|
Program specifies that a certain numbered version of the GNU Affero General
|
||||||
Public License "or any later version" applies to it, you have the
|
Public License "or any later version" applies to it, you have the
|
||||||
option of following the terms and conditions either of that numbered
|
option of following the terms and conditions either of that numbered
|
||||||
version or of any later version published by the Free Software
|
version or of any later version published by the Free Software
|
||||||
Foundation. If the Program does not specify a version number of the
|
Foundation. If the Program does not specify a version number of the
|
||||||
GNU General Public License, you may choose any version ever published
|
GNU Affero General Public License, you may choose any version ever published
|
||||||
by the Free Software Foundation.
|
by the Free Software Foundation.
|
||||||
|
|
||||||
If the Program specifies that a proxy can decide which future
|
If the Program specifies that a proxy can decide which future
|
||||||
versions of the GNU General Public License can be used, that proxy's
|
versions of the GNU Affero General Public License can be used, that proxy's
|
||||||
public statement of acceptance of a version permanently authorizes you
|
public statement of acceptance of a version permanently authorizes you
|
||||||
to choose that version for the Program.
|
to choose that version for the Program.
|
||||||
|
|
||||||
|
@ -637,40 +635,29 @@ the "copyright" line and a pointer to where the full notice is found.
|
||||||
Copyright (C) <year> <name of author>
|
Copyright (C) <year> <name of author>
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
This program is free software: you can redistribute it and/or modify
|
||||||
it under the terms of the GNU General Public License as published by
|
it under the terms of the GNU Affero General Public License as published
|
||||||
the Free Software Foundation, either version 3 of the License, or
|
by the Free Software Foundation, either version 3 of the License, or
|
||||||
(at your option) any later version.
|
(at your option) any later version.
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
This program is distributed in the hope that it will be useful,
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
GNU General Public License for more details.
|
GNU Affero General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU Affero General Public License
|
||||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
Also add information on how to contact you by electronic and paper mail.
|
Also add information on how to contact you by electronic and paper mail.
|
||||||
|
|
||||||
If the program does terminal interaction, make it output a short
|
If your software can interact with users remotely through a computer
|
||||||
notice like this when it starts in an interactive mode:
|
network, you should also make sure that it provides a way for users to
|
||||||
|
get its source. For example, if your program is a web application, its
|
||||||
<program> Copyright (C) <year> <name of author>
|
interface could display a "Source" link that leads users to an archive
|
||||||
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
of the code. There are many ways you could offer source, and different
|
||||||
This is free software, and you are welcome to redistribute it
|
solutions will be better for different programs; see section 13 for the
|
||||||
under certain conditions; type `show c' for details.
|
specific requirements.
|
||||||
|
|
||||||
The hypothetical commands `show w' and `show c' should show the appropriate
|
|
||||||
parts of the General Public License. Of course, your program's commands
|
|
||||||
might be different; for a GUI interface, you would use an "about box".
|
|
||||||
|
|
||||||
You should also get your employer (if you work as a programmer) or school,
|
You should also get your employer (if you work as a programmer) or school,
|
||||||
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
||||||
For more information on this, and how to apply and follow the GNU GPL, see
|
For more information on this, and how to apply and follow the GNU AGPL, see
|
||||||
<http://www.gnu.org/licenses/>.
|
<https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
The GNU General Public License does not permit incorporating your program
|
|
||||||
into proprietary programs. If your program is a subroutine library, you
|
|
||||||
may consider it more useful to permit linking proprietary applications with
|
|
||||||
the library. If this is what you want to do, use the GNU Lesser General
|
|
||||||
Public License instead of this License. But first, please read
|
|
||||||
<http://www.gnu.org/philosophy/why-not-lgpl.html>.
|
|
18
README.md
|
@ -59,7 +59,7 @@ For independent creatives, hoarders and those that want to own their digital foo
|
||||||
|
|
||||||
# What is a VDFS?
|
# What is a VDFS?
|
||||||
|
|
||||||
A VDFS (virtual distributed filesystem) is a filesystem designed to work across a variety of storage layers. With a uniform API to manipulate and access content across many devices, VSFS is not restricted to a single machine. It achieves this by maintaining a virtual index of all storage locations, synchronizing the database between clients in realtime. This implementation also uses [CAS](https://en.wikipedia.org/wiki/Content-addressable_storage) (Content-addressable storage) to uniquely identify files, while keeping record of logical file paths relative to the storage locations.
|
A VDFS (virtual distributed filesystem) is a filesystem designed to work across a variety of storage layers. With a uniform API to manipulate and access content across many devices, VDFS is not restricted to a single machine. It achieves this by maintaining a virtual index of all storage locations, synchronizing the database between clients in realtime. This implementation also uses [CAS](https://en.wikipedia.org/wiki/Content-addressable_storage) (Content-addressable storage) to uniquely identify files, while keeping record of logical file paths relative to the storage locations.
|
||||||
|
|
||||||
The first implementation of a VDFS can be found in this UC Berkeley [paper](https://www2.eecs.berkeley.edu/Pubs/TechRpts/2018/EECS-2018-29.pdf) by Haoyuan Li. This paper describes its use for cloud computing, however the underlying concepts can be translated to open consumer software.
|
The first implementation of a VDFS can be found in this UC Berkeley [paper](https://www2.eecs.berkeley.edu/Pubs/TechRpts/2018/EECS-2018-29.pdf) by Haoyuan Li. This paper describes its use for cloud computing, however the underlying concepts can be translated to open consumer software.
|
||||||
|
|
||||||
|
@ -85,7 +85,7 @@ _Note: Links are for highlight purposes only until feature specific documentatio
|
||||||
**To be developed (MVP):**
|
**To be developed (MVP):**
|
||||||
|
|
||||||
- **[Photos](#features)** - Photo and video albums similar to Apple/Google photos.
|
- **[Photos](#features)** - Photo and video albums similar to Apple/Google photos.
|
||||||
- **[Search](#features)** - Deep search into your filesystem with a keybind, including offline locations.
|
- **[Search](#features)** - Deep search into your filesystem with a keybinding, including offline locations.
|
||||||
- **[Tags](#features)** - Define routines on custom tags to automate workflows, easily tag files individually, in bulk and automatically via rules.
|
- **[Tags](#features)** - Define routines on custom tags to automate workflows, easily tag files individually, in bulk and automatically via rules.
|
||||||
- **[Extensions](#features)** - Build tools on top of Spacedrive, extend functionality and integrate third party services. Extension directory on [spacedrive.com/extensions](#features).
|
- **[Extensions](#features)** - Build tools on top of Spacedrive, extend functionality and integrate third party services. Extension directory on [spacedrive.com/extensions](#features).
|
||||||
|
|
||||||
|
@ -124,16 +124,16 @@ This project is using what I'm calling the **"PRRTT"** stack (Prisma, Rust, Reac
|
||||||
|
|
||||||
### Core:
|
### Core:
|
||||||
|
|
||||||
- `core`: The [Rust](#) core, referred to internally as `sdcore`. Contains filesystem, database and networking logic. Can be deployed in a variety of host applications.
|
- `core`: The [Rust](https://www.rust-lang.org) core, referred to internally as `sdcore`. Contains filesystem, database and networking logic. Can be deployed in a variety of host applications.
|
||||||
|
|
||||||
### Packages:
|
### Packages:
|
||||||
|
|
||||||
- `client`: A [TypeScript](#) client library to handle dataflow via RPC between UI and the Rust core.
|
- `client`: A [TypeScript](https://www.typescriptlang.org/) client library to handle dataflow via RPC between UI and the Rust core.
|
||||||
- `ui`: A [React](<[#](https://reactjs.org)>) Shared component library.
|
- `ui`: A [React](https://reactjs.org) Shared component library.
|
||||||
- `interface`: The complete user interface in React (used by apps `desktop`, `web` and `landing`)
|
- `interface`: The complete user interface in React (used by apps `desktop`, `web` and `landing`)
|
||||||
- `config`: `eslint` configurations (includes `eslint-config-next`, `eslint-config-prettier` and all `tsconfig.json` configs used throughout the monorepo.
|
- `config`: `eslint` configurations (includes `eslint-config-next`, `eslint-config-prettier` and all `tsconfig.json` configs used throughout the monorepo.
|
||||||
- `macos`: A [Swift](#) Native binary for MacOS system extensions.
|
- `macos`: A [Swift](https://developer.apple.com/swift/) Native binary for MacOS system extensions.
|
||||||
- `ios`: A [Swift](#) Native binary (planned).
|
- `ios`: A [Swift](https://developer.apple.com/swift/) Native binary (planned).
|
||||||
- `windows`: A [C#](#) Native binary (planned).
|
- `windows`: A [C#](https://docs.microsoft.com/en-us/dotnet/csharp/) Native binary (planned).
|
||||||
- `android`: A [Kotlin](#) Native binary (planned).
|
- `android`: A [Kotlin](https://kotlinlang.org/) Native binary (planned).
|
||||||
|
|
||||||
|
|
5
apps/desktop/dist/.gitignore
vendored
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
# Ignore everything in this directory
|
||||||
|
*
|
||||||
|
# Except this file
|
||||||
|
!.gitignore
|
||||||
|
# This is done so that Tauri never complains that '../dist does not exist'
|
|
@ -11,31 +11,33 @@
|
||||||
"build": "tauri build"
|
"build": "tauri build"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
"@rspc/client": "^0.0.5",
|
||||||
"@sd/client": "workspace:*",
|
"@sd/client": "workspace:*",
|
||||||
"@sd/core": "workspace:*",
|
"@sd/core": "workspace:*",
|
||||||
"@sd/interface": "workspace:*",
|
"@sd/interface": "workspace:*",
|
||||||
"@sd/ui": "workspace:*",
|
"@sd/ui": "workspace:*",
|
||||||
"@tauri-apps/api": "1.0.0",
|
"@tanstack/react-query": "^4.0.10",
|
||||||
"react": "^18.1.0",
|
"@tauri-apps/api": "1.0.2",
|
||||||
"react-dom": "^18.1.0"
|
"react": "^18.2.0",
|
||||||
|
"react-dom": "^18.2.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@tauri-apps/cli": "1.0.0",
|
"@tauri-apps/cli": "1.0.5",
|
||||||
"@tauri-apps/tauricon": "github:tauri-apps/tauricon",
|
"@tauri-apps/tauricon": "github:tauri-apps/tauricon",
|
||||||
"@types/babel-core": "^6.25.7",
|
"@types/babel-core": "^6.25.7",
|
||||||
"@types/byte-size": "^8.1.0",
|
"@types/byte-size": "^8.1.0",
|
||||||
"@types/react": "^18.0.9",
|
"@types/react": "^18.0.15",
|
||||||
"@types/react-dom": "^18.0.5",
|
"@types/react-dom": "^18.0.6",
|
||||||
"@types/react-router-dom": "^5.3.3",
|
"@types/react-router-dom": "^5.3.3",
|
||||||
"@types/react-window": "^1.8.5",
|
"@types/react-window": "^1.8.5",
|
||||||
"@types/tailwindcss": "^3.0.10",
|
"@types/tailwindcss": "^3.1.0",
|
||||||
"@vitejs/plugin-react": "^1.3.2",
|
"@vitejs/plugin-react": "^2.0.0",
|
||||||
"concurrently": "^7.2.1",
|
"concurrently": "^7.3.0",
|
||||||
"prettier": "^2.6.2",
|
"prettier": "^2.7.1",
|
||||||
"sass": "^1.52.1",
|
"sass": "^1.54.0",
|
||||||
"typescript": "^4.7.2",
|
"typescript": "^4.7.4",
|
||||||
"vite": "^2.9.9",
|
"vite": "^3.0.3",
|
||||||
"vite-plugin-filter-replace": "^0.1.9",
|
"vite-plugin-filter-replace": "^0.1.9",
|
||||||
"vite-plugin-svgr": "^2.1.0"
|
"vite-plugin-svgr": "^2.2.1"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,25 +9,20 @@ default-run = "spacedrive"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
build = "build.rs"
|
build = "build.rs"
|
||||||
|
|
||||||
[build-dependencies]
|
|
||||||
tauri-build = { version = "1.0.0", features = [] }
|
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
# Project dependencies
|
tauri = { version = "1.0.4", features = ["api-all", "macos-private-api"] }
|
||||||
tauri = { version = "1.0.0", features = ["api-all", "macos-private-api"] }
|
rspc = { version = "0.0.4", features = ["tauri"] }
|
||||||
sdcore = { path = "../../../core" }
|
sdcore = { path = "../../../core" }
|
||||||
# tauri-plugin-shadows = { git = "https://github.com/tauri-apps/tauri-plugin-shadows", features = ["tauri-impl"] }
|
|
||||||
|
|
||||||
# Universal Dependencies
|
|
||||||
tokio = { version = "1.17.0", features = ["sync"] }
|
tokio = { version = "1.17.0", features = ["sync"] }
|
||||||
window-shadows = "0.1.2"
|
window-shadows = "0.1.2"
|
||||||
env_logger = "0.9.0"
|
tracing = "0.1.35"
|
||||||
dotenvy = "0.15.1"
|
|
||||||
|
|
||||||
# macOS system libs
|
|
||||||
[target.'cfg(target_os = "macos")'.dependencies]
|
[target.'cfg(target_os = "macos")'.dependencies]
|
||||||
swift-rs = { git = "https://github.com/Brendonovich/swift-rs.git", branch = "autorelease" }
|
swift-rs = { git = "https://github.com/Brendonovich/swift-rs.git", branch = "autorelease" }
|
||||||
|
|
||||||
|
[build-dependencies]
|
||||||
|
tauri-build = { version = "1.0.0", features = [] }
|
||||||
|
|
||||||
[target.'cfg(target_os = "macos")'.build-dependencies]
|
[target.'cfg(target_os = "macos")'.build-dependencies]
|
||||||
swift-rs = { git = "https://github.com/Brendonovich/swift-rs.git", branch = "autorelease", features = ["build"] }
|
swift-rs = { git = "https://github.com/Brendonovich/swift-rs.git", branch = "autorelease", features = ["build"] }
|
||||||
|
|
||||||
|
|
|
@ -10,4 +10,3 @@ merge_derives = true
|
||||||
use_try_shorthand = false
|
use_try_shorthand = false
|
||||||
use_field_init_shorthand = false
|
use_field_init_shorthand = false
|
||||||
force_explicit_abi = true
|
force_explicit_abi = true
|
||||||
imports_granularity = "Crate"
|
|
||||||
|
|
|
@ -1,41 +1,12 @@
|
||||||
use std::time::{Duration, Instant};
|
use std::path::PathBuf;
|
||||||
|
|
||||||
use dotenvy::dotenv;
|
use sdcore::Node;
|
||||||
use sdcore::{ClientCommand, ClientQuery, CoreController, CoreEvent, CoreResponse, Node};
|
use tauri::{api::path, Manager, RunEvent};
|
||||||
use tauri::api::path;
|
use tracing::{debug, error};
|
||||||
use tauri::Manager;
|
|
||||||
#[cfg(target_os = "macos")]
|
#[cfg(target_os = "macos")]
|
||||||
mod macos;
|
mod macos;
|
||||||
mod menu;
|
mod menu;
|
||||||
|
|
||||||
#[tauri::command(async)]
|
|
||||||
async fn client_query_transport(
|
|
||||||
core: tauri::State<'_, CoreController>,
|
|
||||||
data: ClientQuery,
|
|
||||||
) -> Result<CoreResponse, String> {
|
|
||||||
match core.query(data).await {
|
|
||||||
Ok(response) => Ok(response),
|
|
||||||
Err(err) => {
|
|
||||||
println!("query error: {:?}", err);
|
|
||||||
Err(err.to_string())
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[tauri::command(async)]
|
|
||||||
async fn client_command_transport(
|
|
||||||
core: tauri::State<'_, CoreController>,
|
|
||||||
data: ClientCommand,
|
|
||||||
) -> Result<CoreResponse, String> {
|
|
||||||
match core.command(data).await {
|
|
||||||
Ok(response) => Ok(response),
|
|
||||||
Err(err) => {
|
|
||||||
println!("command error: {:?}", err);
|
|
||||||
Err(err.to_string())
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[tauri::command(async)]
|
#[tauri::command(async)]
|
||||||
async fn app_ready(app_handle: tauri::AppHandle) {
|
async fn app_ready(app_handle: tauri::AppHandle) {
|
||||||
let window = app_handle.get_window("main").unwrap();
|
let window = app_handle.get_window("main").unwrap();
|
||||||
|
@ -45,24 +16,17 @@ async fn app_ready(app_handle: tauri::AppHandle) {
|
||||||
|
|
||||||
#[tokio::main]
|
#[tokio::main]
|
||||||
async fn main() {
|
async fn main() {
|
||||||
dotenv().ok();
|
let data_dir = path::data_dir()
|
||||||
env_logger::init();
|
.unwrap_or_else(|| PathBuf::from("./"))
|
||||||
|
.join("spacedrive");
|
||||||
|
|
||||||
let data_dir = path::data_dir().unwrap_or(std::path::PathBuf::from("./"));
|
let (node, router) = Node::new(data_dir).await;
|
||||||
// create an instance of the core
|
|
||||||
let (mut node, mut event_receiver) = Node::new(data_dir).await;
|
let app = tauri::Builder::default()
|
||||||
// run startup tasks
|
.plugin(rspc::integrations::tauri::plugin(router, {
|
||||||
node.initializer().await;
|
let node = node.clone();
|
||||||
// extract the node controller
|
move || node.get_request_context()
|
||||||
let controller = node.get_controller();
|
}))
|
||||||
// throw the node into a dedicated thread
|
|
||||||
tokio::spawn(async move {
|
|
||||||
node.start().await;
|
|
||||||
});
|
|
||||||
// create tauri app
|
|
||||||
tauri::Builder::default()
|
|
||||||
// pass controller to the tauri state manager
|
|
||||||
.manage(controller)
|
|
||||||
.setup(|app| {
|
.setup(|app| {
|
||||||
let app = app.handle();
|
let app = app.handle();
|
||||||
|
|
||||||
|
@ -89,35 +53,29 @@ async fn main() {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// core event transport
|
|
||||||
tokio::spawn(async move {
|
|
||||||
let mut last = Instant::now();
|
|
||||||
// handle stream output
|
|
||||||
while let Some(event) = event_receiver.recv().await {
|
|
||||||
match event {
|
|
||||||
CoreEvent::InvalidateQueryDebounced(_) => {
|
|
||||||
let current = Instant::now();
|
|
||||||
if current.duration_since(last) > Duration::from_millis(1000 / 60) {
|
|
||||||
last = current;
|
|
||||||
app.emit_all("core_event", &event).unwrap();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
event => {
|
|
||||||
app.emit_all("core_event", &event).unwrap();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
})
|
})
|
||||||
.on_menu_event(|event| menu::handle_menu_event(event))
|
.on_menu_event(menu::handle_menu_event)
|
||||||
.invoke_handler(tauri::generate_handler![
|
.invoke_handler(tauri::generate_handler![app_ready,])
|
||||||
client_query_transport,
|
|
||||||
client_command_transport,
|
|
||||||
app_ready,
|
|
||||||
])
|
|
||||||
.menu(menu::get_menu())
|
.menu(menu::get_menu())
|
||||||
.run(tauri::generate_context!())
|
.build(tauri::generate_context!())
|
||||||
.expect("error while running tauri application");
|
.expect("error while building tauri application");
|
||||||
|
|
||||||
|
app.run(move |app_handler, event| {
|
||||||
|
if let RunEvent::ExitRequested { .. } = event {
|
||||||
|
debug!("Closing all open windows...");
|
||||||
|
app_handler
|
||||||
|
.windows()
|
||||||
|
.iter()
|
||||||
|
.for_each(|(window_name, window)| {
|
||||||
|
debug!("closing window: {window_name}");
|
||||||
|
if let Err(e) = window.close() {
|
||||||
|
error!("failed to close window '{}': {:#?}", window_name, e);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
node.shutdown();
|
||||||
|
app_handler.exit(0);
|
||||||
|
}
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
use std::env::consts;
|
use std::env::consts;
|
||||||
|
|
||||||
use tauri::{AboutMetadata, CustomMenuItem, Menu, MenuItem, Submenu, WindowMenuEvent, Wry};
|
use tauri::{
|
||||||
|
AboutMetadata, CustomMenuItem, Manager, Menu, MenuItem, Submenu, WindowMenuEvent, Wry,
|
||||||
|
};
|
||||||
|
|
||||||
pub(crate) fn get_menu() -> Menu {
|
pub(crate) fn get_menu() -> Menu {
|
||||||
match consts::OS {
|
match consts::OS {
|
||||||
|
@ -42,12 +44,14 @@ fn custom_menu_bar() -> Menu {
|
||||||
);
|
);
|
||||||
let edit_menu = Menu::new()
|
let edit_menu = Menu::new()
|
||||||
.add_native_item(MenuItem::Copy)
|
.add_native_item(MenuItem::Copy)
|
||||||
.add_native_item(MenuItem::Paste);
|
.add_native_item(MenuItem::Paste)
|
||||||
|
.add_native_item(MenuItem::SelectAll);
|
||||||
let view_menu = Menu::new()
|
let view_menu = Menu::new()
|
||||||
.add_item(
|
.add_item(CustomMenuItem::new("search".to_string(), "Search").accelerator("CmdOrCtrl+L"))
|
||||||
CustomMenuItem::new("command_pallete".to_string(), "Command Pallete")
|
// .add_item(
|
||||||
.accelerator("CmdOrCtrl+P"),
|
// CustomMenuItem::new("command_pallete".to_string(), "Command Pallete")
|
||||||
)
|
// .accelerator("CmdOrCtrl+P"),
|
||||||
|
// )
|
||||||
.add_item(CustomMenuItem::new("layout".to_string(), "Layout").disabled());
|
.add_item(CustomMenuItem::new("layout".to_string(), "Layout").disabled());
|
||||||
let window_menu = Menu::new().add_native_item(MenuItem::EnterFullScreen);
|
let window_menu = Menu::new().add_native_item(MenuItem::EnterFullScreen);
|
||||||
|
|
||||||
|
@ -60,28 +64,25 @@ fn custom_menu_bar() -> Menu {
|
||||||
CustomMenuItem::new("reload_app".to_string(), "Reload").accelerator("CmdOrCtrl+R"),
|
CustomMenuItem::new("reload_app".to_string(), "Reload").accelerator("CmdOrCtrl+R"),
|
||||||
);
|
);
|
||||||
|
|
||||||
let view_menu = view_menu.add_item(
|
view_menu.add_item(
|
||||||
CustomMenuItem::new("toggle_devtools".to_string(), "Toggle Developer Tools")
|
CustomMenuItem::new("toggle_devtools".to_string(), "Toggle Developer Tools")
|
||||||
.accelerator("CmdOrCtrl+Alt+I"),
|
.accelerator("CmdOrCtrl+Alt+I"),
|
||||||
);
|
)
|
||||||
|
|
||||||
view_menu
|
|
||||||
};
|
};
|
||||||
|
|
||||||
let menu = Menu::new()
|
Menu::new()
|
||||||
.add_submenu(Submenu::new("Spacedrive", app_menu))
|
.add_submenu(Submenu::new("Spacedrive", app_menu))
|
||||||
.add_submenu(Submenu::new("File", file_menu))
|
.add_submenu(Submenu::new("File", file_menu))
|
||||||
.add_submenu(Submenu::new("Edit", edit_menu))
|
.add_submenu(Submenu::new("Edit", edit_menu))
|
||||||
.add_submenu(Submenu::new("View", view_menu))
|
.add_submenu(Submenu::new("View", view_menu))
|
||||||
.add_submenu(Submenu::new("Window", window_menu));
|
.add_submenu(Submenu::new("Window", window_menu))
|
||||||
|
|
||||||
menu
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) fn handle_menu_event(event: WindowMenuEvent<Wry>) {
|
pub(crate) fn handle_menu_event(event: WindowMenuEvent<Wry>) {
|
||||||
match event.menu_item_id() {
|
match event.menu_item_id() {
|
||||||
"quit" => {
|
"quit" => {
|
||||||
std::process::exit(0);
|
let app = event.window().app_handle();
|
||||||
|
app.exit(0);
|
||||||
}
|
}
|
||||||
// "open_settings" => {
|
// "open_settings" => {
|
||||||
|
|
||||||
|
@ -92,7 +93,6 @@ pub(crate) fn handle_menu_event(event: WindowMenuEvent<Wry>) {
|
||||||
#[cfg(debug_assertions)]
|
#[cfg(debug_assertions)]
|
||||||
if window.is_devtools_open() {
|
if window.is_devtools_open() {
|
||||||
window.close_devtools();
|
window.close_devtools();
|
||||||
return;
|
|
||||||
} else {
|
} else {
|
||||||
window.close().unwrap();
|
window.close().unwrap();
|
||||||
}
|
}
|
||||||
|
@ -101,17 +101,17 @@ pub(crate) fn handle_menu_event(event: WindowMenuEvent<Wry>) {
|
||||||
window.close().unwrap();
|
window.close().unwrap();
|
||||||
}
|
}
|
||||||
"reload_app" => {
|
"reload_app" => {
|
||||||
event
|
#[cfg(target_os = "macos")]
|
||||||
.window()
|
{
|
||||||
.with_webview(|webview| {
|
event
|
||||||
#[cfg(target_os = "macos")]
|
.window()
|
||||||
{
|
.with_webview(|webview| {
|
||||||
use crate::macos::reload_webview;
|
use crate::macos::reload_webview;
|
||||||
|
|
||||||
reload_webview(webview.inner() as _);
|
reload_webview(webview.inner() as _);
|
||||||
}
|
})
|
||||||
})
|
.unwrap();
|
||||||
.unwrap();
|
}
|
||||||
}
|
}
|
||||||
#[cfg(debug_assertions)]
|
#[cfg(debug_assertions)]
|
||||||
"toggle_devtools" => {
|
"toggle_devtools" => {
|
||||||
|
|
|
@ -63,7 +63,7 @@
|
||||||
"windows": [
|
"windows": [
|
||||||
{
|
{
|
||||||
"title": "Spacedrive",
|
"title": "Spacedrive",
|
||||||
"width": 1200,
|
"width": 1400,
|
||||||
"height": 725,
|
"height": 725,
|
||||||
"minWidth": 700,
|
"minWidth": 700,
|
||||||
"minHeight": 500,
|
"minHeight": 500,
|
||||||
|
|
|
@ -15,7 +15,13 @@
|
||||||
"active": true,
|
"active": true,
|
||||||
"targets": "all",
|
"targets": "all",
|
||||||
"identifier": "com.spacedrive.desktop",
|
"identifier": "com.spacedrive.desktop",
|
||||||
"icon": ["icons/icon.icns"],
|
"icon": [
|
||||||
|
"icons/32x32.png",
|
||||||
|
"icons/128x128.png",
|
||||||
|
"icons/128x128@2x.png",
|
||||||
|
"icons/icon.icns",
|
||||||
|
"icons/icon.ico"
|
||||||
|
],
|
||||||
"resources": [],
|
"resources": [],
|
||||||
"externalBin": [],
|
"externalBin": [],
|
||||||
"copyright": "Spacedrive Technology Inc.",
|
"copyright": "Spacedrive Technology Inc.",
|
||||||
|
|
|
@ -1,10 +1,7 @@
|
||||||
// import Spacedrive JS client
|
// import Spacedrive JS client
|
||||||
import { BaseTransport } from '@sd/client';
|
import { TauriTransport, createClient } from '@rspc/client';
|
||||||
// import types from Spacedrive core (TODO: re-export from client would be cleaner)
|
import { Operations, queryClient, rspc } from '@sd/client';
|
||||||
import { ClientCommand, ClientQuery, CoreEvent } from '@sd/core';
|
|
||||||
// import Spacedrive interface
|
|
||||||
import SpacedriveInterface, { Platform } from '@sd/interface';
|
import SpacedriveInterface, { Platform } from '@sd/interface';
|
||||||
// import tauri apis
|
|
||||||
import { dialog, invoke, os, shell } from '@tauri-apps/api';
|
import { dialog, invoke, os, shell } from '@tauri-apps/api';
|
||||||
import { Event, listen } from '@tauri-apps/api/event';
|
import { Event, listen } from '@tauri-apps/api/event';
|
||||||
import { convertFileSrc } from '@tauri-apps/api/tauri';
|
import { convertFileSrc } from '@tauri-apps/api/tauri';
|
||||||
|
@ -14,22 +11,9 @@ import { createRoot } from 'react-dom/client';
|
||||||
|
|
||||||
import '@sd/ui/style';
|
import '@sd/ui/style';
|
||||||
|
|
||||||
// bind state to core via Tauri
|
const client = createClient<Operations>({
|
||||||
class Transport extends BaseTransport {
|
transport: new TauriTransport()
|
||||||
constructor() {
|
});
|
||||||
super();
|
|
||||||
|
|
||||||
listen('core_event', (e: Event<CoreEvent>) => {
|
|
||||||
this.emit('core_event', e.payload);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
async query(query: ClientQuery) {
|
|
||||||
return await invoke('client_query_transport', { data: query });
|
|
||||||
}
|
|
||||||
async command(query: ClientCommand) {
|
|
||||||
return await invoke('client_command_transport', { data: query });
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function App() {
|
function App() {
|
||||||
function getPlatform(platform: string): Platform {
|
function getPlatform(platform: string): Platform {
|
||||||
|
@ -45,7 +29,7 @@ function App() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const [platform, setPlatform] = useState<Platform>('macOS');
|
const [platform, setPlatform] = useState<Platform>('unknown');
|
||||||
const [focused, setFocused] = useState(true);
|
const [focused, setFocused] = useState(true);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
@ -66,23 +50,24 @@ function App() {
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<SpacedriveInterface
|
<rspc.Provider client={client} queryClient={queryClient}>
|
||||||
transport={new Transport()}
|
<SpacedriveInterface
|
||||||
platform={platform}
|
platform={platform}
|
||||||
convertFileSrc={function (url: string): string {
|
convertFileSrc={function (url: string): string {
|
||||||
return convertFileSrc(url);
|
return convertFileSrc(url);
|
||||||
}}
|
}}
|
||||||
openDialog={function (options: {
|
openDialog={function (options: {
|
||||||
directory?: boolean | undefined;
|
directory?: boolean | undefined;
|
||||||
}): Promise<string | string[] | null> {
|
}): Promise<string | string[] | null> {
|
||||||
return dialog.open(options);
|
return dialog.open(options);
|
||||||
}}
|
}}
|
||||||
isFocused={focused}
|
isFocused={focused}
|
||||||
onClose={() => appWindow.close()}
|
onClose={() => appWindow.close()}
|
||||||
onFullscreen={() => appWindow.setFullscreen(true)}
|
onFullscreen={() => appWindow.setFullscreen(true)}
|
||||||
onMinimize={() => appWindow.minimize()}
|
onMinimize={() => appWindow.minimize()}
|
||||||
onOpen={(path: string) => shell.open(path)}
|
onOpen={(path: string) => shell.open(path)}
|
||||||
/>
|
/>
|
||||||
|
</rspc.Provider>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
8
apps/landing/.eslintrc.js
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
module.exports = {
|
||||||
|
...require('@sd/config/eslint-react.js'),
|
||||||
|
parserOptions: {
|
||||||
|
tsconfigRootDir: __dirname,
|
||||||
|
project: './tsconfig.json'
|
||||||
|
},
|
||||||
|
ignorePatterns: ['**/*.js', '**/*.json', 'node_modules', 'public', 'dist']
|
||||||
|
};
|
|
@ -1,69 +1,56 @@
|
||||||
{
|
{
|
||||||
"name": "@sd/landing",
|
"name": "@sd/landing",
|
||||||
"private": true,
|
|
||||||
"version": "0.0.0",
|
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "pnpm run server",
|
"dev": "pnpm run server",
|
||||||
"prod": "pnpm run build && pnpm run server:prod",
|
"prod": "pnpm run build && pnpm run server:prod",
|
||||||
"vercel-build": "./vercel/deploy.sh",
|
"vercel-build": "./vercel/deploy.sh",
|
||||||
"build": "vite build && vite build --ssr && vite-plugin-ssr prerender",
|
"build": "vite build && vite build",
|
||||||
"server": "ts-node ./server",
|
"server": "ts-node ./server",
|
||||||
"server:prod": "cross-env NODE_ENV=production ts-node ./server"
|
"server:prod": "cross-env NODE_ENV=production ts-node ./server",
|
||||||
|
"lint": "eslint src/**/*.{ts,tsx} && tsc --noEmit"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@heroicons/react": "^1.0.6",
|
"@heroicons/react": "^1.0.6",
|
||||||
"@icons-pack/react-simple-icons": "^4.7.0",
|
"@icons-pack/react-simple-icons": "^5.2.0",
|
||||||
"@sd/client": "workspace:*",
|
"@sd/interface": "link:../../packages/interface",
|
||||||
"@sd/core": "workspace:*",
|
"@sd/ui": "link:../../packages/ui",
|
||||||
"@sd/interface": "workspace:*",
|
"@sd/assets": "link:../../packages/assets",
|
||||||
"@sd/ui": "workspace:*",
|
|
||||||
"@tailwindcss/typography": "^0.5.2",
|
|
||||||
"@tryghost/content-api": "^1.11.0",
|
"@tryghost/content-api": "^1.11.0",
|
||||||
"@vitejs/plugin-react": "^1.2.0",
|
|
||||||
"clsx": "^1.1.1",
|
|
||||||
"compression": "^1.7.4",
|
|
||||||
"cross-env": "^7.0.3",
|
|
||||||
"express": "^4.17.3",
|
|
||||||
"phosphor-react": "^1.4.1",
|
|
||||||
"prismjs": "^1.28.0",
|
|
||||||
"react": "^18.0.2",
|
|
||||||
"react-canvas-confetti": "^1.3.0",
|
|
||||||
"react-device-detect": "^2.2.2",
|
|
||||||
"react-dom": "^18.0.2",
|
|
||||||
"react-helmet": "^6.1.0",
|
|
||||||
"react-hook-form": "^7.31.3",
|
|
||||||
"react-router-dom": "6.3.0",
|
|
||||||
"react-tsparticles": "^2.0.6",
|
|
||||||
"simple-icons": "^7.0.0",
|
|
||||||
"ts-node": "^10.5.0",
|
|
||||||
"tsparticles": "^2.0.6",
|
|
||||||
"typescript": "^4.5.5"
|
|
||||||
},
|
|
||||||
"devDependencies": {
|
|
||||||
"@babel/preset-react": "^7.17.12",
|
|
||||||
"@tailwindcss/line-clamp": "^0.4.0",
|
|
||||||
"@types/compression": "^1.7.2",
|
"@types/compression": "^1.7.2",
|
||||||
"@types/express": "^4.17.13",
|
"@types/express": "^4.17.13",
|
||||||
"@types/lodash": "^4.14.182",
|
"@types/node": "^17.0.31",
|
||||||
"@types/node": "^17.0.36",
|
"@types/react": "^18.0.8",
|
||||||
"@types/prismjs": "^1.26.0",
|
"@types/react-dom": "^18.0.3",
|
||||||
"@types/react": "^18.0.9",
|
|
||||||
"@types/react-dom": "^18.0.5",
|
|
||||||
"@types/react-helmet": "^6.1.5",
|
|
||||||
"@types/tryghost__content-api": "^1.3.10",
|
|
||||||
"@vitejs/plugin-react": "^1.3.2",
|
"@vitejs/plugin-react": "^1.3.2",
|
||||||
"autoprefixer": "^10.4.7",
|
"clsx": "^1.2.1",
|
||||||
"ncc": "^0.3.6",
|
"compression": "^1.7.4",
|
||||||
"nodemon": "^2.0.16",
|
"cross-env": "^7.0.3",
|
||||||
|
"express": "^4.18.1",
|
||||||
|
"phosphor-react": "^1.4.1",
|
||||||
|
"prismjs": "^1.28.0",
|
||||||
|
"react": "^18.1.0",
|
||||||
|
"react-dom": "^18.1.0",
|
||||||
|
"react-helmet": "^6.1.0",
|
||||||
|
"react-hook-form": "^7.33.1",
|
||||||
|
"react-tsparticles": "^2.1.3",
|
||||||
|
"sirv": "^2.0.2",
|
||||||
|
"ts-node": "^10.7.0",
|
||||||
|
"tsparticles": "^2.1.3",
|
||||||
|
"typescript": "^4.6.4",
|
||||||
|
"vite": "^2.9.14",
|
||||||
|
"vite-plugin-ssr": "^0.4.15"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"@sd/config": "link:../../packages/config",
|
||||||
|
"@tailwindcss/line-clamp": "^0.4.0",
|
||||||
|
"@tailwindcss/typography": "^0.5.4",
|
||||||
|
"@types/prismjs": "^1.26.0",
|
||||||
|
"@types/react-helmet": "^6.1.5",
|
||||||
|
"@types/tryghost__content-api": "^1.3.11",
|
||||||
"postcss": "^8.4.14",
|
"postcss": "^8.4.14",
|
||||||
"sass": "^1.52.1",
|
"sass": "^1.54.0",
|
||||||
"tailwind": "^4.0.0",
|
"tailwind": "^4.0.0",
|
||||||
"ts-node": "^10.8.0",
|
|
||||||
"typescript": "^4.7.2",
|
|
||||||
"vite": "^2.9.9",
|
|
||||||
"vite-plugin-markdown": "^2.0.2",
|
"vite-plugin-markdown": "^2.0.2",
|
||||||
"vite-plugin-md": "^0.13.1",
|
"vite-plugin-svgr": "^2.2.1"
|
||||||
"vite-plugin-ssr": "^0.3.64",
|
|
||||||
"vite-plugin-svgr": "^2.1.0"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,57 +1,45 @@
|
||||||
import compression from 'compression';
|
import express from 'express'
|
||||||
import express from 'express';
|
import compression from 'compression'
|
||||||
import { networkInterfaces } from 'os';
|
import { renderPage } from 'vite-plugin-ssr'
|
||||||
import { createPageRenderer } from 'vite-plugin-ssr';
|
|
||||||
|
|
||||||
const isProduction = process.env.NODE_ENV === 'production';
|
const isProduction = process.env.NODE_ENV === 'production'
|
||||||
const root = `${__dirname}/..`;
|
const root = `${__dirname}/..`
|
||||||
|
|
||||||
startServer();
|
startServer()
|
||||||
|
|
||||||
async function startServer() {
|
async function startServer() {
|
||||||
const app = express();
|
const app = express()
|
||||||
|
|
||||||
app.use(compression());
|
app.use(compression())
|
||||||
|
|
||||||
let viteDevServer;
|
|
||||||
if (isProduction) {
|
if (isProduction) {
|
||||||
app.use(express.static(`${root}/dist/client`));
|
const sirv = require('sirv')
|
||||||
|
app.use(sirv(`${root}/dist/client`))
|
||||||
} else {
|
} else {
|
||||||
const vite = require('vite');
|
const vite = require('vite')
|
||||||
viteDevServer = await vite.createServer({
|
const viteDevMiddleware = (
|
||||||
root,
|
await vite.createServer({
|
||||||
server: { middlewareMode: 'ssr' }
|
root,
|
||||||
});
|
server: { middlewareMode: 'ssr' },
|
||||||
app.use(viteDevServer.middlewares);
|
})
|
||||||
|
).middlewares
|
||||||
|
app.use(viteDevMiddleware)
|
||||||
}
|
}
|
||||||
|
|
||||||
const renderPage = createPageRenderer({ viteDevServer, isProduction, root });
|
|
||||||
app.get('*', async (req, res, next) => {
|
app.get('*', async (req, res, next) => {
|
||||||
const url = req.originalUrl;
|
const url = req.originalUrl
|
||||||
const pageContextInit = {
|
const pageContextInit = {
|
||||||
url
|
url,
|
||||||
};
|
|
||||||
const pageContext = await renderPage(pageContextInit);
|
|
||||||
const { httpResponse } = pageContext;
|
|
||||||
if (!httpResponse) return next();
|
|
||||||
const { body, statusCode, contentType } = httpResponse;
|
|
||||||
res.status(statusCode).type(contentType).send(body);
|
|
||||||
});
|
|
||||||
|
|
||||||
const port = process.env.PORT || 8003;
|
|
||||||
app.listen(port);
|
|
||||||
console.log(`Server running at http://localhost:${port}`);
|
|
||||||
|
|
||||||
const nets = networkInterfaces();
|
|
||||||
|
|
||||||
for (const name of Object.keys(nets)) {
|
|
||||||
// @ts-ignore
|
|
||||||
for (const net of nets[name]) {
|
|
||||||
if (net.family === 'IPv4' && !net.internal) {
|
|
||||||
app.listen(Number(port), net.address, () => {
|
|
||||||
console.log(`Server running at http://${net.address}:${port}`);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
const pageContext = await renderPage(pageContextInit)
|
||||||
|
const { httpResponse } = pageContext
|
||||||
|
if (!httpResponse) return next()
|
||||||
|
const { body, statusCode, contentType } = httpResponse
|
||||||
|
res.status(statusCode).type(contentType).send(body)
|
||||||
|
})
|
||||||
|
|
||||||
|
const port = process.env.PORT || 3000;
|
||||||
|
// @ts-ignore: I don't get why this isn't valid they have a definition matching this.
|
||||||
|
app.listen(port, '0.0.0.0');
|
||||||
|
console.log(`Server running at http://localhost:${port}`);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,22 +0,0 @@
|
||||||
{
|
|
||||||
"compilerOptions": {
|
|
||||||
"lib": ["ESNext"],
|
|
||||||
"declaration": false,
|
|
||||||
"noEmit": true,
|
|
||||||
"esModuleInterop": true,
|
|
||||||
"forceConsistentCasingInFileNames": true,
|
|
||||||
"inlineSources": false,
|
|
||||||
"isolatedModules": false,
|
|
||||||
"module": "CommonJS",
|
|
||||||
"target": "ES5",
|
|
||||||
"moduleResolution": "node",
|
|
||||||
"noUnusedLocals": false,
|
|
||||||
"noUnusedParameters": false,
|
|
||||||
"preserveWatchOutput": true,
|
|
||||||
"skipLibCheck": false,
|
|
||||||
"strict": true,
|
|
||||||
"allowSyntheticDefaultImports": true,
|
|
||||||
"resolveJsonModule": true
|
|
||||||
},
|
|
||||||
"exclude": ["node_modules"]
|
|
||||||
}
|
|
|
@ -9,7 +9,7 @@ import NavBar from './components/NavBar';
|
||||||
import { PageContextProvider } from './renderer/usePageContext';
|
import { PageContextProvider } from './renderer/usePageContext';
|
||||||
import './style.scss';
|
import './style.scss';
|
||||||
|
|
||||||
export function App({
|
export default function App({
|
||||||
children,
|
children,
|
||||||
pageContext
|
pageContext
|
||||||
}: {
|
}: {
|
||||||
|
|
BIN
apps/landing/src/assets/images/team/ericson.jpg
Normal file
After Width: | Height: | Size: 35 KiB |
BIN
apps/landing/src/assets/images/team/utku.jpg
Normal file
After Width: | Height: | Size: 43 KiB |
|
@ -1,3 +1,4 @@
|
||||||
|
/* eslint-disable react-hooks/exhaustive-deps */
|
||||||
import clsx from 'clsx';
|
import clsx from 'clsx';
|
||||||
import React, { useEffect, useRef, useState } from 'react';
|
import React, { useEffect, useRef, useState } from 'react';
|
||||||
|
|
||||||
|
@ -87,9 +88,7 @@ const AppEmbed = () => {
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
{renderImage && (
|
{renderImage && <div className="z-40 h-full sm:w-auto fade-in-app-embed landing-img" />}
|
||||||
<div className="z-40 h-full sm:w-auto fade-in-app-embed landing-img" />
|
|
||||||
)}
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -6,16 +6,16 @@ import {
|
||||||
Twitch,
|
Twitch,
|
||||||
Twitter
|
Twitter
|
||||||
} from '@icons-pack/react-simple-icons';
|
} from '@icons-pack/react-simple-icons';
|
||||||
|
import AppLogo from '@sd/assets/images/logo.png';
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
|
|
||||||
import AppLogo from '../assets/images/logo.png';
|
|
||||||
|
|
||||||
function FooterLink(props: { children: string | JSX.Element; link: string; blank?: boolean }) {
|
function FooterLink(props: { children: string | JSX.Element; link: string; blank?: boolean }) {
|
||||||
return (
|
return (
|
||||||
<a
|
<a
|
||||||
href={props.link}
|
href={props.link}
|
||||||
target={props.blank ? '_blank' : ''}
|
target={props.blank ? '_blank' : ''}
|
||||||
className="text-gray-300 hover:text-white"
|
className="text-gray-300 hover:text-white"
|
||||||
|
rel="noreferrer"
|
||||||
>
|
>
|
||||||
{props.children}
|
{props.children}
|
||||||
</a>
|
</a>
|
||||||
|
|
|
@ -1,13 +1,12 @@
|
||||||
import { BookOpenIcon, MapIcon, QuestionMarkCircleIcon, UsersIcon } from '@heroicons/react/solid';
|
import { BookOpenIcon, MapIcon, QuestionMarkCircleIcon, UsersIcon } from '@heroicons/react/solid';
|
||||||
import { Discord, Github, Icon } from '@icons-pack/react-simple-icons';
|
import { Discord, Github } from '@icons-pack/react-simple-icons';
|
||||||
|
import AppLogo from '@sd/assets/images/logo.png';
|
||||||
import { Dropdown, DropdownItem } from '@sd/ui';
|
import { Dropdown, DropdownItem } from '@sd/ui';
|
||||||
import clsx from 'clsx';
|
import clsx from 'clsx';
|
||||||
import { List } from 'phosphor-react';
|
import { List } from 'phosphor-react';
|
||||||
import React, { useEffect, useState } from 'react';
|
import React, { useEffect, useState } from 'react';
|
||||||
|
|
||||||
import { positions } from '../pages/careers.page';
|
import { positions } from '../pages/careers.page';
|
||||||
|
|
||||||
import AppLogo from '../assets/images/logo.png';
|
|
||||||
import { getWindow } from '../utils';
|
import { getWindow } from '../utils';
|
||||||
|
|
||||||
function NavLink(props: { link?: string; children: string }) {
|
function NavLink(props: { link?: string; children: string }) {
|
||||||
|
@ -16,6 +15,7 @@ function NavLink(props: { link?: string; children: string }) {
|
||||||
href={props.link ?? '#'}
|
href={props.link ?? '#'}
|
||||||
target={props.link?.startsWith('http') ? '_blank' : undefined}
|
target={props.link?.startsWith('http') ? '_blank' : undefined}
|
||||||
className="p-4 text-gray-300 no-underline transition cursor-pointer hover:text-gray-50"
|
className="p-4 text-gray-300 no-underline transition cursor-pointer hover:text-gray-50"
|
||||||
|
rel="noreferrer"
|
||||||
>
|
>
|
||||||
{props.children}
|
{props.children}
|
||||||
</a>
|
</a>
|
||||||
|
@ -23,7 +23,7 @@ function NavLink(props: { link?: string; children: string }) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function dropdownItem(
|
function dropdownItem(
|
||||||
props: { name: string; icon: Icon } & ({ href: string } | { path: string })
|
props: { name: string; icon: any } & ({ href: string } | { path: string })
|
||||||
): DropdownItem[number] {
|
): DropdownItem[number] {
|
||||||
if ('href' in props) {
|
if ('href' in props) {
|
||||||
return {
|
return {
|
||||||
|
@ -55,12 +55,13 @@ export default function NavBar() {
|
||||||
setTimeout(onScroll, 0);
|
setTimeout(onScroll, 0);
|
||||||
getWindow()?.addEventListener('scroll', onScroll);
|
getWindow()?.addEventListener('scroll', onScroll);
|
||||||
return () => getWindow()?.removeEventListener('scroll', onScroll);
|
return () => getWindow()?.removeEventListener('scroll', onScroll);
|
||||||
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
className={clsx(
|
className={clsx(
|
||||||
'fixed transition-opacity z-[55] w-full h-16 border-b ',
|
'fixed transition z-[55] w-full h-16 border-b ',
|
||||||
isAtTop
|
isAtTop
|
||||||
? 'bg-transparent border-transparent'
|
? 'bg-transparent border-transparent'
|
||||||
: 'border-gray-550 bg-gray-750 bg-opacity-80 backdrop-blur'
|
: 'border-gray-550 bg-gray-750 bg-opacity-80 backdrop-blur'
|
||||||
|
@ -82,7 +83,12 @@ export default function NavBar() {
|
||||||
<NavLink link="/blog">Blog</NavLink>
|
<NavLink link="/blog">Blog</NavLink>
|
||||||
<div className="relative inline">
|
<div className="relative inline">
|
||||||
<NavLink link="/careers">Careers</NavLink>
|
<NavLink link="/careers">Careers</NavLink>
|
||||||
{positions.length > 0 ? <span className="absolute bg-opacity-80 px-[5px] text-xs rounded-md bg-primary -top-1 -right-2"> {positions.length} </span> : null}
|
{positions.length > 0 ? (
|
||||||
|
<span className="absolute bg-opacity-80 px-[5px] text-xs rounded-md bg-primary -top-1 -right-2">
|
||||||
|
{' '}
|
||||||
|
{positions.length}{' '}
|
||||||
|
</span>
|
||||||
|
) : null}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<Dropdown
|
<Dropdown
|
||||||
|
@ -132,10 +138,10 @@ export default function NavBar() {
|
||||||
buttonProps={{ className: '!p-1 ml-[140px]' }}
|
buttonProps={{ className: '!p-1 ml-[140px]' }}
|
||||||
/>
|
/>
|
||||||
<div className="absolute flex-row hidden space-x-5 right-3 lg:flex">
|
<div className="absolute flex-row hidden space-x-5 right-3 lg:flex">
|
||||||
<a href="https://discord.gg/gTaF2Z44f5" target="_blank">
|
<a href="https://discord.gg/gTaF2Z44f5" target="_blank" rel="noreferrer">
|
||||||
<Discord className="text-white" />
|
<Discord className="text-white" />
|
||||||
</a>
|
</a>
|
||||||
<a href="https://github.com/spacedriveapp/spacedrive" target="_blank">
|
<a href="https://github.com/spacedriveapp/spacedrive" target="_blank" rel="noreferrer">
|
||||||
<Github className="text-white" />
|
<Github className="text-white" />
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -36,7 +36,7 @@ function Link(props: LinkProps) {
|
||||||
<a
|
<a
|
||||||
className="duration-300 hover:scale-105 hover:opacity-80"
|
className="duration-300 hover:scale-105 hover:opacity-80"
|
||||||
href={props.href}
|
href={props.href}
|
||||||
rel="noreferer"
|
rel="noreferrer"
|
||||||
target="_blank"
|
target="_blank"
|
||||||
>
|
>
|
||||||
{props.children}
|
{props.children}
|
||||||
|
|
|
@ -7,35 +7,35 @@ const ghostURL = import.meta.env.VITE_API_URL;
|
||||||
export const blogEnabled = !!(ghostURL && ghostKey);
|
export const blogEnabled = !!(ghostURL && ghostKey);
|
||||||
|
|
||||||
export const api = blogEnabled
|
export const api = blogEnabled
|
||||||
? new GhostContentAPI({
|
? new GhostContentAPI({
|
||||||
url: ghostURL,
|
url: ghostURL,
|
||||||
key: ghostKey,
|
key: ghostKey,
|
||||||
version: 'v4'
|
version: 'v5.0'
|
||||||
})
|
})
|
||||||
: null;
|
: null;
|
||||||
|
|
||||||
export async function getPosts() {
|
export async function getPosts() {
|
||||||
if (!api) {
|
if (!api) {
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
const posts = await api.posts
|
const posts = await api.posts
|
||||||
.browse({
|
.browse({
|
||||||
include: ['tags', 'authors']
|
include: ['tags', 'authors']
|
||||||
})
|
})
|
||||||
.catch(() => []);
|
.catch(() => []);
|
||||||
return posts;
|
return posts;
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function getPost(slug: string) {
|
export async function getPost(slug: string) {
|
||||||
if (!api) {
|
if (!api) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
return await api.posts
|
return await api.posts
|
||||||
.read(
|
.read(
|
||||||
{ slug },
|
{ slug },
|
||||||
{
|
{
|
||||||
include: ['tags', 'authors']
|
include: ['tags', 'authors']
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
.catch(() => null);
|
.catch(() => null);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,29 +1,27 @@
|
||||||
import { getPosts } from './api';
|
import { blogEnabled, getPosts } from './api';
|
||||||
|
|
||||||
export async function onBeforeRender() {
|
export async function onBeforeRender() {
|
||||||
const posts = await getPosts();
|
const posts = await getPosts();
|
||||||
|
|
||||||
return {
|
return {
|
||||||
pageContext: {
|
pageContext: {
|
||||||
pageProps: {
|
pageProps: {
|
||||||
posts
|
posts
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function prerender() {
|
export async function prerender() {
|
||||||
const posts = await getPosts();
|
const posts = await getPosts();
|
||||||
|
|
||||||
const postPages = posts.map((post) => ({
|
const individualPosts = posts.map((post) => ({
|
||||||
url: `/blog/${post.slug}`,
|
url: `/blog/${post.slug}`,
|
||||||
pageContext: { pageProps: { post } }
|
pageContext: { pageProps: { post } }
|
||||||
}));
|
}));
|
||||||
|
|
||||||
const postListPage = {
|
return [...individualPosts, {
|
||||||
url: '/blog',
|
url: '/blog',
|
||||||
pageContext: { pageProps: { posts } }
|
pageContext: { pageProps: { posts } }
|
||||||
};
|
}];
|
||||||
|
|
||||||
return [postListPage, ...postPages];
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,7 +8,7 @@ import { blogEnabled } from './api';
|
||||||
|
|
||||||
function Page({ posts }: { posts: PostOrPage[] }) {
|
function Page({ posts }: { posts: PostOrPage[] }) {
|
||||||
if (!blogEnabled) {
|
if (!blogEnabled) {
|
||||||
let window = getWindow();
|
const window = getWindow();
|
||||||
if (!window) return;
|
if (!window) return;
|
||||||
window.location.href = '/blog-not-enabled';
|
window.location.href = '/blog-not-enabled';
|
||||||
return <></>;
|
return <></>;
|
||||||
|
@ -28,6 +28,7 @@ function Page({ posts }: { posts: PostOrPage[] }) {
|
||||||
{posts.map((post) => {
|
{posts.map((post) => {
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
|
key={post.id}
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
window.location.href = `/blog/${post.slug}`;
|
window.location.href = `/blog/${post.slug}`;
|
||||||
}}
|
}}
|
||||||
|
@ -49,9 +50,9 @@ function Page({ posts }: { posts: PostOrPage[] }) {
|
||||||
{new Date(post.published_at ?? '').toLocaleDateString()}
|
{new Date(post.published_at ?? '').toLocaleDateString()}
|
||||||
</p>
|
</p>
|
||||||
<div className="flex flex-wrap gap-2 mt-4">
|
<div className="flex flex-wrap gap-2 mt-4">
|
||||||
{post.tags?.map((tag: Tag) => {
|
{post.tags?.map((tag: Tag) => (
|
||||||
return <BlogTag tag={tag} />;
|
<BlogTag key={tag.id} tag={tag} />
|
||||||
})}
|
))}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -62,4 +63,4 @@ function Page({ posts }: { posts: PostOrPage[] }) {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
export default Page;
|
export { Page };
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
export default '/blog/:slug';
|
export default '/blog/@slug';
|
||||||
|
|
|
@ -1,21 +1,21 @@
|
||||||
import { PostOrPage, Tag } from '@tryghost/content-api';
|
import { PostOrPage, Tag } from '@tryghost/content-api';
|
||||||
import Prism from 'prismjs';
|
import Prism from 'prismjs';
|
||||||
import 'prismjs/components/prism-rust';
|
import 'prismjs/components/prism-rust';
|
||||||
import React, { useEffect, useState } from 'react';
|
import React, { useEffect } from 'react';
|
||||||
import { Helmet } from 'react-helmet';
|
import { Helmet } from 'react-helmet';
|
||||||
|
|
||||||
import '../../atom-one.css';
|
import '../../atom-one.css';
|
||||||
import { BlogTag } from '../../components/BlogTag';
|
import { BlogTag } from '../../components/BlogTag';
|
||||||
|
|
||||||
function MarkdownPage({ post }: { post: PostOrPage }) {
|
function Page({ post }: { post: PostOrPage }) {
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
Prism.highlightAll();
|
Prism.highlightAll();
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
let description =
|
const description =
|
||||||
post?.excerpt?.length || 0 > 160 ? post?.excerpt?.substring(0, 160) + '...' : post?.excerpt;
|
post?.excerpt?.length || 0 > 160 ? post?.excerpt?.substring(0, 160) + '...' : post?.excerpt;
|
||||||
|
|
||||||
let featured_image =
|
const featured_image =
|
||||||
post?.feature_image ||
|
post?.feature_image ||
|
||||||
'https://raw.githubusercontent.com/spacedriveapp/.github/main/profile/spacedrive_icon.png';
|
'https://raw.githubusercontent.com/spacedriveapp/.github/main/profile/spacedrive_icon.png';
|
||||||
|
|
||||||
|
@ -50,9 +50,9 @@ function MarkdownPage({ post }: { post: PostOrPage }) {
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
<div className="flex flex-wrap gap-2">
|
<div className="flex flex-wrap gap-2">
|
||||||
{post?.tags?.map((tag: Tag) => {
|
{post?.tags?.map((tag: Tag) => (
|
||||||
return <BlogTag tag={tag} />;
|
<BlogTag key={tag.id} tag={tag} />
|
||||||
})}
|
))}
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
<article
|
<article
|
||||||
|
@ -72,4 +72,4 @@ function MarkdownPage({ post }: { post: PostOrPage }) {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
export default MarkdownPage;
|
export { Page };
|
||||||
|
|
|
@ -10,31 +10,17 @@ import {
|
||||||
TrendingUpIcon
|
TrendingUpIcon
|
||||||
} from '@heroicons/react/outline';
|
} from '@heroicons/react/outline';
|
||||||
import { Button } from '@sd/ui';
|
import { Button } from '@sd/ui';
|
||||||
import { Heartbeat } from 'phosphor-react';
|
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { Helmet } from 'react-helmet';
|
import { Helmet } from 'react-helmet';
|
||||||
import { ReactComponent as Content } from '~/docs/changelog/index.md';
|
|
||||||
|
|
||||||
export const positions = [
|
interface PositionPosting {
|
||||||
{
|
name: string;
|
||||||
name: 'TypeScript React UI/UX Engineer',
|
type: string;
|
||||||
type: 'Full-time',
|
salary: string;
|
||||||
salary: '$80k - $120k',
|
description: string;
|
||||||
description: `You'll build the primary desktop interface for Spacedrive in React, with TypeScript and Tailwind. You'll need an eye for design as well as a solid understanding of the React ecosystem.`
|
}
|
||||||
},
|
|
||||||
{
|
export const positions: PositionPosting[] = [];
|
||||||
name: 'Rust Backend Engineer',
|
|
||||||
type: 'Full-time',
|
|
||||||
salary: '$80k - $120k',
|
|
||||||
description: `You'll build out our Rust core, the decentralized backend that powers our app. From the virtual filesystem to encryption and search. You'll need to live and breathe Rust, not be afraid to get low-level.`
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'TypeScript React Native Engineer',
|
|
||||||
type: 'Full-time',
|
|
||||||
salary: '$80k - $120k',
|
|
||||||
description: `You'll build out the majority of our mobile app in TypeScript and React Native. Developing a mobile first component library based on the design of our desktop application. You'll need to be passionate for building React Native apps that look and feel native.`
|
|
||||||
}
|
|
||||||
];
|
|
||||||
const values = [
|
const values = [
|
||||||
{
|
{
|
||||||
title: 'Async',
|
title: 'Async',
|
||||||
|
@ -129,25 +115,29 @@ function Page() {
|
||||||
See Open Positions
|
See Open Positions
|
||||||
</Button>
|
</Button>
|
||||||
<hr className="w-full my-24 border-gray-200 opacity-10 border-1" />
|
<hr className="w-full my-24 border-gray-200 opacity-10 border-1" />
|
||||||
<h1 className="px-2 mb-0 text-4xl font-black leading-tight text-center">Our Values</h1>
|
<h2 className="px-2 mb-0 text-4xl font-black leading-tight text-center">Our Values</h2>
|
||||||
<p className="mt-2 mb-4">What drives us daily.</p>
|
<p className="mt-2 mb-4">What drives us daily.</p>
|
||||||
<div className="grid w-full grid-cols-1 gap-4 mt-5 sm:grid-cols-2">
|
<div className="grid w-full grid-cols-1 gap-4 mt-5 sm:grid-cols-2">
|
||||||
{values.map((value) => (
|
{values.map((value, index) => (
|
||||||
<div className="flex flex-col p-10 bg-opacity-50 border border-gray-500 rounded-md bg-gray-550">
|
<div
|
||||||
|
key={value.title + index}
|
||||||
|
className="flex flex-col p-10 bg-opacity-50 border border-gray-500 rounded-md bg-gray-550"
|
||||||
|
>
|
||||||
<value.icon className="w-8 m-0" />
|
<value.icon className="w-8 m-0" />
|
||||||
<h2 className="mt-4 mb-1">{value.title}</h2>
|
<h3 className="mt-4 mb-1 leading-snug text-2xl font-bold">{value.title}</h3>
|
||||||
<p className="mt-1 mb-0 text-gray-350">{value.desc}</p>
|
<p className="mt-1 mb-0 text-gray-350">{value.desc}</p>
|
||||||
</div>
|
</div>
|
||||||
))}
|
))}
|
||||||
</div>
|
</div>
|
||||||
<hr className="w-full my-24 border-gray-200 opacity-10 border-1" />
|
<hr className="w-full my-24 border-gray-200 opacity-10 border-1" />
|
||||||
<h1 className="px-2 mb-0 text-4xl font-black leading-tight text-center text-white">
|
<h2 className="px-2 mb-0 text-4xl font-black leading-tight text-center text-white">
|
||||||
Perks and Benefits
|
Perks and Benefits
|
||||||
</h1>
|
</h2>
|
||||||
<p className="mt-2 mb-4">We're behind you 100%.</p>
|
<p className="mt-2 mb-4">We're behind you 100%.</p>
|
||||||
<div className="grid w-full grid-cols-1 gap-4 mt-5 sm:grid-cols-3">
|
<div className="grid w-full grid-cols-1 gap-4 mt-5 sm:grid-cols-3">
|
||||||
{perks.map((value) => (
|
{perks.map((value, index) => (
|
||||||
<div
|
<div
|
||||||
|
key={value.title + index}
|
||||||
style={{ backgroundColor: value.color + '10', borderColor: value.color + '30' }}
|
style={{ backgroundColor: value.color + '10', borderColor: value.color + '30' }}
|
||||||
className="flex flex-col p-8 border rounded-md bg-gray-550 bg-opacity-30"
|
className="flex flex-col p-8 border rounded-md bg-gray-550 bg-opacity-30"
|
||||||
>
|
>
|
||||||
|
@ -158,37 +148,44 @@ function Page() {
|
||||||
))}
|
))}
|
||||||
</div>
|
</div>
|
||||||
<hr className="w-full my-24 border-gray-200 opacity-10 border-1" ref={openPositionsRef} />
|
<hr className="w-full my-24 border-gray-200 opacity-10 border-1" ref={openPositionsRef} />
|
||||||
<h1 className="px-2 mb-0 text-4xl font-black leading-tight text-center text-white">
|
<h2 className="px-2 mb-0 text-4xl font-black leading-tight text-center text-white">
|
||||||
Open Positions
|
Open Positions
|
||||||
</h1>
|
</h2>
|
||||||
<p className="mt-2 mb-4">Any of these suit you? Apply now!</p>
|
<p className="mt-2 mb-4">If any open positions suit you, apply now!</p>
|
||||||
<div className="grid w-full grid-cols-1 gap-4 mt-5">
|
<div className="grid w-full grid-cols-1 gap-4 mt-5">
|
||||||
{positions.map((value) => (
|
{positions.length === 0 ? (
|
||||||
<div className="flex flex-col p-10 bg-opacity-50 border border-gray-500 rounded-md bg-gray-550">
|
<p className="m-0 text-gray-350 text-center">
|
||||||
<div className="flex flex-col sm:flex-row">
|
There are no positions open at this time. Please check back later!
|
||||||
<h2 className="m-0">{value.name}</h2>
|
</p>
|
||||||
<div className="mt-3 sm:mt-0.5">
|
) : (
|
||||||
<span className="text-sm font-semibold text-gray-300 sm:ml-4">
|
positions.map((value, index) => (
|
||||||
<CurrencyDollarIcon className="inline w-4 mr-1 -mt-1" />
|
<div
|
||||||
{value.salary}
|
key={value.name + index}
|
||||||
</span>
|
className="flex flex-col p-10 bg-opacity-50 border border-gray-500 rounded-md bg-gray-550"
|
||||||
<span className="ml-4 text-sm font-semibold text-gray-300">
|
>
|
||||||
<ClockIcon className="inline w-4 mr-1 -mt-1" />
|
<div className="flex flex-col sm:flex-row">
|
||||||
{value.type}
|
<h3 className="m-0 text-2xl leading-tight">{value.name}</h3>
|
||||||
</span>
|
<div className="mt-3 sm:mt-0.5">
|
||||||
|
<span className="text-sm font-semibold text-gray-300 sm:ml-4">
|
||||||
|
<CurrencyDollarIcon className="inline w-4 mr-1 -mt-1" />
|
||||||
|
{value.salary}
|
||||||
|
</span>
|
||||||
|
<span className="ml-4 text-sm font-semibold text-gray-300">
|
||||||
|
<ClockIcon className="inline w-4 mr-1 -mt-1" />
|
||||||
|
{value.type}
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<p className="mt-3 mb-0 text-gray-350">{value.description}</p>
|
||||||
</div>
|
</div>
|
||||||
<p className="mt-3 mb-0 text-gray-350">{value.description}</p>
|
))
|
||||||
</div>
|
)}
|
||||||
))}
|
|
||||||
</div>
|
</div>
|
||||||
<hr className="w-full my-24 border-gray-200 opacity-10 border-1" />
|
<hr className="w-full my-24 border-gray-200 opacity-10 border-1" />
|
||||||
<h1 className="px-2 mb-0 text-3xl font-black leading-tight text-center text-white">
|
<h2 className="px-2 mb-0 text-3xl font-black text-center text-white">How to apply?</h2>
|
||||||
How to apply?
|
<p className="mt-2">
|
||||||
</h1>
|
Send your cover letter and resume to <strong>careers at spacedrive dot com</strong> and
|
||||||
<p>
|
we'll get back to you shortly!
|
||||||
Send your cover letter and resume to <b>careers at spacedrive dot com</b> and we'll get
|
|
||||||
back to you shortly!
|
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -196,4 +193,4 @@ function Page() {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
export default Page;
|
export { Page };
|
||||||
|
|
|
@ -16,4 +16,4 @@ function Page() {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
export default Page;
|
export { Page };
|
||||||
|
|
|
@ -19,4 +19,4 @@ function Page() {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
export default Page;
|
export { Page };
|
||||||
|
|
|
@ -16,4 +16,4 @@ function Page() {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
export default Page;
|
export { Page };
|
||||||
|
|
|
@ -20,7 +20,7 @@ interface SectionProps {
|
||||||
}
|
}
|
||||||
|
|
||||||
function Section(props: SectionProps = { orientation: 'left' }) {
|
function Section(props: SectionProps = { orientation: 'left' }) {
|
||||||
let info = (
|
const info = (
|
||||||
<div className="px-4 py-10 sm:px-10">
|
<div className="px-4 py-10 sm:px-10">
|
||||||
{props.heading && <h1 className="text-2xl font-black sm:text-4xl">{props.heading}</h1>}
|
{props.heading && <h1 className="text-2xl font-black sm:text-4xl">{props.heading}</h1>}
|
||||||
{props.description && (
|
{props.description && (
|
||||||
|
@ -100,11 +100,11 @@ function Page() {
|
||||||
</Helmet>
|
</Helmet>
|
||||||
<div className="mt-22 lg:mt-28" id="content" aria-hidden="true" />
|
<div className="mt-22 lg:mt-28" id="content" aria-hidden="true" />
|
||||||
<div className="mt-24 lg:mt-5" />
|
<div className="mt-24 lg:mt-5" />
|
||||||
<NewBanner
|
<NewBanner
|
||||||
headline="Spacedrive raises $2M led by OSS Capital"
|
headline="Spacedrive raises $2M led by OSS Capital"
|
||||||
href="/blog/spacedrive-funding-announcement"
|
href="/blog/spacedrive-funding-announcement"
|
||||||
link="Read post"
|
link="Read post"
|
||||||
/>
|
/>
|
||||||
{unsubscribedFromWaitlist && (
|
{unsubscribedFromWaitlist && (
|
||||||
<div
|
<div
|
||||||
className={
|
className={
|
||||||
|
@ -144,6 +144,7 @@ function Page() {
|
||||||
className="transition text-primary-600 hover:text-primary-500"
|
className="transition text-primary-600 hover:text-primary-500"
|
||||||
href="https://github.com/spacedriveapp"
|
href="https://github.com/spacedriveapp"
|
||||||
target="_blank"
|
target="_blank"
|
||||||
|
rel="noreferrer"
|
||||||
>
|
>
|
||||||
Find out more →
|
Find out more →
|
||||||
</a>
|
</a>
|
||||||
|
@ -155,4 +156,4 @@ function Page() {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
export default Page;
|
export { Page };
|
||||||
|
|
|
@ -20,4 +20,4 @@ function Page() {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
export default Page;
|
export { Page };
|
||||||
|
|
|
@ -41,6 +41,23 @@ const teamMembers: Array<TeamMemberProps> = [
|
||||||
github: 'https://github.com/oscartbeaumont'
|
github: 'https://github.com/oscartbeaumont'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
name: 'Ericson Soares',
|
||||||
|
role: 'Rust Backend Engineer',
|
||||||
|
image: teamImages['ericson.jpg'],
|
||||||
|
socials: {
|
||||||
|
twitter: 'https://twitter.com/fogodev',
|
||||||
|
github: 'https://github.com/fogodev'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'Utku Bakir',
|
||||||
|
role: 'React Native Engineer',
|
||||||
|
image: teamImages['utku.jpg'],
|
||||||
|
socials: {
|
||||||
|
github: 'https://github.com/utkubakir'
|
||||||
|
}
|
||||||
|
},
|
||||||
{
|
{
|
||||||
name: 'Haden Fletcher',
|
name: 'Haden Fletcher',
|
||||||
role: 'Engineer & Designer',
|
role: 'Engineer & Designer',
|
||||||
|
@ -197,7 +214,7 @@ function Page() {
|
||||||
style={{ transform: 'scale(2)' }}
|
style={{ transform: 'scale(2)' }}
|
||||||
/>
|
/>
|
||||||
<div className="relative z-10">
|
<div className="relative z-10">
|
||||||
<h1 className="text-5xl leading-snug fade-in-heading ">
|
<h1 className="text-5xl leading-tight sm:leading-snug fade-in-heading ">
|
||||||
We believe file management should be <span className="title-gradient">universal</span>.
|
We believe file management should be <span className="title-gradient">universal</span>.
|
||||||
</h1>
|
</h1>
|
||||||
<p className="text-gray-400 animation-delay-2 fade-in-heading ">
|
<p className="text-gray-400 animation-delay-2 fade-in-heading ">
|
||||||
|
@ -228,7 +245,7 @@ function Page() {
|
||||||
<a
|
<a
|
||||||
href="https://github.com/spacedriveapp/spacedrive/graphs/contributors"
|
href="https://github.com/spacedriveapp/spacedrive/graphs/contributors"
|
||||||
target="_blank"
|
target="_blank"
|
||||||
rel="noreferer"
|
rel="noreferrer"
|
||||||
className="duration-200 oss-credit-gradient hover:opacity-75"
|
className="duration-200 oss-credit-gradient hover:opacity-75"
|
||||||
>
|
>
|
||||||
open source contributors
|
open source contributors
|
||||||
|
@ -253,4 +270,4 @@ function Page() {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
export default Page;
|
export { Page };
|
||||||
|
|
|
@ -1,43 +1,20 @@
|
||||||
import React from 'react';
|
import React from 'react'
|
||||||
import { Root, createRoot, hydrateRoot } from 'react-dom/client';
|
import { hydrateRoot } from 'react-dom/client'
|
||||||
import { useClientRouter } from 'vite-plugin-ssr/client/router';
|
import App from '../App'
|
||||||
import type { PageContextBuiltInClient } from 'vite-plugin-ssr/client/router';
|
import type { PageContext } from './types'
|
||||||
|
import type { PageContextBuiltInClient } from 'vite-plugin-ssr/client'
|
||||||
|
|
||||||
import { App } from '../App';
|
export { render }
|
||||||
import type { PageContext } from './types';
|
|
||||||
|
|
||||||
let root: Root;
|
async function render(pageContext: PageContextBuiltInClient & PageContext) {
|
||||||
const { hydrationPromise } = useClientRouter({
|
const { Page, pageProps } = pageContext
|
||||||
render(pageContext: PageContextBuiltInClient & PageContext) {
|
hydrateRoot(
|
||||||
const { Page, pageProps } = pageContext;
|
document.getElementById('page-view')!,
|
||||||
const page = (
|
<App pageContext={pageContext as any}>
|
||||||
<App pageContext={pageContext as any}>
|
<Page {...pageProps} />
|
||||||
<Page {...pageProps} />
|
</App>,
|
||||||
</App>
|
)
|
||||||
);
|
}
|
||||||
const container = document.getElementById('page-view')!;
|
|
||||||
if (pageContext.isHydration) {
|
|
||||||
root = hydrateRoot(container, page);
|
|
||||||
} else {
|
|
||||||
if (!root) {
|
|
||||||
root = createRoot(container);
|
|
||||||
}
|
|
||||||
root.render(page);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// onTransitionStart,
|
|
||||||
// onTransitionEnd
|
|
||||||
});
|
|
||||||
|
|
||||||
hydrationPromise.then(() => {
|
export const clientRouting = true
|
||||||
console.log('Hydration finished; page is now interactive.');
|
|
||||||
});
|
|
||||||
|
|
||||||
// function onTransitionStart() {
|
|
||||||
// console.log('Page transition start');
|
|
||||||
// document.getElementById('page-view')!.classList.add('page-transition');
|
|
||||||
// }
|
|
||||||
// function onTransitionEnd() {
|
|
||||||
// console.log('Page transition end');
|
|
||||||
// document.getElementById('#page-content')!.classList.remove('page-transition');
|
|
||||||
// }
|
|
||||||
|
|
|
@ -4,7 +4,7 @@ import { Helmet } from 'react-helmet';
|
||||||
import { dangerouslySkipEscape, escapeInject } from 'vite-plugin-ssr';
|
import { dangerouslySkipEscape, escapeInject } from 'vite-plugin-ssr';
|
||||||
import type { PageContextBuiltIn } from 'vite-plugin-ssr';
|
import type { PageContextBuiltIn } from 'vite-plugin-ssr';
|
||||||
|
|
||||||
import { App } from '../App';
|
import App from '../App';
|
||||||
import type { PageContext } from './types';
|
import type { PageContext } from './types';
|
||||||
|
|
||||||
export { render };
|
export { render };
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
export type PageProps = {}
|
export type PageProps = Record<string, unknown>;
|
||||||
// The `pageContext` that are available in both on the server-side and browser-side
|
// The `pageContext` that are available in both on the server-side and browser-side
|
||||||
export type PageContext = {
|
export type PageContext = {
|
||||||
Page: (pageProps: PageProps) => React.ReactElement
|
Page: (pageProps: PageProps) => React.ReactElement;
|
||||||
pageProps: PageProps
|
pageProps: PageProps;
|
||||||
urlPathname: string
|
urlPathname: string;
|
||||||
documentProps?: {
|
documentProps?: {
|
||||||
title?: string
|
title?: string;
|
||||||
description?: string
|
description?: string;
|
||||||
}
|
};
|
||||||
}
|
};
|
||||||
|
|
|
@ -6,9 +6,9 @@ export function getWindow(): (Window & typeof globalThis) | null {
|
||||||
return typeof window !== 'undefined' ? window : null;
|
return typeof window !== 'undefined' ? window : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// eslint-disable-next-line no-useless-escape
|
||||||
const FILE_NAME_REGEX = /^.*[\\\/]/;
|
const FILE_NAME_REGEX = /^.*[\\\/]/;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Extracts the file name including its extension from a file path
|
* Extracts the file name including its extension from a file path
|
||||||
*/
|
*/
|
||||||
|
@ -19,7 +19,7 @@ export function filename(path: string) {
|
||||||
/**
|
/**
|
||||||
* Takes the result of `import.meta.globEager` and returns an object
|
* Takes the result of `import.meta.globEager` and returns an object
|
||||||
* with the keys being the file names and the values being the imported file.
|
* with the keys being the file names and the values being the imported file.
|
||||||
*
|
*
|
||||||
* Does not work with directories.
|
* Does not work with directories.
|
||||||
*/
|
*/
|
||||||
export function resolveFilesGlob(files: Record<string, any>): Record<string, string> {
|
export function resolveFilesGlob(files: Record<string, any>): Record<string, string> {
|
||||||
|
|
|
@ -1,9 +1,10 @@
|
||||||
{
|
{
|
||||||
"extends": "../../packages/config/interface.tsconfig.json",
|
"extends": "../../packages/config/interface.tsconfig.json",
|
||||||
"compilerOptions": {
|
"include": ["src"],
|
||||||
"paths": {
|
"ts-node": {
|
||||||
"~/docs/*": ["../../docs/*"]
|
"transpileOnly": true,
|
||||||
}
|
"compilerOptions": {
|
||||||
},
|
"module": "CommonJS"
|
||||||
"include": ["src"]
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,10 +4,8 @@ import md, { Mode } from 'vite-plugin-markdown';
|
||||||
import ssr from 'vite-plugin-ssr/plugin';
|
import ssr from 'vite-plugin-ssr/plugin';
|
||||||
import svg from 'vite-plugin-svgr';
|
import svg from 'vite-plugin-svgr';
|
||||||
|
|
||||||
// https://vitejs.dev/config/
|
|
||||||
export default defineConfig({
|
export default defineConfig({
|
||||||
// @ts-ignore
|
plugins: [react(), ssr({ prerender: true }), svg(), md({ mode: [Mode.REACT] })],
|
||||||
plugins: [react(), ssr(), svg(), md({ mode: [Mode.REACT] })],
|
|
||||||
resolve: {
|
resolve: {
|
||||||
alias: {
|
alias: {
|
||||||
'~/docs': __dirname + '../../../docs'
|
'~/docs': __dirname + '../../../docs'
|
||||||
|
|
6
apps/mobile/.buckconfig
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
|
||||||
|
[android]
|
||||||
|
target = Google Inc.:Google APIs:23
|
||||||
|
|
||||||
|
[maven_repositories]
|
||||||
|
central = https://repo1.maven.org/maven2
|
42
apps/mobile/.eslintrc.js
Normal file
|
@ -0,0 +1,42 @@
|
||||||
|
module.exports = {
|
||||||
|
env: {
|
||||||
|
'react-native/react-native': true
|
||||||
|
},
|
||||||
|
parser: '@typescript-eslint/parser',
|
||||||
|
parserOptions: {
|
||||||
|
ecmaFeatures: {
|
||||||
|
jsx: true
|
||||||
|
},
|
||||||
|
ecmaVersion: 12,
|
||||||
|
sourceType: 'module'
|
||||||
|
},
|
||||||
|
extends: [
|
||||||
|
'eslint:recommended',
|
||||||
|
'plugin:react/recommended',
|
||||||
|
'plugin:react-hooks/recommended',
|
||||||
|
'plugin:@typescript-eslint/recommended'
|
||||||
|
],
|
||||||
|
plugins: ['react', 'react-native'],
|
||||||
|
rules: {
|
||||||
|
'react/display-name': 'off',
|
||||||
|
'react/prop-types': 'off',
|
||||||
|
'react/no-unescaped-entities': 'off',
|
||||||
|
'react/react-in-jsx-scope': 'off',
|
||||||
|
'react-hooks/rules-of-hooks': 'error',
|
||||||
|
'react-hooks/exhaustive-deps': 'warn',
|
||||||
|
'@typescript-eslint/no-unused-vars': 'off',
|
||||||
|
'@typescript-eslint/ban-ts-comment': 'off',
|
||||||
|
'@typescript-eslint/no-explicit-any': 'off',
|
||||||
|
'@typescript-eslint/no-var-requires': 'off',
|
||||||
|
'@typescript-eslint/no-non-null-assertion': 'off',
|
||||||
|
'@typescript-eslint/explicit-module-boundary-types': 'off',
|
||||||
|
'no-control-regex': 'off',
|
||||||
|
'no-mixed-spaces-and-tabs': ['warn', 'smart-tabs']
|
||||||
|
},
|
||||||
|
ignorePatterns: ['**/*.js', '**/*.json', 'node_modules', 'android', 'ios', '.expo'],
|
||||||
|
settings: {
|
||||||
|
react: {
|
||||||
|
version: 'detect'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
1
apps/mobile/.gitattributes
vendored
Normal file
|
@ -0,0 +1 @@
|
||||||
|
*.pbxproj -text
|
55
apps/mobile/.gitignore
vendored
Normal file
|
@ -0,0 +1,55 @@
|
||||||
|
# OSX
|
||||||
|
#
|
||||||
|
.DS_Store
|
||||||
|
|
||||||
|
# Xcode
|
||||||
|
#
|
||||||
|
build/
|
||||||
|
*.pbxuser
|
||||||
|
!default.pbxuser
|
||||||
|
*.mode1v3
|
||||||
|
!default.mode1v3
|
||||||
|
*.mode2v3
|
||||||
|
!default.mode2v3
|
||||||
|
*.perspectivev3
|
||||||
|
!default.perspectivev3
|
||||||
|
xcuserdata
|
||||||
|
*.xccheckout
|
||||||
|
*.moved-aside
|
||||||
|
DerivedData
|
||||||
|
*.hmap
|
||||||
|
*.ipa
|
||||||
|
*.xcuserstate
|
||||||
|
project.xcworkspace
|
||||||
|
|
||||||
|
# Android/IntelliJ
|
||||||
|
#
|
||||||
|
build/
|
||||||
|
.idea
|
||||||
|
.gradle
|
||||||
|
local.properties
|
||||||
|
*.iml
|
||||||
|
*.hprof
|
||||||
|
|
||||||
|
# node.js
|
||||||
|
#
|
||||||
|
node_modules/
|
||||||
|
npm-debug.log
|
||||||
|
yarn-error.log
|
||||||
|
|
||||||
|
# BUCK
|
||||||
|
buck-out/
|
||||||
|
\.buckd/
|
||||||
|
*.keystore
|
||||||
|
!debug.keystore
|
||||||
|
|
||||||
|
# Bundle artifacts
|
||||||
|
*.jsbundle
|
||||||
|
|
||||||
|
# CocoaPods
|
||||||
|
/ios/Pods/
|
||||||
|
|
||||||
|
# Expo
|
||||||
|
.expo/
|
||||||
|
web-build/
|
||||||
|
dist/
|
3
apps/mobile/.npmrc
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
strict-peer-dependencies = false
|
||||||
|
ignore-workspace-root-check = true
|
||||||
|
shamefully-hoist = true
|
3
apps/mobile/README.md
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
Make sure to run `pnpm i` in this folder after making changes to the `packages`.
|
||||||
|
|
||||||
|
- Note: If you add/remove something from `packages/assets` folder, you need to delete node_modules and run `pnpm i` again to link it.
|
21
apps/mobile/android/.gitignore
vendored
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
# OSX
|
||||||
|
#
|
||||||
|
.DS_Store
|
||||||
|
|
||||||
|
# Android/IntelliJ
|
||||||
|
#
|
||||||
|
build/
|
||||||
|
.idea
|
||||||
|
.gradle
|
||||||
|
local.properties
|
||||||
|
*.iml
|
||||||
|
*.hprof
|
||||||
|
|
||||||
|
# BUCK
|
||||||
|
buck-out/
|
||||||
|
\.buckd/
|
||||||
|
*.keystore
|
||||||
|
!debug.keystore
|
||||||
|
|
||||||
|
# Bundle artifacts
|
||||||
|
*.jsbundle
|
55
apps/mobile/android/app/BUCK
Normal file
|
@ -0,0 +1,55 @@
|
||||||
|
# To learn about Buck see [Docs](https://buckbuild.com/).
|
||||||
|
# To run your application with Buck:
|
||||||
|
# - install Buck
|
||||||
|
# - `npm start` - to start the packager
|
||||||
|
# - `cd android`
|
||||||
|
# - `keytool -genkey -v -keystore keystores/debug.keystore -storepass android -alias androiddebugkey -keypass android -dname "CN=Android Debug,O=Android,C=US"`
|
||||||
|
# - `./gradlew :app:copyDownloadableDepsToLibs` - make all Gradle compile dependencies available to Buck
|
||||||
|
# - `buck install -r android/app` - compile, install and run application
|
||||||
|
#
|
||||||
|
|
||||||
|
load(":build_defs.bzl", "create_aar_targets", "create_jar_targets")
|
||||||
|
|
||||||
|
lib_deps = []
|
||||||
|
|
||||||
|
create_aar_targets(glob(["libs/*.aar"]))
|
||||||
|
|
||||||
|
create_jar_targets(glob(["libs/*.jar"]))
|
||||||
|
|
||||||
|
android_library(
|
||||||
|
name = "all-libs",
|
||||||
|
exported_deps = lib_deps,
|
||||||
|
)
|
||||||
|
|
||||||
|
android_library(
|
||||||
|
name = "app-code",
|
||||||
|
srcs = glob([
|
||||||
|
"src/main/java/**/*.java",
|
||||||
|
]),
|
||||||
|
deps = [
|
||||||
|
":all-libs",
|
||||||
|
":build_config",
|
||||||
|
":res",
|
||||||
|
],
|
||||||
|
)
|
||||||
|
|
||||||
|
android_build_config(
|
||||||
|
name = "build_config",
|
||||||
|
package = "com.spacedrive.app",
|
||||||
|
)
|
||||||
|
|
||||||
|
android_resource(
|
||||||
|
name = "res",
|
||||||
|
package = "com.spacedrive.app",
|
||||||
|
res = "src/main/res",
|
||||||
|
)
|
||||||
|
|
||||||
|
android_binary(
|
||||||
|
name = "app",
|
||||||
|
keystore = "//android/keystores:debug",
|
||||||
|
manifest = "src/main/AndroidManifest.xml",
|
||||||
|
package_type = "debug",
|
||||||
|
deps = [
|
||||||
|
":app-code",
|
||||||
|
],
|
||||||
|
)
|
394
apps/mobile/android/app/build.gradle
Normal file
|
@ -0,0 +1,394 @@
|
||||||
|
apply plugin: "com.android.application"
|
||||||
|
|
||||||
|
import com.android.build.OutputFile
|
||||||
|
import org.apache.tools.ant.taskdefs.condition.Os
|
||||||
|
|
||||||
|
apply plugin: 'org.mozilla.rust-android-gradle.rust-android'
|
||||||
|
|
||||||
|
cargo {
|
||||||
|
module = "../../rust"
|
||||||
|
libname = "sdcore"
|
||||||
|
// profile = 'release',
|
||||||
|
pythonCommand = 'python3'
|
||||||
|
targets = ["arm", "arm64", "x86", "x86_64"]
|
||||||
|
targetDirectory = "../.././../../target" // Monorepo moment
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
tasks.whenTaskAdded { task ->
|
||||||
|
if ((task.name == 'javaPreCompileDebug' || task.name == 'javaPreCompileRelease')) {
|
||||||
|
task.dependsOn 'cargoBuild'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The react.gradle file registers a task for each build variant (e.g. bundleDebugJsAndAssets
|
||||||
|
* and bundleReleaseJsAndAssets).
|
||||||
|
* These basically call `react-native bundle` with the correct arguments during the Android build
|
||||||
|
* cycle. By default, bundleDebugJsAndAssets is skipped, as in debug/dev mode we prefer to load the
|
||||||
|
* bundle directly from the development server. Below you can see all the possible configurations
|
||||||
|
* and their defaults. If you decide to add a configuration block, make sure to add it before the
|
||||||
|
* `apply from: "../../node_modules/react-native/react.gradle"` line.
|
||||||
|
*
|
||||||
|
* project.ext.react = [
|
||||||
|
* // the name of the generated asset file containing your JS bundle
|
||||||
|
* bundleAssetName: "index.android.bundle",
|
||||||
|
*
|
||||||
|
* // the entry file for bundle generation. If none specified and
|
||||||
|
* // "index.android.js" exists, it will be used. Otherwise "index.js" is
|
||||||
|
* // default. Can be overridden with ENTRY_FILE environment variable.
|
||||||
|
* entryFile: "index.android.js",
|
||||||
|
*
|
||||||
|
* // https://reactnative.dev/docs/performance#enable-the-ram-format
|
||||||
|
* bundleCommand: "ram-bundle",
|
||||||
|
*
|
||||||
|
* // whether to bundle JS and assets in debug mode
|
||||||
|
* bundleInDebug: false,
|
||||||
|
*
|
||||||
|
* // whether to bundle JS and assets in release mode
|
||||||
|
* bundleInRelease: true,
|
||||||
|
*
|
||||||
|
* // whether to bundle JS and assets in another build variant (if configured).
|
||||||
|
* // See http://tools.android.com/tech-docs/new-build-system/user-guide#TOC-Build-Variants
|
||||||
|
* // The configuration property can be in the following formats
|
||||||
|
* // 'bundleIn${productFlavor}${buildType}'
|
||||||
|
* // 'bundleIn${buildType}'
|
||||||
|
* // bundleInFreeDebug: true,
|
||||||
|
* // bundleInPaidRelease: true,
|
||||||
|
* // bundleInBeta: true,
|
||||||
|
*
|
||||||
|
* // whether to disable dev mode in custom build variants (by default only disabled in release)
|
||||||
|
* // for example: to disable dev mode in the staging build type (if configured)
|
||||||
|
* devDisabledInStaging: true,
|
||||||
|
* // The configuration property can be in the following formats
|
||||||
|
* // 'devDisabledIn${productFlavor}${buildType}'
|
||||||
|
* // 'devDisabledIn${buildType}'
|
||||||
|
*
|
||||||
|
* // the root of your project, i.e. where "package.json" lives
|
||||||
|
* root: "../../",
|
||||||
|
*
|
||||||
|
* // where to put the JS bundle asset in debug mode
|
||||||
|
* jsBundleDirDebug: "$buildDir/intermediates/assets/debug",
|
||||||
|
*
|
||||||
|
* // where to put the JS bundle asset in release mode
|
||||||
|
* jsBundleDirRelease: "$buildDir/intermediates/assets/release",
|
||||||
|
*
|
||||||
|
* // where to put drawable resources / React Native assets, e.g. the ones you use via
|
||||||
|
* // require('./image.png')), in debug mode
|
||||||
|
* resourcesDirDebug: "$buildDir/intermediates/res/merged/debug",
|
||||||
|
*
|
||||||
|
* // where to put drawable resources / React Native assets, e.g. the ones you use via
|
||||||
|
* // require('./image.png')), in release mode
|
||||||
|
* resourcesDirRelease: "$buildDir/intermediates/res/merged/release",
|
||||||
|
*
|
||||||
|
* // by default the gradle tasks are skipped if none of the JS files or assets change; this means
|
||||||
|
* // that we don't look at files in android/ or ios/ to determine whether the tasks are up to
|
||||||
|
* // date; if you have any other folders that you want to ignore for performance reasons (gradle
|
||||||
|
* // indexes the entire tree), add them here. Alternatively, if you have JS files in android/
|
||||||
|
* // for example, you might want to remove it from here.
|
||||||
|
* inputExcludes: ["android/**", "ios/**"],
|
||||||
|
*
|
||||||
|
* // override which node gets called and with what additional arguments
|
||||||
|
* nodeExecutableAndArgs: ["node"],
|
||||||
|
*
|
||||||
|
* // supply additional arguments to the packager
|
||||||
|
* extraPackagerArgs: []
|
||||||
|
* ]
|
||||||
|
*/
|
||||||
|
|
||||||
|
def projectRoot = rootDir.getAbsoluteFile().getParentFile().getAbsolutePath()
|
||||||
|
|
||||||
|
def reactNativeRoot = new File(["node", "--print", "require.resolve('react-native/package.json')"].execute(null, rootDir).text.trim()).getParentFile().getAbsolutePath()
|
||||||
|
|
||||||
|
project.ext.react = [
|
||||||
|
entryFile: ["node", "-e", "require('expo/scripts/resolveAppEntry')", projectRoot, "android"].execute(null, rootDir).text.trim(),
|
||||||
|
enableHermes: (findProperty('expo.jsEngine') ?: "jsc") == "hermes",
|
||||||
|
hermesCommand: new File(["node", "--print", "require.resolve('react-native/package.json')"].execute(null, rootDir).text.trim()).getParentFile().getAbsolutePath() + "/sdks/hermesc/%OS-BIN%/hermesc",
|
||||||
|
cliPath: "${reactNativeRoot}/cli.js",
|
||||||
|
composeSourceMapsPath: "${reactNativeRoot}/scripts/compose-source-maps.js",
|
||||||
|
]
|
||||||
|
|
||||||
|
apply from: new File(reactNativeRoot, "react.gradle")
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set this to true to create two separate APKs instead of one:
|
||||||
|
* - An APK that only works on ARM devices
|
||||||
|
* - An APK that only works on x86 devices
|
||||||
|
* The advantage is the size of the APK is reduced by about 4MB.
|
||||||
|
* Upload all the APKs to the Play Store and people will download
|
||||||
|
* the correct one based on the CPU architecture of their device.
|
||||||
|
*/
|
||||||
|
def enableSeparateBuildPerCPUArchitecture = false
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Run Proguard to shrink the Java bytecode in release builds.
|
||||||
|
*/
|
||||||
|
def enableProguardInReleaseBuilds = (findProperty('android.enableProguardInReleaseBuilds') ?: false).toBoolean()
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The preferred build flavor of JavaScriptCore.
|
||||||
|
*
|
||||||
|
* For example, to use the international variant, you can use:
|
||||||
|
* `def jscFlavor = 'org.webkit:android-jsc-intl:+'`
|
||||||
|
*
|
||||||
|
* The international variant includes ICU i18n library and necessary data
|
||||||
|
* allowing to use e.g. `Date.toLocaleString` and `String.localeCompare` that
|
||||||
|
* give correct results when using with locales other than en-US. Note that
|
||||||
|
* this variant is about 6MiB larger per architecture than default.
|
||||||
|
*/
|
||||||
|
def jscFlavor = 'org.webkit:android-jsc:+'
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Whether to enable the Hermes VM.
|
||||||
|
*
|
||||||
|
* This should be set on project.ext.react and that value will be read here. If it is not set
|
||||||
|
* on project.ext.react, JavaScript will not be compiled to Hermes Bytecode
|
||||||
|
* and the benefits of using Hermes will therefore be sharply reduced.
|
||||||
|
*/
|
||||||
|
def enableHermes = project.ext.react.get("enableHermes", false);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Architectures to build native code for.
|
||||||
|
*/
|
||||||
|
def reactNativeArchitectures() {
|
||||||
|
def value = project.getProperties().get("reactNativeArchitectures")
|
||||||
|
return value ? value.split(",") : ["armeabi-v7a", "x86", "x86_64", "arm64-v8a"]
|
||||||
|
}
|
||||||
|
|
||||||
|
android {
|
||||||
|
ndkVersion rootProject.ext.ndkVersion
|
||||||
|
|
||||||
|
compileSdkVersion rootProject.ext.compileSdkVersion
|
||||||
|
|
||||||
|
defaultConfig {
|
||||||
|
applicationId 'com.spacedrive.app'
|
||||||
|
minSdkVersion rootProject.ext.minSdkVersion
|
||||||
|
targetSdkVersion rootProject.ext.targetSdkVersion
|
||||||
|
versionCode 1
|
||||||
|
versionName "0.0.1"
|
||||||
|
buildConfigField "boolean", "IS_NEW_ARCHITECTURE_ENABLED", isNewArchitectureEnabled().toString()
|
||||||
|
|
||||||
|
if (isNewArchitectureEnabled()) {
|
||||||
|
// We configure the NDK build only if you decide to opt-in for the New Architecture.
|
||||||
|
externalNativeBuild {
|
||||||
|
ndkBuild {
|
||||||
|
arguments "APP_PLATFORM=android-21",
|
||||||
|
"APP_STL=c++_shared",
|
||||||
|
"NDK_TOOLCHAIN_VERSION=clang",
|
||||||
|
"GENERATED_SRC_DIR=$buildDir/generated/source",
|
||||||
|
"PROJECT_BUILD_DIR=$buildDir",
|
||||||
|
"REACT_ANDROID_DIR=${reactNativeRoot}/ReactAndroid",
|
||||||
|
"REACT_ANDROID_BUILD_DIR=${reactNativeRoot}/ReactAndroid/build",
|
||||||
|
"NODE_MODULES_DIR=$rootDir/../node_modules"
|
||||||
|
cFlags "-Wall", "-Werror", "-fexceptions", "-frtti", "-DWITH_INSPECTOR=1"
|
||||||
|
cppFlags "-std=c++17"
|
||||||
|
// Make sure this target name is the same you specify inside the
|
||||||
|
// src/main/jni/Android.mk file for the `LOCAL_MODULE` variable.
|
||||||
|
targets "spacedrive_appmodules"
|
||||||
|
|
||||||
|
// Fix for windows limit on number of character in file paths and in command lines
|
||||||
|
if (Os.isFamily(Os.FAMILY_WINDOWS)) {
|
||||||
|
arguments "NDK_APP_SHORT_COMMANDS=true"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!enableSeparateBuildPerCPUArchitecture) {
|
||||||
|
ndk {
|
||||||
|
abiFilters (*reactNativeArchitectures())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isNewArchitectureEnabled()) {
|
||||||
|
// We configure the NDK build only if you decide to opt-in for the New Architecture.
|
||||||
|
externalNativeBuild {
|
||||||
|
ndkBuild {
|
||||||
|
path "$projectDir/src/main/jni/Android.mk"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
def reactAndroidProjectDir = project(':ReactAndroid').projectDir
|
||||||
|
def packageReactNdkDebugLibs = tasks.register("packageReactNdkDebugLibs", Copy) {
|
||||||
|
dependsOn(":ReactAndroid:packageReactNdkDebugLibsForBuck")
|
||||||
|
from("$reactAndroidProjectDir/src/main/jni/prebuilt/lib")
|
||||||
|
into("$buildDir/react-ndk/exported")
|
||||||
|
}
|
||||||
|
def packageReactNdkReleaseLibs = tasks.register("packageReactNdkReleaseLibs", Copy) {
|
||||||
|
dependsOn(":ReactAndroid:packageReactNdkReleaseLibsForBuck")
|
||||||
|
from("$reactAndroidProjectDir/src/main/jni/prebuilt/lib")
|
||||||
|
into("$buildDir/react-ndk/exported")
|
||||||
|
}
|
||||||
|
afterEvaluate {
|
||||||
|
// If you wish to add a custom TurboModule or component locally,
|
||||||
|
// you should uncomment this line.
|
||||||
|
// preBuild.dependsOn("generateCodegenArtifactsFromSchema")
|
||||||
|
preDebugBuild.dependsOn(packageReactNdkDebugLibs)
|
||||||
|
preReleaseBuild.dependsOn(packageReactNdkReleaseLibs)
|
||||||
|
|
||||||
|
// Due to a bug inside AGP, we have to explicitly set a dependency
|
||||||
|
// between configureNdkBuild* tasks and the preBuild tasks.
|
||||||
|
// This can be removed once this is solved: https://issuetracker.google.com/issues/207403732
|
||||||
|
configureNdkBuildRelease.dependsOn(preReleaseBuild)
|
||||||
|
configureNdkBuildDebug.dependsOn(preDebugBuild)
|
||||||
|
reactNativeArchitectures().each { architecture ->
|
||||||
|
tasks.findByName("configureNdkBuildDebug[${architecture}]")?.configure {
|
||||||
|
dependsOn("preDebugBuild")
|
||||||
|
}
|
||||||
|
tasks.findByName("configureNdkBuildRelease[${architecture}]")?.configure {
|
||||||
|
dependsOn("preReleaseBuild")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
splits {
|
||||||
|
abi {
|
||||||
|
reset()
|
||||||
|
enable enableSeparateBuildPerCPUArchitecture
|
||||||
|
universalApk false // If true, also generate a universal APK
|
||||||
|
include (*reactNativeArchitectures())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
signingConfigs {
|
||||||
|
debug {
|
||||||
|
storeFile file('debug.keystore')
|
||||||
|
storePassword 'android'
|
||||||
|
keyAlias 'androiddebugkey'
|
||||||
|
keyPassword 'android'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
buildTypes {
|
||||||
|
debug {
|
||||||
|
signingConfig signingConfigs.debug
|
||||||
|
}
|
||||||
|
release {
|
||||||
|
// Caution! In production, you need to generate your own keystore file.
|
||||||
|
// see https://reactnative.dev/docs/signed-apk-android.
|
||||||
|
signingConfig signingConfigs.debug
|
||||||
|
minifyEnabled enableProguardInReleaseBuilds
|
||||||
|
proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// applicationVariants are e.g. debug, release
|
||||||
|
applicationVariants.all { variant ->
|
||||||
|
variant.outputs.each { output ->
|
||||||
|
// For each separate APK per architecture, set a unique version code as described here:
|
||||||
|
// https://developer.android.com/studio/build/configure-apk-splits.html
|
||||||
|
def versionCodes = ["armeabi-v7a": 1, "x86": 2, "arm64-v8a": 3, "x86_64": 4]
|
||||||
|
def abi = output.getFilter(OutputFile.ABI)
|
||||||
|
if (abi != null) { // null for the universal-debug, universal-release variants
|
||||||
|
output.versionCodeOverride =
|
||||||
|
versionCodes.get(abi) * 1048576 + defaultConfig.versionCode
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Apply static values from `gradle.properties` to the `android.packagingOptions`
|
||||||
|
// Accepts values in comma delimited lists, example:
|
||||||
|
// android.packagingOptions.pickFirsts=/LICENSE,**/picasa.ini
|
||||||
|
["pickFirsts", "excludes", "merges", "doNotStrip"].each { prop ->
|
||||||
|
// Split option: 'foo,bar' -> ['foo', 'bar']
|
||||||
|
def options = (findProperty("android.packagingOptions.$prop") ?: "").split(",");
|
||||||
|
// Trim all elements in place.
|
||||||
|
for (i in 0..<options.size()) options[i] = options[i].trim();
|
||||||
|
// `[] - ""` is essentially `[""].filter(Boolean)` removing all empty strings.
|
||||||
|
options -= ""
|
||||||
|
|
||||||
|
if (options.length > 0) {
|
||||||
|
println "android.packagingOptions.$prop += $options ($options.length)"
|
||||||
|
// Ex: android.packagingOptions.pickFirsts += '**/SCCS/**'
|
||||||
|
options.each {
|
||||||
|
android.packagingOptions[prop] += it
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
implementation fileTree(dir: "libs", include: ["*.jar"])
|
||||||
|
|
||||||
|
//noinspection GradleDynamicVersion
|
||||||
|
implementation "com.facebook.react:react-native:+" // From node_modules
|
||||||
|
|
||||||
|
def isGifEnabled = (findProperty('expo.gif.enabled') ?: "") == "true";
|
||||||
|
def isWebpEnabled = (findProperty('expo.webp.enabled') ?: "") == "true";
|
||||||
|
def isWebpAnimatedEnabled = (findProperty('expo.webp.animated') ?: "") == "true";
|
||||||
|
def frescoVersion = rootProject.ext.frescoVersion
|
||||||
|
|
||||||
|
// If your app supports Android versions before Ice Cream Sandwich (API level 14)
|
||||||
|
if (isGifEnabled || isWebpEnabled) {
|
||||||
|
implementation "com.facebook.fresco:fresco:${frescoVersion}"
|
||||||
|
implementation "com.facebook.fresco:imagepipeline-okhttp3:${frescoVersion}"
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isGifEnabled) {
|
||||||
|
// For animated gif support
|
||||||
|
implementation "com.facebook.fresco:animated-gif:${frescoVersion}"
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isWebpEnabled) {
|
||||||
|
// For webp support
|
||||||
|
implementation "com.facebook.fresco:webpsupport:${frescoVersion}"
|
||||||
|
if (isWebpAnimatedEnabled) {
|
||||||
|
// Animated webp support
|
||||||
|
implementation "com.facebook.fresco:animated-webp:${frescoVersion}"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
implementation "androidx.swiperefreshlayout:swiperefreshlayout:1.0.0"
|
||||||
|
debugImplementation("com.facebook.flipper:flipper:${FLIPPER_VERSION}") {
|
||||||
|
exclude group:'com.facebook.fbjni'
|
||||||
|
}
|
||||||
|
debugImplementation("com.facebook.flipper:flipper-network-plugin:${FLIPPER_VERSION}") {
|
||||||
|
exclude group:'com.facebook.flipper'
|
||||||
|
exclude group:'com.squareup.okhttp3', module:'okhttp'
|
||||||
|
}
|
||||||
|
debugImplementation("com.facebook.flipper:flipper-fresco-plugin:${FLIPPER_VERSION}") {
|
||||||
|
exclude group:'com.facebook.flipper'
|
||||||
|
}
|
||||||
|
|
||||||
|
if (enableHermes) {
|
||||||
|
//noinspection GradleDynamicVersion
|
||||||
|
implementation("com.facebook.react:hermes-engine:+") { // From node_modules
|
||||||
|
exclude group:'com.facebook.fbjni'
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
implementation jscFlavor
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isNewArchitectureEnabled()) {
|
||||||
|
// If new architecture is enabled, we let you build RN from source
|
||||||
|
// Otherwise we fallback to a prebuilt .aar bundled in the NPM package.
|
||||||
|
// This will be applied to all the imported transtitive dependency.
|
||||||
|
configurations.all {
|
||||||
|
resolutionStrategy.dependencySubstitution {
|
||||||
|
substitute(module("com.facebook.react:react-native"))
|
||||||
|
.using(project(":ReactAndroid"))
|
||||||
|
.because("On New Architecture we're building React Native from source")
|
||||||
|
substitute(module("com.facebook.react:hermes-engine"))
|
||||||
|
.using(project(":ReactAndroid:hermes-engine"))
|
||||||
|
.because("On New Architecture we're building Hermes from source")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Run this once to be able to run the application with BUCK
|
||||||
|
// puts all compile dependencies into folder libs for BUCK to use
|
||||||
|
task copyDownloadableDepsToLibs(type: Copy) {
|
||||||
|
from configurations.implementation
|
||||||
|
into 'libs'
|
||||||
|
}
|
||||||
|
|
||||||
|
apply from: new File(["node", "--print", "require.resolve('@react-native-community/cli-platform-android/package.json')"].execute(null, rootDir).text.trim(), "../native_modules.gradle");
|
||||||
|
applyNativeModulesAppBuildGradle(project)
|
||||||
|
|
||||||
|
def isNewArchitectureEnabled() {
|
||||||
|
// To opt-in for the New Architecture, you can either:
|
||||||
|
// - Set `newArchEnabled` to true inside the `gradle.properties` file
|
||||||
|
// - Invoke gradle with `-newArchEnabled=true`
|
||||||
|
// - Set an environment variable `ORG_GRADLE_PROJECT_newArchEnabled=true`
|
||||||
|
return project.hasProperty("newArchEnabled") && project.newArchEnabled == "true"
|
||||||
|
}
|
19
apps/mobile/android/app/build_defs.bzl
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
"""Helper definitions to glob .aar and .jar targets"""
|
||||||
|
|
||||||
|
def create_aar_targets(aarfiles):
|
||||||
|
for aarfile in aarfiles:
|
||||||
|
name = "aars__" + aarfile[aarfile.rindex("/") + 1:aarfile.rindex(".aar")]
|
||||||
|
lib_deps.append(":" + name)
|
||||||
|
android_prebuilt_aar(
|
||||||
|
name = name,
|
||||||
|
aar = aarfile,
|
||||||
|
)
|
||||||
|
|
||||||
|
def create_jar_targets(jarfiles):
|
||||||
|
for jarfile in jarfiles:
|
||||||
|
name = "jars__" + jarfile[jarfile.rindex("/") + 1:jarfile.rindex(".jar")]
|
||||||
|
lib_deps.append(":" + name)
|
||||||
|
prebuilt_jar(
|
||||||
|
name = name,
|
||||||
|
binary_jar = jarfile,
|
||||||
|
)
|
BIN
apps/mobile/android/app/debug.keystore
Normal file
14
apps/mobile/android/app/proguard-rules.pro
vendored
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
# Add project specific ProGuard rules here.
|
||||||
|
# By default, the flags in this file are appended to flags specified
|
||||||
|
# in /usr/local/Cellar/android-sdk/24.3.3/tools/proguard/proguard-android.txt
|
||||||
|
# You can edit the include path and order by changing the proguardFiles
|
||||||
|
# directive in build.gradle.
|
||||||
|
#
|
||||||
|
# For more details, see
|
||||||
|
# http://developer.android.com/guide/developing/tools/proguard.html
|
||||||
|
|
||||||
|
# react-native-reanimated
|
||||||
|
-keep class com.swmansion.reanimated.** { *; }
|
||||||
|
-keep class com.facebook.react.turbomodule.** { *; }
|
||||||
|
|
||||||
|
# Add any project specific keep options here:
|
7
apps/mobile/android/app/src/debug/AndroidManifest.xml
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools">
|
||||||
|
|
||||||
|
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/>
|
||||||
|
|
||||||
|
<application android:usesCleartextTraffic="true" tools:targetApi="28" tools:ignore="GoogleAppIndexingWarning" />
|
||||||
|
</manifest>
|
|
@ -0,0 +1,69 @@
|
||||||
|
/**
|
||||||
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||||
|
*
|
||||||
|
* <p>This source code is licensed under the MIT license found in the LICENSE file in the root
|
||||||
|
* directory of this source tree.
|
||||||
|
*/
|
||||||
|
package com.spacedrive.app;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
import com.facebook.flipper.android.AndroidFlipperClient;
|
||||||
|
import com.facebook.flipper.android.utils.FlipperUtils;
|
||||||
|
import com.facebook.flipper.core.FlipperClient;
|
||||||
|
import com.facebook.flipper.plugins.crashreporter.CrashReporterPlugin;
|
||||||
|
import com.facebook.flipper.plugins.databases.DatabasesFlipperPlugin;
|
||||||
|
import com.facebook.flipper.plugins.fresco.FrescoFlipperPlugin;
|
||||||
|
import com.facebook.flipper.plugins.inspector.DescriptorMapping;
|
||||||
|
import com.facebook.flipper.plugins.inspector.InspectorFlipperPlugin;
|
||||||
|
import com.facebook.flipper.plugins.network.FlipperOkhttpInterceptor;
|
||||||
|
import com.facebook.flipper.plugins.network.NetworkFlipperPlugin;
|
||||||
|
import com.facebook.flipper.plugins.react.ReactFlipperPlugin;
|
||||||
|
import com.facebook.flipper.plugins.sharedpreferences.SharedPreferencesFlipperPlugin;
|
||||||
|
import com.facebook.react.ReactInstanceManager;
|
||||||
|
import com.facebook.react.bridge.ReactContext;
|
||||||
|
import com.facebook.react.modules.network.NetworkingModule;
|
||||||
|
import okhttp3.OkHttpClient;
|
||||||
|
|
||||||
|
public class ReactNativeFlipper {
|
||||||
|
public static void initializeFlipper(Context context, ReactInstanceManager reactInstanceManager) {
|
||||||
|
if (FlipperUtils.shouldEnableFlipper(context)) {
|
||||||
|
final FlipperClient client = AndroidFlipperClient.getInstance(context);
|
||||||
|
client.addPlugin(new InspectorFlipperPlugin(context, DescriptorMapping.withDefaults()));
|
||||||
|
client.addPlugin(new ReactFlipperPlugin());
|
||||||
|
client.addPlugin(new DatabasesFlipperPlugin(context));
|
||||||
|
client.addPlugin(new SharedPreferencesFlipperPlugin(context));
|
||||||
|
client.addPlugin(CrashReporterPlugin.getInstance());
|
||||||
|
NetworkFlipperPlugin networkFlipperPlugin = new NetworkFlipperPlugin();
|
||||||
|
NetworkingModule.setCustomClientBuilder(
|
||||||
|
new NetworkingModule.CustomClientBuilder() {
|
||||||
|
@Override
|
||||||
|
public void apply(OkHttpClient.Builder builder) {
|
||||||
|
builder.addNetworkInterceptor(new FlipperOkhttpInterceptor(networkFlipperPlugin));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
client.addPlugin(networkFlipperPlugin);
|
||||||
|
client.start();
|
||||||
|
// Fresco Plugin needs to ensure that ImagePipelineFactory is initialized
|
||||||
|
// Hence we run if after all native modules have been initialized
|
||||||
|
ReactContext reactContext = reactInstanceManager.getCurrentReactContext();
|
||||||
|
if (reactContext == null) {
|
||||||
|
reactInstanceManager.addReactInstanceEventListener(
|
||||||
|
new ReactInstanceManager.ReactInstanceEventListener() {
|
||||||
|
@Override
|
||||||
|
public void onReactContextInitialized(ReactContext reactContext) {
|
||||||
|
reactInstanceManager.removeReactInstanceEventListener(this);
|
||||||
|
reactContext.runOnNativeModulesQueueThread(
|
||||||
|
new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
client.addPlugin(new FrescoFlipperPlugin());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
client.addPlugin(new FrescoFlipperPlugin());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
35
apps/mobile/android/app/src/main/AndroidManifest.xml
Normal file
|
@ -0,0 +1,35 @@
|
||||||
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.spacedrive.app">
|
||||||
|
<uses-permission android:name="android.permission.INTERNET"/>
|
||||||
|
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
|
||||||
|
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/>
|
||||||
|
<uses-permission android:name="android.permission.VIBRATE"/>
|
||||||
|
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
|
||||||
|
<queries>
|
||||||
|
<intent>
|
||||||
|
<action android:name="android.intent.action.VIEW"/>
|
||||||
|
<category android:name="android.intent.category.BROWSABLE"/>
|
||||||
|
<data android:scheme="https"/>
|
||||||
|
</intent>
|
||||||
|
</queries>
|
||||||
|
<application android:name=".MainApplication" android:label="@string/app_name" android:icon="@mipmap/ic_launcher" android:roundIcon="@mipmap/ic_launcher_round" android:allowBackup="true" android:theme="@style/AppTheme" android:usesCleartextTraffic="true">
|
||||||
|
<meta-data android:name="expo.modules.updates.ENABLED" android:value="false"/>
|
||||||
|
<meta-data android:name="expo.modules.updates.EXPO_SDK_VERSION" android:value="46.0.0"/>
|
||||||
|
<meta-data android:name="expo.modules.updates.EXPO_UPDATES_CHECK_ON_LAUNCH" android:value="ALWAYS"/>
|
||||||
|
<meta-data android:name="expo.modules.updates.EXPO_UPDATES_LAUNCH_WAIT_MS" android:value="0"/>
|
||||||
|
<meta-data android:name="expo.modules.updates.EXPO_UPDATE_URL" android:value="https://exp.host/@utkudev/spacedrive"/>
|
||||||
|
<activity android:name=".MainActivity" android:label="@string/app_name" android:configChanges="keyboard|keyboardHidden|orientation|screenSize|uiMode" android:launchMode="singleTask" android:windowSoftInputMode="adjustResize" android:theme="@style/Theme.App.SplashScreen" android:exported="true" android:screenOrientation="portrait">
|
||||||
|
<intent-filter>
|
||||||
|
<action android:name="android.intent.action.MAIN"/>
|
||||||
|
<category android:name="android.intent.category.LAUNCHER"/>
|
||||||
|
</intent-filter>
|
||||||
|
<intent-filter>
|
||||||
|
<action android:name="android.intent.action.VIEW"/>
|
||||||
|
<category android:name="android.intent.category.DEFAULT"/>
|
||||||
|
<category android:name="android.intent.category.BROWSABLE"/>
|
||||||
|
<data android:scheme="spacedrive"/>
|
||||||
|
<data android:scheme="com.spacedrive.app"/>
|
||||||
|
</intent-filter>
|
||||||
|
</activity>
|
||||||
|
<activity android:name="com.facebook.react.devsupport.DevSettingsActivity" android:exported="false"/>
|
||||||
|
</application>
|
||||||
|
</manifest>
|
|
@ -0,0 +1,83 @@
|
||||||
|
package com.spacedrive.app;
|
||||||
|
|
||||||
|
import android.os.Build;
|
||||||
|
import android.os.Bundle;
|
||||||
|
|
||||||
|
import com.facebook.react.ReactActivity;
|
||||||
|
import com.facebook.react.ReactActivityDelegate;
|
||||||
|
import com.facebook.react.ReactRootView;
|
||||||
|
|
||||||
|
import expo.modules.ReactActivityDelegateWrapper;
|
||||||
|
|
||||||
|
public class MainActivity extends ReactActivity {
|
||||||
|
@Override
|
||||||
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
// Set the theme to AppTheme BEFORE onCreate to support
|
||||||
|
// coloring the background, status bar, and navigation bar.
|
||||||
|
// This is required for expo-splash-screen.
|
||||||
|
setTheme(R.style.AppTheme);
|
||||||
|
super.onCreate(null);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the name of the main component registered from JavaScript.
|
||||||
|
* This is used to schedule rendering of the component.
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
protected String getMainComponentName() {
|
||||||
|
return "main";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the instance of the {@link ReactActivityDelegate}. There the RootView is created and
|
||||||
|
* you can specify the renderer you wish to use - the new renderer (Fabric) or the old renderer
|
||||||
|
* (Paper).
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
protected ReactActivityDelegate createReactActivityDelegate() {
|
||||||
|
return new ReactActivityDelegateWrapper(this, BuildConfig.IS_NEW_ARCHITECTURE_ENABLED,
|
||||||
|
new MainActivityDelegate(this, getMainComponentName())
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Align the back button behavior with Android S
|
||||||
|
* where moving root activities to background instead of finishing activities.
|
||||||
|
* @see <a href="https://developer.android.com/reference/android/app/Activity#onBackPressed()">onBackPressed</a>
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void invokeDefaultOnBackPressed() {
|
||||||
|
if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.R) {
|
||||||
|
if (!moveTaskToBack(false)) {
|
||||||
|
// For non-root activities, use the default implementation to finish them.
|
||||||
|
super.invokeDefaultOnBackPressed();
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Use the default back button implementation on Android S
|
||||||
|
// because it's doing more than {@link Activity#moveTaskToBack} in fact.
|
||||||
|
super.invokeDefaultOnBackPressed();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class MainActivityDelegate extends ReactActivityDelegate {
|
||||||
|
public MainActivityDelegate(ReactActivity activity, String mainComponentName) {
|
||||||
|
super(activity, mainComponentName);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected ReactRootView createRootView() {
|
||||||
|
ReactRootView reactRootView = new ReactRootView(getContext());
|
||||||
|
// If you opted-in for the New Architecture, we enable the Fabric Renderer.
|
||||||
|
reactRootView.setIsFabric(BuildConfig.IS_NEW_ARCHITECTURE_ENABLED);
|
||||||
|
return reactRootView;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected boolean isConcurrentRootEnabled() {
|
||||||
|
// If you opted-in for the New Architecture, we enable Concurrent Root (i.e. React 18).
|
||||||
|
// More on this on https://reactjs.org/blog/2022/03/29/react-v18.html
|
||||||
|
return BuildConfig.IS_NEW_ARCHITECTURE_ENABLED;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,106 @@
|
||||||
|
package com.spacedrive.app;
|
||||||
|
|
||||||
|
import android.app.Application;
|
||||||
|
import android.content.Context;
|
||||||
|
import android.content.res.Configuration;
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
|
||||||
|
import com.facebook.react.PackageList;
|
||||||
|
import com.facebook.react.ReactApplication;
|
||||||
|
import com.facebook.react.ReactInstanceManager;
|
||||||
|
import com.facebook.react.ReactNativeHost;
|
||||||
|
import com.facebook.react.ReactPackage;
|
||||||
|
import com.facebook.react.config.ReactFeatureFlags;
|
||||||
|
import com.facebook.soloader.SoLoader;
|
||||||
|
import com.spacedrive.app.newarchitecture.MainApplicationReactNativeHost;
|
||||||
|
|
||||||
|
import expo.modules.ApplicationLifecycleDispatcher;
|
||||||
|
import expo.modules.ReactNativeHostWrapper;
|
||||||
|
|
||||||
|
import java.lang.reflect.InvocationTargetException;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class MainApplication extends Application implements ReactApplication {
|
||||||
|
private final ReactNativeHost mReactNativeHost = new ReactNativeHostWrapper(
|
||||||
|
this,
|
||||||
|
new ReactNativeHost(this) {
|
||||||
|
@Override
|
||||||
|
public boolean getUseDeveloperSupport() {
|
||||||
|
return BuildConfig.DEBUG;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected List<ReactPackage> getPackages() {
|
||||||
|
@SuppressWarnings("UnnecessaryLocalVariable")
|
||||||
|
List<ReactPackage> packages = new PackageList(this).getPackages();
|
||||||
|
// Packages that cannot be autolinked yet can be added manually here, for example:
|
||||||
|
packages.add(new com.spacedrive.app.SpacedrivePackage());
|
||||||
|
return packages;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String getJSMainModuleName() {
|
||||||
|
return "index";
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
private final ReactNativeHost mNewArchitectureNativeHost =
|
||||||
|
new ReactNativeHostWrapper(this, new MainApplicationReactNativeHost(this));
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ReactNativeHost getReactNativeHost() {
|
||||||
|
if (BuildConfig.IS_NEW_ARCHITECTURE_ENABLED) {
|
||||||
|
return mNewArchitectureNativeHost;
|
||||||
|
} else {
|
||||||
|
return mReactNativeHost;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onCreate() {
|
||||||
|
super.onCreate();
|
||||||
|
// If you opted-in for the New Architecture, we enable the TurboModule system
|
||||||
|
ReactFeatureFlags.useTurboModules = BuildConfig.IS_NEW_ARCHITECTURE_ENABLED;
|
||||||
|
SoLoader.init(this, /* native exopackage */ false);
|
||||||
|
|
||||||
|
initializeFlipper(this, getReactNativeHost().getReactInstanceManager());
|
||||||
|
ApplicationLifecycleDispatcher.onApplicationCreate(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onConfigurationChanged(@NonNull Configuration newConfig) {
|
||||||
|
super.onConfigurationChanged(newConfig);
|
||||||
|
ApplicationLifecycleDispatcher.onConfigurationChanged(this, newConfig);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Loads Flipper in React Native templates. Call this in the onCreate method with something like
|
||||||
|
* initializeFlipper(this, getReactNativeHost().getReactInstanceManager());
|
||||||
|
*
|
||||||
|
* @param context
|
||||||
|
* @param reactInstanceManager
|
||||||
|
*/
|
||||||
|
private static void initializeFlipper(
|
||||||
|
Context context, ReactInstanceManager reactInstanceManager) {
|
||||||
|
if (BuildConfig.DEBUG) {
|
||||||
|
try {
|
||||||
|
/*
|
||||||
|
We use reflection here to pick up the class that initializes Flipper,
|
||||||
|
since Flipper library is not available in release mode
|
||||||
|
*/
|
||||||
|
Class<?> aClass = Class.forName("com.spacedrive.app.ReactNativeFlipper");
|
||||||
|
aClass
|
||||||
|
.getMethod("initializeFlipper", Context.class, ReactInstanceManager.class)
|
||||||
|
.invoke(null, context, reactInstanceManager);
|
||||||
|
} catch (ClassNotFoundException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
} catch (NoSuchMethodException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
} catch (IllegalAccessException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
} catch (InvocationTargetException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,76 @@
|
||||||
|
package com.spacedrive.app;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
import android.os.Build;
|
||||||
|
|
||||||
|
import androidx.annotation.RequiresApi;
|
||||||
|
|
||||||
|
import com.facebook.react.bridge.Promise;
|
||||||
|
import com.facebook.react.bridge.ReactApplicationContext;
|
||||||
|
import com.facebook.react.bridge.ReactContext;
|
||||||
|
import com.facebook.react.bridge.ReactContextBaseJavaModule;
|
||||||
|
import com.facebook.react.bridge.ReactMethod;
|
||||||
|
import com.facebook.react.bridge.WritableMap;
|
||||||
|
import com.facebook.react.modules.core.DeviceEventManagerModule;
|
||||||
|
|
||||||
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
|
public class SDCore extends ReactContextBaseJavaModule {
|
||||||
|
SDCore(ReactApplicationContext context) { super(context); }
|
||||||
|
|
||||||
|
private boolean registeredWithRust = false;
|
||||||
|
private int listeners = 0;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getName()
|
||||||
|
{
|
||||||
|
return "SDCore";
|
||||||
|
}
|
||||||
|
|
||||||
|
static {
|
||||||
|
System.loadLibrary("sdcore");
|
||||||
|
}
|
||||||
|
|
||||||
|
// is exposed by Rust and is used to register the subscription
|
||||||
|
private native void registerCoreEventListener();
|
||||||
|
|
||||||
|
private native void handleCoreMsg(String query, Promise promise);
|
||||||
|
|
||||||
|
@ReactMethod
|
||||||
|
public void sd_core_msg(String query, Promise promise)
|
||||||
|
{
|
||||||
|
this.handleCoreMsg(query, promise);
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDataDirectory()
|
||||||
|
{
|
||||||
|
return getCurrentActivity().getFilesDir().toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
@ReactMethod
|
||||||
|
public void addListener(String eventName)
|
||||||
|
{
|
||||||
|
if (!registeredWithRust)
|
||||||
|
{
|
||||||
|
this.registerCoreEventListener();
|
||||||
|
}
|
||||||
|
|
||||||
|
this.listeners++;
|
||||||
|
}
|
||||||
|
|
||||||
|
@ReactMethod
|
||||||
|
public void removeListeners(Integer count)
|
||||||
|
{
|
||||||
|
this.listeners--;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void sendCoreEvent(String body)
|
||||||
|
{
|
||||||
|
if (this.listeners > 0)
|
||||||
|
{
|
||||||
|
this.getReactApplicationContext()
|
||||||
|
.getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter.class)
|
||||||
|
.emit("SDCoreEvent", body);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,28 @@
|
||||||
|
package com.spacedrive.app;
|
||||||
|
import com.facebook.react.ReactPackage;
|
||||||
|
import com.facebook.react.bridge.NativeModule;
|
||||||
|
import com.facebook.react.bridge.ReactApplicationContext;
|
||||||
|
import com.facebook.react.uimanager.ViewManager;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class SpacedrivePackage implements ReactPackage {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<ViewManager> createViewManagers(ReactApplicationContext reactContext) {
|
||||||
|
return Collections.emptyList();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<NativeModule> createNativeModules(
|
||||||
|
ReactApplicationContext reactContext) {
|
||||||
|
List<NativeModule> modules = new ArrayList<>();
|
||||||
|
|
||||||
|
modules.add(new SDCore(reactContext));
|
||||||
|
|
||||||
|
return modules;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,117 @@
|
||||||
|
package com.spacedrive.app.newarchitecture;
|
||||||
|
|
||||||
|
import android.app.Application;
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
import com.facebook.react.PackageList;
|
||||||
|
import com.facebook.react.ReactInstanceManager;
|
||||||
|
import com.facebook.react.ReactNativeHost;
|
||||||
|
import com.facebook.react.ReactPackage;
|
||||||
|
import com.facebook.react.ReactPackageTurboModuleManagerDelegate;
|
||||||
|
import com.facebook.react.bridge.JSIModulePackage;
|
||||||
|
import com.facebook.react.bridge.JSIModuleProvider;
|
||||||
|
import com.facebook.react.bridge.JSIModuleSpec;
|
||||||
|
import com.facebook.react.bridge.JSIModuleType;
|
||||||
|
import com.facebook.react.bridge.JavaScriptContextHolder;
|
||||||
|
import com.facebook.react.bridge.ReactApplicationContext;
|
||||||
|
import com.facebook.react.bridge.UIManager;
|
||||||
|
import com.facebook.react.fabric.ComponentFactory;
|
||||||
|
import com.facebook.react.fabric.CoreComponentsRegistry;
|
||||||
|
import com.facebook.react.fabric.EmptyReactNativeConfig;
|
||||||
|
import com.facebook.react.fabric.FabricJSIModuleProvider;
|
||||||
|
import com.facebook.react.fabric.ReactNativeConfig;
|
||||||
|
import com.facebook.react.uimanager.ViewManagerRegistry;
|
||||||
|
import com.spacedrive.app.BuildConfig;
|
||||||
|
import com.spacedrive.app.newarchitecture.components.MainComponentsRegistry;
|
||||||
|
import com.spacedrive.app.newarchitecture.modules.MainApplicationTurboModuleManagerDelegate;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A {@link ReactNativeHost} that helps you load everything needed for the New Architecture, both
|
||||||
|
* TurboModule delegates and the Fabric Renderer.
|
||||||
|
*
|
||||||
|
* <p>Please note that this class is used ONLY if you opt-in for the New Architecture (see the
|
||||||
|
* `newArchEnabled` property). Is ignored otherwise.
|
||||||
|
*/
|
||||||
|
public class MainApplicationReactNativeHost extends ReactNativeHost {
|
||||||
|
public MainApplicationReactNativeHost(Application application) {
|
||||||
|
super(application);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean getUseDeveloperSupport() {
|
||||||
|
return BuildConfig.DEBUG;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected List<ReactPackage> getPackages() {
|
||||||
|
List<ReactPackage> packages = new PackageList(this).getPackages();
|
||||||
|
// Packages that cannot be autolinked yet can be added manually here, for example:
|
||||||
|
// packages.add(new MyReactNativePackage());
|
||||||
|
// TurboModules must also be loaded here providing a valid TurboReactPackage implementation:
|
||||||
|
// packages.add(new TurboReactPackage() { ... });
|
||||||
|
// If you have custom Fabric Components, their ViewManagers should also be loaded here
|
||||||
|
// inside a ReactPackage.
|
||||||
|
return packages;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String getJSMainModuleName() {
|
||||||
|
return "index";
|
||||||
|
}
|
||||||
|
|
||||||
|
@NonNull
|
||||||
|
@Override
|
||||||
|
protected ReactPackageTurboModuleManagerDelegate.Builder
|
||||||
|
getReactPackageTurboModuleManagerDelegateBuilder() {
|
||||||
|
// Here we provide the ReactPackageTurboModuleManagerDelegate Builder. This is necessary
|
||||||
|
// for the new architecture and to use TurboModules correctly.
|
||||||
|
return new MainApplicationTurboModuleManagerDelegate.Builder();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected JSIModulePackage getJSIModulePackage() {
|
||||||
|
return new JSIModulePackage() {
|
||||||
|
@Override
|
||||||
|
public List<JSIModuleSpec> getJSIModules(
|
||||||
|
final ReactApplicationContext reactApplicationContext,
|
||||||
|
final JavaScriptContextHolder jsContext) {
|
||||||
|
final List<JSIModuleSpec> specs = new ArrayList<>();
|
||||||
|
|
||||||
|
// Here we provide a new JSIModuleSpec that will be responsible of providing the
|
||||||
|
// custom Fabric Components.
|
||||||
|
specs.add(
|
||||||
|
new JSIModuleSpec() {
|
||||||
|
@Override
|
||||||
|
public JSIModuleType getJSIModuleType() {
|
||||||
|
return JSIModuleType.UIManager;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public JSIModuleProvider<UIManager> getJSIModuleProvider() {
|
||||||
|
final ComponentFactory componentFactory = new ComponentFactory();
|
||||||
|
CoreComponentsRegistry.register(componentFactory);
|
||||||
|
|
||||||
|
// Here we register a Components Registry.
|
||||||
|
// The one that is generated with the template contains no components
|
||||||
|
// and just provides you the one from React Native core.
|
||||||
|
MainComponentsRegistry.register(componentFactory);
|
||||||
|
|
||||||
|
final ReactInstanceManager reactInstanceManager = getReactInstanceManager();
|
||||||
|
|
||||||
|
ViewManagerRegistry viewManagerRegistry =
|
||||||
|
new ViewManagerRegistry(
|
||||||
|
reactInstanceManager.getOrCreateViewManagers(reactApplicationContext));
|
||||||
|
|
||||||
|
return new FabricJSIModuleProvider(
|
||||||
|
reactApplicationContext,
|
||||||
|
componentFactory,
|
||||||
|
ReactNativeConfig.DEFAULT_CONFIG,
|
||||||
|
viewManagerRegistry);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return specs;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,36 @@
|
||||||
|
package com.spacedrive.app.newarchitecture.components;
|
||||||
|
|
||||||
|
import com.facebook.jni.HybridData;
|
||||||
|
import com.facebook.proguard.annotations.DoNotStrip;
|
||||||
|
import com.facebook.react.fabric.ComponentFactory;
|
||||||
|
import com.facebook.soloader.SoLoader;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class responsible to load the custom Fabric Components. This class has native methods and needs a
|
||||||
|
* corresponding C++ implementation/header file to work correctly (already placed inside the jni/
|
||||||
|
* folder for you).
|
||||||
|
*
|
||||||
|
* <p>Please note that this class is used ONLY if you opt-in for the New Architecture (see the
|
||||||
|
* `newArchEnabled` property). Is ignored otherwise.
|
||||||
|
*/
|
||||||
|
@DoNotStrip
|
||||||
|
public class MainComponentsRegistry {
|
||||||
|
static {
|
||||||
|
SoLoader.loadLibrary("fabricjni");
|
||||||
|
}
|
||||||
|
|
||||||
|
@DoNotStrip private final HybridData mHybridData;
|
||||||
|
|
||||||
|
@DoNotStrip
|
||||||
|
private native HybridData initHybrid(ComponentFactory componentFactory);
|
||||||
|
|
||||||
|
@DoNotStrip
|
||||||
|
private MainComponentsRegistry(ComponentFactory componentFactory) {
|
||||||
|
mHybridData = initHybrid(componentFactory);
|
||||||
|
}
|
||||||
|
|
||||||
|
@DoNotStrip
|
||||||
|
public static MainComponentsRegistry register(ComponentFactory componentFactory) {
|
||||||
|
return new MainComponentsRegistry(componentFactory);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,48 @@
|
||||||
|
package com.spacedrive.app.newarchitecture.modules;
|
||||||
|
|
||||||
|
import com.facebook.jni.HybridData;
|
||||||
|
import com.facebook.react.ReactPackage;
|
||||||
|
import com.facebook.react.ReactPackageTurboModuleManagerDelegate;
|
||||||
|
import com.facebook.react.bridge.ReactApplicationContext;
|
||||||
|
import com.facebook.soloader.SoLoader;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class responsible to load the TurboModules. This class has native methods and needs a
|
||||||
|
* corresponding C++ implementation/header file to work correctly (already placed inside the jni/
|
||||||
|
* folder for you).
|
||||||
|
*
|
||||||
|
* <p>Please note that this class is used ONLY if you opt-in for the New Architecture (see the
|
||||||
|
* `newArchEnabled` property). Is ignored otherwise.
|
||||||
|
*/
|
||||||
|
public class MainApplicationTurboModuleManagerDelegate
|
||||||
|
extends ReactPackageTurboModuleManagerDelegate {
|
||||||
|
|
||||||
|
private static volatile boolean sIsSoLibraryLoaded;
|
||||||
|
|
||||||
|
protected MainApplicationTurboModuleManagerDelegate(
|
||||||
|
ReactApplicationContext reactApplicationContext, List<ReactPackage> packages) {
|
||||||
|
super(reactApplicationContext, packages);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected native HybridData initHybrid();
|
||||||
|
|
||||||
|
native boolean canCreateTurboModule(String moduleName);
|
||||||
|
|
||||||
|
public static class Builder extends ReactPackageTurboModuleManagerDelegate.Builder {
|
||||||
|
protected MainApplicationTurboModuleManagerDelegate build(
|
||||||
|
ReactApplicationContext context, List<ReactPackage> packages) {
|
||||||
|
return new MainApplicationTurboModuleManagerDelegate(context, packages);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected synchronized void maybeLoadOtherSoLibraries() {
|
||||||
|
if (!sIsSoLibraryLoaded) {
|
||||||
|
// If you change the name of your application .so file in the Android.mk file,
|
||||||
|
// make sure you update the name here as well.
|
||||||
|
SoLoader.loadLibrary("spacedrive_appmodules");
|
||||||
|
sIsSoLibraryLoaded = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
48
apps/mobile/android/app/src/main/jni/Android.mk
Normal file
|
@ -0,0 +1,48 @@
|
||||||
|
THIS_DIR := $(call my-dir)
|
||||||
|
|
||||||
|
include $(REACT_ANDROID_DIR)/Android-prebuilt.mk
|
||||||
|
|
||||||
|
# If you wish to add a custom TurboModule or Fabric component in your app you
|
||||||
|
# will have to include the following autogenerated makefile.
|
||||||
|
# include $(GENERATED_SRC_DIR)/codegen/jni/Android.mk
|
||||||
|
include $(CLEAR_VARS)
|
||||||
|
|
||||||
|
LOCAL_PATH := $(THIS_DIR)
|
||||||
|
|
||||||
|
# You can customize the name of your application .so file here.
|
||||||
|
LOCAL_MODULE := spacedrive_appmodules
|
||||||
|
|
||||||
|
LOCAL_C_INCLUDES := $(LOCAL_PATH)
|
||||||
|
LOCAL_SRC_FILES := $(wildcard $(LOCAL_PATH)/*.cpp)
|
||||||
|
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)
|
||||||
|
|
||||||
|
# If you wish to add a custom TurboModule or Fabric component in your app you
|
||||||
|
# will have to uncomment those lines to include the generated source
|
||||||
|
# files from the codegen (placed in $(GENERATED_SRC_DIR)/codegen/jni)
|
||||||
|
#
|
||||||
|
# LOCAL_C_INCLUDES += $(GENERATED_SRC_DIR)/codegen/jni
|
||||||
|
# LOCAL_SRC_FILES += $(wildcard $(GENERATED_SRC_DIR)/codegen/jni/*.cpp)
|
||||||
|
# LOCAL_EXPORT_C_INCLUDES += $(GENERATED_SRC_DIR)/codegen/jni
|
||||||
|
|
||||||
|
# Here you should add any native library you wish to depend on.
|
||||||
|
LOCAL_SHARED_LIBRARIES := \
|
||||||
|
libfabricjni \
|
||||||
|
libfbjni \
|
||||||
|
libfolly_runtime \
|
||||||
|
libglog \
|
||||||
|
libjsi \
|
||||||
|
libreact_codegen_rncore \
|
||||||
|
libreact_debug \
|
||||||
|
libreact_nativemodule_core \
|
||||||
|
libreact_render_componentregistry \
|
||||||
|
libreact_render_core \
|
||||||
|
libreact_render_debug \
|
||||||
|
libreact_render_graphics \
|
||||||
|
librrc_view \
|
||||||
|
libruntimeexecutor \
|
||||||
|
libturbomodulejsijni \
|
||||||
|
libyoga
|
||||||
|
|
||||||
|
LOCAL_CFLAGS := -DLOG_TAG=\"ReactNative\" -fexceptions -frtti -std=c++17 -Wall
|
||||||
|
|
||||||
|
include $(BUILD_SHARED_LIBRARY)
|
|
@ -0,0 +1,24 @@
|
||||||
|
#include "MainApplicationModuleProvider.h"
|
||||||
|
|
||||||
|
#include <rncore.h>
|
||||||
|
|
||||||
|
namespace facebook {
|
||||||
|
namespace react {
|
||||||
|
|
||||||
|
std::shared_ptr<TurboModule> MainApplicationModuleProvider(
|
||||||
|
const std::string moduleName,
|
||||||
|
const JavaTurboModule::InitParams ¶ms) {
|
||||||
|
// Here you can provide your own module provider for TurboModules coming from
|
||||||
|
// either your application or from external libraries. The approach to follow
|
||||||
|
// is similar to the following (for a library called `samplelibrary`:
|
||||||
|
//
|
||||||
|
// auto module = samplelibrary_ModuleProvider(moduleName, params);
|
||||||
|
// if (module != nullptr) {
|
||||||
|
// return module;
|
||||||
|
// }
|
||||||
|
// return rncore_ModuleProvider(moduleName, params);
|
||||||
|
return rncore_ModuleProvider(moduleName, params);
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace react
|
||||||
|
} // namespace facebook
|
|
@ -0,0 +1,16 @@
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <memory>
|
||||||
|
#include <string>
|
||||||
|
|
||||||
|
#include <ReactCommon/JavaTurboModule.h>
|
||||||
|
|
||||||
|
namespace facebook {
|
||||||
|
namespace react {
|
||||||
|
|
||||||
|
std::shared_ptr<TurboModule> MainApplicationModuleProvider(
|
||||||
|
const std::string moduleName,
|
||||||
|
const JavaTurboModule::InitParams ¶ms);
|
||||||
|
|
||||||
|
} // namespace react
|
||||||
|
} // namespace facebook
|
|
@ -0,0 +1,45 @@
|
||||||
|
#include "MainApplicationTurboModuleManagerDelegate.h"
|
||||||
|
#include "MainApplicationModuleProvider.h"
|
||||||
|
|
||||||
|
namespace facebook {
|
||||||
|
namespace react {
|
||||||
|
|
||||||
|
jni::local_ref<MainApplicationTurboModuleManagerDelegate::jhybriddata>
|
||||||
|
MainApplicationTurboModuleManagerDelegate::initHybrid(
|
||||||
|
jni::alias_ref<jhybridobject>) {
|
||||||
|
return makeCxxInstance();
|
||||||
|
}
|
||||||
|
|
||||||
|
void MainApplicationTurboModuleManagerDelegate::registerNatives() {
|
||||||
|
registerHybrid({
|
||||||
|
makeNativeMethod(
|
||||||
|
"initHybrid", MainApplicationTurboModuleManagerDelegate::initHybrid),
|
||||||
|
makeNativeMethod(
|
||||||
|
"canCreateTurboModule",
|
||||||
|
MainApplicationTurboModuleManagerDelegate::canCreateTurboModule),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
std::shared_ptr<TurboModule>
|
||||||
|
MainApplicationTurboModuleManagerDelegate::getTurboModule(
|
||||||
|
const std::string name,
|
||||||
|
const std::shared_ptr<CallInvoker> jsInvoker) {
|
||||||
|
// Not implemented yet: provide pure-C++ NativeModules here.
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::shared_ptr<TurboModule>
|
||||||
|
MainApplicationTurboModuleManagerDelegate::getTurboModule(
|
||||||
|
const std::string name,
|
||||||
|
const JavaTurboModule::InitParams ¶ms) {
|
||||||
|
return MainApplicationModuleProvider(name, params);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool MainApplicationTurboModuleManagerDelegate::canCreateTurboModule(
|
||||||
|
std::string name) {
|
||||||
|
return getTurboModule(name, nullptr) != nullptr ||
|
||||||
|
getTurboModule(name, {.moduleName = name}) != nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace react
|
||||||
|
} // namespace facebook
|
|
@ -0,0 +1,38 @@
|
||||||
|
#include <memory>
|
||||||
|
#include <string>
|
||||||
|
|
||||||
|
#include <ReactCommon/TurboModuleManagerDelegate.h>
|
||||||
|
#include <fbjni/fbjni.h>
|
||||||
|
|
||||||
|
namespace facebook {
|
||||||
|
namespace react {
|
||||||
|
|
||||||
|
class MainApplicationTurboModuleManagerDelegate
|
||||||
|
: public jni::HybridClass<
|
||||||
|
MainApplicationTurboModuleManagerDelegate,
|
||||||
|
TurboModuleManagerDelegate> {
|
||||||
|
public:
|
||||||
|
// Adapt it to the package you used for your Java class.
|
||||||
|
static constexpr auto kJavaDescriptor =
|
||||||
|
"Lcom/spacedrive/app/newarchitecture/modules/MainApplicationTurboModuleManagerDelegate;";
|
||||||
|
|
||||||
|
static jni::local_ref<jhybriddata> initHybrid(jni::alias_ref<jhybridobject>);
|
||||||
|
|
||||||
|
static void registerNatives();
|
||||||
|
|
||||||
|
std::shared_ptr<TurboModule> getTurboModule(
|
||||||
|
const std::string name,
|
||||||
|
const std::shared_ptr<CallInvoker> jsInvoker) override;
|
||||||
|
std::shared_ptr<TurboModule> getTurboModule(
|
||||||
|
const std::string name,
|
||||||
|
const JavaTurboModule::InitParams ¶ms) override;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test-only method. Allows user to verify whether a TurboModule can be
|
||||||
|
* created by instances of this class.
|
||||||
|
*/
|
||||||
|
bool canCreateTurboModule(std::string name);
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace react
|
||||||
|
} // namespace facebook
|
|
@ -0,0 +1,61 @@
|
||||||
|
#include "MainComponentsRegistry.h"
|
||||||
|
|
||||||
|
#include <CoreComponentsRegistry.h>
|
||||||
|
#include <fbjni/fbjni.h>
|
||||||
|
#include <react/renderer/componentregistry/ComponentDescriptorProviderRegistry.h>
|
||||||
|
#include <react/renderer/components/rncore/ComponentDescriptors.h>
|
||||||
|
|
||||||
|
namespace facebook {
|
||||||
|
namespace react {
|
||||||
|
|
||||||
|
MainComponentsRegistry::MainComponentsRegistry(ComponentFactory *delegate) {}
|
||||||
|
|
||||||
|
std::shared_ptr<ComponentDescriptorProviderRegistry const>
|
||||||
|
MainComponentsRegistry::sharedProviderRegistry() {
|
||||||
|
auto providerRegistry = CoreComponentsRegistry::sharedProviderRegistry();
|
||||||
|
|
||||||
|
// Custom Fabric Components go here. You can register custom
|
||||||
|
// components coming from your App or from 3rd party libraries here.
|
||||||
|
//
|
||||||
|
// providerRegistry->add(concreteComponentDescriptorProvider<
|
||||||
|
// AocViewerComponentDescriptor>());
|
||||||
|
return providerRegistry;
|
||||||
|
}
|
||||||
|
|
||||||
|
jni::local_ref<MainComponentsRegistry::jhybriddata>
|
||||||
|
MainComponentsRegistry::initHybrid(
|
||||||
|
jni::alias_ref<jclass>,
|
||||||
|
ComponentFactory *delegate) {
|
||||||
|
auto instance = makeCxxInstance(delegate);
|
||||||
|
|
||||||
|
auto buildRegistryFunction =
|
||||||
|
[](EventDispatcher::Weak const &eventDispatcher,
|
||||||
|
ContextContainer::Shared const &contextContainer)
|
||||||
|
-> ComponentDescriptorRegistry::Shared {
|
||||||
|
auto registry = MainComponentsRegistry::sharedProviderRegistry()
|
||||||
|
->createComponentDescriptorRegistry(
|
||||||
|
{eventDispatcher, contextContainer});
|
||||||
|
|
||||||
|
auto mutableRegistry =
|
||||||
|
std::const_pointer_cast<ComponentDescriptorRegistry>(registry);
|
||||||
|
|
||||||
|
mutableRegistry->setFallbackComponentDescriptor(
|
||||||
|
std::make_shared<UnimplementedNativeViewComponentDescriptor>(
|
||||||
|
ComponentDescriptorParameters{
|
||||||
|
eventDispatcher, contextContainer, nullptr}));
|
||||||
|
|
||||||
|
return registry;
|
||||||
|
};
|
||||||
|
|
||||||
|
delegate->buildRegistryFunction = buildRegistryFunction;
|
||||||
|
return instance;
|
||||||
|
}
|
||||||
|
|
||||||
|
void MainComponentsRegistry::registerNatives() {
|
||||||
|
registerHybrid({
|
||||||
|
makeNativeMethod("initHybrid", MainComponentsRegistry::initHybrid),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace react
|
||||||
|
} // namespace facebook
|
|
@ -0,0 +1,32 @@
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <ComponentFactory.h>
|
||||||
|
#include <fbjni/fbjni.h>
|
||||||
|
#include <react/renderer/componentregistry/ComponentDescriptorProviderRegistry.h>
|
||||||
|
#include <react/renderer/componentregistry/ComponentDescriptorRegistry.h>
|
||||||
|
|
||||||
|
namespace facebook {
|
||||||
|
namespace react {
|
||||||
|
|
||||||
|
class MainComponentsRegistry
|
||||||
|
: public facebook::jni::HybridClass<MainComponentsRegistry> {
|
||||||
|
public:
|
||||||
|
// Adapt it to the package you used for your Java class.
|
||||||
|
constexpr static auto kJavaDescriptor =
|
||||||
|
"Lcom/spacedrive/app/newarchitecture/components/MainComponentsRegistry;";
|
||||||
|
|
||||||
|
static void registerNatives();
|
||||||
|
|
||||||
|
MainComponentsRegistry(ComponentFactory *delegate);
|
||||||
|
|
||||||
|
private:
|
||||||
|
static std::shared_ptr<ComponentDescriptorProviderRegistry const>
|
||||||
|
sharedProviderRegistry();
|
||||||
|
|
||||||
|
static jni::local_ref<jhybriddata> initHybrid(
|
||||||
|
jni::alias_ref<jclass>,
|
||||||
|
ComponentFactory *delegate);
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace react
|
||||||
|
} // namespace facebook
|
11
apps/mobile/android/app/src/main/jni/OnLoad.cpp
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
#include <fbjni/fbjni.h>
|
||||||
|
#include "MainApplicationTurboModuleManagerDelegate.h"
|
||||||
|
#include "MainComponentsRegistry.h"
|
||||||
|
|
||||||
|
JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM *vm, void *) {
|
||||||
|
return facebook::jni::initialize(vm, [] {
|
||||||
|
facebook::react::MainApplicationTurboModuleManagerDelegate::
|
||||||
|
registerNatives();
|
||||||
|
facebook::react::MainComponentsRegistry::registerNatives();
|
||||||
|
});
|
||||||
|
}
|
After Width: | Height: | Size: 78 KiB |
After Width: | Height: | Size: 78 KiB |
After Width: | Height: | Size: 78 KiB |
After Width: | Height: | Size: 78 KiB |
After Width: | Height: | Size: 78 KiB |
|
@ -0,0 +1,36 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!-- Copyright (C) 2014 The Android Open Source Project
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
|
-->
|
||||||
|
<inset xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:insetLeft="@dimen/abc_edit_text_inset_horizontal_material"
|
||||||
|
android:insetRight="@dimen/abc_edit_text_inset_horizontal_material"
|
||||||
|
android:insetTop="@dimen/abc_edit_text_inset_top_material"
|
||||||
|
android:insetBottom="@dimen/abc_edit_text_inset_bottom_material">
|
||||||
|
|
||||||
|
<selector>
|
||||||
|
<!--
|
||||||
|
This file is a copy of abc_edit_text_material (https://bit.ly/3k8fX7I).
|
||||||
|
The item below with state_pressed="false" and state_focused="false" causes a NullPointerException.
|
||||||
|
NullPointerException:tempt to invoke virtual method 'android.graphics.drawable.Drawable android.graphics.drawable.Drawable$ConstantState.newDrawable(android.content.res.Resources)'
|
||||||
|
|
||||||
|
<item android:state_pressed="false" android:state_focused="false" android:drawable="@drawable/abc_textfield_default_mtrl_alpha"/>
|
||||||
|
|
||||||
|
For more info, see https://bit.ly/3CdLStv (react-native/pull/29452) and https://bit.ly/3nxOMoR.
|
||||||
|
-->
|
||||||
|
<item android:state_enabled="false" android:drawable="@drawable/abc_textfield_default_mtrl_alpha"/>
|
||||||
|
<item android:drawable="@drawable/abc_textfield_activated_mtrl_alpha"/>
|
||||||
|
</selector>
|
||||||
|
|
||||||
|
</inset>
|
|
@ -0,0 +1,3 @@
|
||||||
|
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<item android:drawable="@color/splashscreen_background"/>
|
||||||
|
</layer-list>
|
|
@ -0,0 +1,5 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<background android:drawable="@color/iconBackground"/>
|
||||||
|
<foreground android:drawable="@mipmap/ic_launcher_foreground"/>
|
||||||
|
</adaptive-icon>
|
|
@ -0,0 +1,5 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<background android:drawable="@color/iconBackground"/>
|
||||||
|
<foreground android:drawable="@mipmap/ic_launcher_foreground"/>
|
||||||
|
</adaptive-icon>
|
BIN
apps/mobile/android/app/src/main/res/mipmap-hdpi/ic_launcher.png
Normal file
After Width: | Height: | Size: 4.2 KiB |
After Width: | Height: | Size: 4.2 KiB |
After Width: | Height: | Size: 4.9 KiB |
BIN
apps/mobile/android/app/src/main/res/mipmap-mdpi/ic_launcher.png
Normal file
After Width: | Height: | Size: 2.2 KiB |
After Width: | Height: | Size: 2.2 KiB |
After Width: | Height: | Size: 2.7 KiB |