Shared network folder (SFTP) is originally developed by Yoichiro Tanaka and provides the ability to access a SFTP server directly from the ChromeOS Files app. My fork has improved the design of the user-interface, to provide a more native look-and-feel. To do so, the front-end build system have been moved from bower, grunt to npm, webpack to make use of React and the Material-UI components. The fork is merged with the original repo.
Shared network folder (SFTP) is a Chrome App, therefore explicitly build for ChromeOS systems. Chrome Apps can be created with common web technologies such as HTML5, CSS, and JavaScript to deliver an experience comparable of a native application. To extent the power of these technologies, Chrome delivers a Native Client SDK to compile C and C++ code in the browser efficiently and securely, independent of the user’s operating system. Shared network folder (SFTP) makes use of libssh2 which has been ported to the Native Client environment to establish a file share connection over SSH (i.e. SFTP; SSH File Transfer Protocol). The compiled code is part of the app, and communicates with the web technologies back and forth.
Please visit the documentation, to get more insights of the app structure.
To build the app, you need a 1) build system to compile the app's Native Client code, and a 2) front-end build system to build the app itself.
- First of all, install NodeJS and the node package manager (NPM) - by default installed with NodeJS. You can download and install NodeJS from: https://nodejs.org/. Make sure that the
npm
command is included to your global$PATH
environment variable. - Download the repository! Clone the project with the following command:
cd ~ git clone https://github.com/tjibbevanderlaan/chromeos-filesystem-sftp.git cd chromeos-filesystem-sftp
To compile the app's Native Client code (/src/nativeclient_src), you will need the Native Client SDK, depot_tools and the ported libssh2 library from webports.
-
Download the Native Client from https://developer.chrome.com/native-client/sdk/download.
-
You should get the archive file named
nack_sdk.zip
. You can extract the archive in any directory you want, however, in this guide I will use the directory~/buildutils/
. Consequently, the extracted files can be found in~/buildutils/nacl_sdk
. -
Install the stable bundle of the SDK (at the time of writing, pepper_49):
cd ~/buildutils/nacl_sdk ./naclsdk update
-
Subsequently, add the absolute path of the installed sdk-directory (e.g.
pepper_49
) to the environment variables$PATH
and$NACL_SDK_ROOT
:export PATH=~/buildutils/nacl_sdk/pepper_49:$PATH export NACL_SDK_ROOT=~/buildutils/nacl_sdk/pepper_49
Resolve certificate error Unfortunately, I ran into a certificate error
SSL: CERTIFICATE_VERIFY_FAILED
. You can temporary bypass the certificate verification by modifyingdownload.py
, within$NACL_SDK_ROOT/nacl_sdk/sdk_tools
, as suggested by https://groups.google.com/forum/#!topic/native-client-discuss/sh-9sA6LHjw. Make sure that you do not download malicious software!- Find this line:
request = fancy_urllib.FancyRequest(url)
- And modify it to:
request = fancy_urllib.FancyRequest(url.replace("https://", "http://"))
- Perform the
./naclsdk update
command again!
- To be able to set-up
webports
, you will needdepot_tools
. Clone thedepot_tools
repository by using these commands:cd ~/buildutils git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git
- Add the cloned path to your
$PATH
environment variable.export PATH=~/buildutils/depot_tools:$PATH
- Install webports with the
gclient
command included in thedepot_tools
:cd ~/buildutils mkdir webports cd webports gclient config --name=src https://chromium.googlesource.com/webports/ gclient sync
-
Compile the libssh2 C library in the
webports
directory with the command below. The./make_all.sh
command compiles the libraries for all suitable architectured (e.g. i686, x86_64, arm, pnacl).cd ~/buildutils/webports/src ./make_all.sh libssh2
Resolve issue 'missing testfile' During the postbuild of libssh2, the testfile
ssh2.nexe
could not be found. I'm not sure if this is a correct fix, but it works; modify the the buildfile of the webported libssh2 as follows:- In your text editor, open
build.sh
located at~/buildutils/webports/src/ports/libssh2/
- Rename
EXECUTABLES="tests/ssh2${NACL_EXEEXT}"
toEXECUTABLES="example/ssh2${NACL_EXEEXT}"
- Start compiling again (step 8)
Resolve issue 'qemu-arm cannot open shared library' While testing the
glibc-compat
binary for arm architectures, theqemu-arm
application (part of the NaCl SDK) is used, but fails. Installingqemu
yourself fixes the issue.- Install
qemu
by yourself:
sudo apt-get install qemu
- Prevent the usage of
qemu
provided by Native Client SDK, by renaming the binary:
cd $NACL_SDK_ROOT/tools mv qemu-arm qemu-arm-bak
- Start compiling again (step 8)
- In your text editor, open
- Change directory to the project, and run the compile command:
cd ~/chromeos-filesystem-sftp cd src/nacl_src make CONFIG=Release
- The compiled code is created in the directory
/src/clang-newlib
.
- Install all building system and front-end dependencies (if not already done):
cd ~/chromeos-filesystem-sftp npm install
- Make sure that you've compiled the app's native client code; this should be located in
/src/clang-newlib
. - To build the project, use the following command. The build directory is
/dist
and specified in/webpack.config.js
.npm run build
Because the app is a Chrome App and not a Chrome Extension, the app can only be opened on Chrome OS devices!
- Move the compiled project folder (e.g.
/dist
) to an accessible local directory on your ChromeOS device, for example~/Downloads/dist
. - Open the Google Chrome browser and navigate to
chrome://extensions
. - Make sure that Developer Mode is checked.
- Click the Load unpacked extension button, navigate to your app's folder and click OK.
You can find more information on https://developer.chrome.com/apps/first_app#load.
While the app is working, there are still some features which could be improved.
- Unfortunately, I've could not manage to configure 'hot reload' for development. Because the app is a Chrome App, and not a Chrome Extension, I stumbled to some Content Security Policy (CSP) errors.
- User credentials are stored in the
chrome.storage.local
. While they are not accessible by other apps, it seems not the most secure solution. - Automatic testing is not yet incorporated.
All files are licensed under the BSD license. See the LICENSE file for details. Copyright 2018 Tjibbe van der Laan Copyright 2015-2016 Yoichiro Tanaka