No description, website, or topics provided.
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
docs
src
svg
test
.babelrc
.eslintrc
.gitignore
LICENSE
README.md
package.json
webpack.config.js

README.md

Shared network folder (SFTP)

A ChromeOS app which provides the ability to access a SFTP server, directly from the Files app

Content

  1. Description
  2. Installation
  3. Development
    1. Getting started
    2. Compile Native Client code
    3. Compile the project
    4. Start the app
  4. Issues
  5. License

Description

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.

Development

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.

Getting started

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.

  1. 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.
  2. 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

Compile Native Client code

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.

Install NaCl SDK

  1. Download the Native Client from https://developer.chrome.com/native-client/sdk/download.

  2. 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.

  3. Install the stable bundle of the SDK (at the time of writing, pepper_49):

    cd ~/buildutils/nacl_sdk
    ./naclsdk update
  4. 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 modifying download.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!

    1. Find this line:
    request = fancy_urllib.FancyRequest(url)
    1. And modify it to:
    request = fancy_urllib.FancyRequest(url.replace("https://", "http://"))
    1. Perform the ./naclsdk update command again!

Install depot_tools

  1. To be able to set-up webports, you will need depot_tools. Clone the depot_tools repository by using these commands:
    cd ~/buildutils
    git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git
  2. Add the cloned path to your $PATH environment variable.
    export PATH=~/buildutils/depot_tools:$PATH

Install webports

  1. Install webports with the gclient command included in the depot_tools:
    cd ~/buildutils
    mkdir webports
    cd webports
    gclient config --name=src  https://chromium.googlesource.com/webports/
    gclient sync

Compile libssh2

  1. 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:

    1. In your text editor, open build.sh located at ~/buildutils/webports/src/ports/libssh2/
    2. Rename EXECUTABLES="tests/ssh2${NACL_EXEEXT}" to EXECUTABLES="example/ssh2${NACL_EXEEXT}"
    3. Start compiling again (step 8)

    Resolve issue 'qemu-arm cannot open shared library' While testing the glibc-compat binary for arm architectures, the qemu-arm application (part of the NaCl SDK) is used, but fails. Installing qemu yourself fixes the issue.

    1. Install qemu by yourself:
    sudo apt-get install qemu
    1. 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
    1. Start compiling again (step 8)

Make the project's Native Client code

  1. Change directory to the project, and run the compile command:
    cd ~/chromeos-filesystem-sftp
    cd src/nacl_src
    make CONFIG=Release
  2. The compiled code is created in the directory /src/clang-newlib.

Compile the project

  1. Install all building system and front-end dependencies (if not already done):
    cd ~/chromeos-filesystem-sftp
    npm install
  2. Make sure that you've compiled the app's native client code; this should be located in /src/clang-newlib.
  3. To build the project, use the following command. The build directory is /dist and specified in /webpack.config.js.
    npm run build

Start the app

Because the app is a Chrome App and not a Chrome Extension, the app can only be opened on Chrome OS devices!

  1. Move the compiled project folder (e.g. /dist) to an accessible local directory on your ChromeOS device, for example ~/Downloads/dist.
  2. Open the Google Chrome browser and navigate to chrome://extensions.
  3. Make sure that Developer Mode is checked.
  4. 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.

Issues

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.

License

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