A Example application to serve as POC for the SAFE network to expose RESTFull services for developers and also support browsers without any addon put through a thing WEB-2-SAFE Proxy server.
Run the SAFEGateway application. Click on the login button. Once the user authenticates a fix RESTFull server is started. The RESTFull services would expose API that would help the developers to easily communicate with the SAFENetwork.
The application will also start a WEB-2-SAFE proxy server. The purpose of the proxy server is to allow the browsers to
serve the public content from the SAFENetwork. The WEB-2-SAFE proxy
will proxy only the urls with *.safenet
extensions.
For eg,
http://krishna.safenet
http://blog.krishna.safenet
The proxy would act as a unregistered client and fetch public content from the SAFENetwork.
The APIs can be invoked directly pointing to the localhost:API_PORT (localhost:3000) end points. This request wont be proxied as it is directly targeted to the localhost.
Alternatively, the XHR web requests can also be posted to api.safenet
, the requests to the endpoint will be proxied to
the API Server automatically.
In order to use the WEB-2-SAFE proxy
the browser setting should be configured to use the proxy.
- Control Panel > Network & Internet > Internet options
- Internet Properties dialog is opened. Open
Connections
tab and selectLAN Settings
- Select
Use automatic configuration script
and in the Address box sethttp://localhost:3000/pac-file
- Save the settings
- Open browser and start using. Test with
maidsafe.safenet
&drive.maidsafe.safenet
If Windows configuration is followed then the below configurations is not needed. browsers use the System network configurations by default. Below are the configurations through each browser. Chrom and Ie directly configure the System's configuration. While firefoc and safari provide option to configure proxy for the application specifically.
Open Advanced Setting and click on the Change Proxy settings under the Network option. Follow steps from 2 from Windows configuration section
Open Tools > intenet options and follow steps 2 from Windows Configuration
Go to settings > Advanced > Network > Connections > Click on Settings button. Select Atomatic procy confiuguration URL and paste the pac file url (http://localhost:3000/pac-file)
Setting reference is linked here
$ npm install && bower install
$ npm start
$ npm run build
$ npm run build-osx
Builds the app for OS X and Windows, using electron-packager.