Merge pull request #30 from NebulousLabs/cleanup-node-api

skip nodejs server
This commit is contained in:
David Vorick 2020-02-18 11:59:14 -05:00 committed by GitHub
commit 9dc0aa5e3b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
121 changed files with 749 additions and 18323 deletions

View File

@ -1,4 +1,4 @@
name: sia-skynet package CI name: skynet-webportal CI
on: [push] on: [push]
@ -18,5 +18,4 @@ jobs:
with: with:
node-version: ${{ matrix.node-version }} node-version: ${{ matrix.node-version }}
- run: yarn - run: yarn
- run: yarn build:client - run: yarn build
- run: yarn build:server

70
.gitignore vendored
View File

@ -1,7 +1,69 @@
node_modules # Logs
**/*/.next logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
*.swo # Runtime data
*.swp pids
*.pid
*.seed
*.pid.lock
# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov
# Coverage directory used by tools like istanbul
coverage
# nyc test coverage
.nyc_output
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
.grunt
# Bower dependency directory (https://bower.io/)
bower_components
# node-waf configuration
.lock-wscript
# Compiled binary addons (http://nodejs.org/api/addons.html)
build/Release
# Dependency directories
node_modules/
jspm_packages/
# Typescript v1 declaration files
typings/
# Optional npm cache directory
.npm
# Optional eslint cache
.eslintcache
# Optional REPL history
.node_repl_history
# Output of 'npm pack'
*.tgz
# dotenv environment variable files
.env*
# build files
.cache/
build
# Mac files
.DS_Store
# Yarn
yarn-error.log yarn-error.log
.pnp/
.pnp.js
# Yarn Integrity file
.yarn-integrity

4
.prettierignore Normal file
View File

@ -0,0 +1,4 @@
.cache
package.json
package-lock.json
public

3
.prettierrc Normal file
View File

@ -0,0 +1,3 @@
{
"printWidth": 120
}

View File

@ -1,10 +1,10 @@
# Skynet Portal # Skynet Portal
## Setup Guide ## Setup Guide
A setup guide with scripts to install prerequisites can be found in the
[setup-scripts](./setup-scripts) directory. A setup guide with scripts to install prerequisites can be found in the [setup-scripts](./setup-scripts) directory.
Once the setup guide is complete you will be running: Once the setup guide is complete you will be running:
- `siad` configured as a Skynet Portal - `siad` configured as a Skynet Portal
- a NodeJS app running a Skynet WebPortal - an nginx webserver serving webportal
- an nginx proxy

View File

@ -1,18 +1,50 @@
{ {
"private": true, "name": "skynet-webportal",
"scripts": { "version": "1.0.0",
"build:client": "yarn workspace sia-skynet build", "homepage": "https://siasky.net",
"start:client": "yarn workspace sia-skynet start",
"build:server": "yarn workspace siaviewnode-server build",
"start:server": "yarn workspace siaviewnode-server start",
"start": "concurrently \"yarn start:client\" \"yarn start:server\""
},
"workspaces": {
"packages": [
"packages/*"
]
},
"dependencies": { "dependencies": {
"concurrently": "5.1.0" "@testing-library/dom": "^6.12.2",
"@testing-library/jest-dom": "^5.1.1",
"@testing-library/react": "^9.3.2",
"@testing-library/user-event": "^10.0.0",
"classnames": "^2.2.6",
"jsonp": "^0.2.1",
"node-sass": "^4.13.1",
"prop-types": "^15.7.2",
"react": "^16.12.0",
"react-countup": "^4.3.3",
"react-dom": "^16.12.0",
"react-dropzone": "^10.2.1",
"react-mailchimp-form": "^1.0.2",
"react-mailchimp-subscribe": "^2.1.0",
"react-reveal": "^1.2.2",
"react-scripts": "^3.4.0",
"react-syntax-highlighter": "^12.2.1",
"react-visibility-sensor": "^5.1.1",
"shortid": "^2.2.15"
},
"devDependencies": {
"prettier": "^1.19.1"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"format": "prettier --write \"**/*.{js,jsx,json,md}\""
},
"eslintConfig": {
"extends": "react-app"
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
} }
} }

View File

@ -1 +0,0 @@
build

View File

@ -1,68 +0,0 @@
This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app).
## Available Scripts
In the project directory, you can run:
### `yarn start`
Runs the app in the development mode.<br />
Open [http://localhost:3000](http://localhost:3000) to view it in the browser.
The page will reload if you make edits.<br />
You will also see any lint errors in the console.
### `yarn test`
Launches the test runner in the interactive watch mode.<br />
See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information.
### `yarn build`
Builds the app for production to the `build` folder.<br />
It correctly bundles React in production mode and optimizes the build for the best performance.
The build is minified and the filenames include the hashes.<br />
Your app is ready to be deployed!
See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information.
### `yarn eject`
**Note: this is a one-way operation. Once you `eject`, you cant go back!**
If you arent satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project.
Instead, it will copy all the configuration files and the transitive dependencies (Webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point youre on your own.
You dont have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldnt feel obligated to use this feature. However we understand that this tool wouldnt be useful if you couldnt customize it when you are ready for it.
## Learn More
You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started).
To learn React, check out the [React documentation](https://reactjs.org/).
### Code Splitting
This section has moved here: https://facebook.github.io/create-react-app/docs/code-splitting
### Analyzing the Bundle Size
This section has moved here: https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size
### Making a Progressive Web App
This section has moved here: https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app
### Advanced Configuration
This section has moved here: https://facebook.github.io/create-react-app/docs/advanced-configuration
### Deployment
This section has moved here: https://facebook.github.io/create-react-app/docs/deployment
### `yarn build` fails to minify
This section has moved here: https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify

View File

@ -1,50 +0,0 @@
{
"name": "sia-skynet",
"version": "0.1.0",
"private": true,
"homepage": "https://siasky.net",
"dependencies": {
"@testing-library/jest-dom": "^5.1.1",
"@testing-library/react": "^9.3.2",
"@testing-library/user-event": "^10.0.0",
"classnames": "^2.2.6",
"gh-pages": "^2.2.0",
"jsonp": "^0.2.1",
"node-sass": "^4.13.1",
"prop-types": "^15.7.2",
"react": "^16.12.0",
"react-countup": "^4.3.3",
"react-dom": "^16.12.0",
"react-dropzone": "^10.2.1",
"react-mailchimp-form": "^1.0.2",
"react-mailchimp-subscribe": "^2.1.0",
"react-reveal": "^1.2.2",
"react-scripts": "^3.4.0",
"react-syntax-highlighter": "^12.2.1",
"react-visibility-sensor": "^5.1.1",
"shortid": "^2.2.15"
},
"scripts": {
"predeploy": "npm run build",
"deploy": "gh-pages -d build",
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
},
"eslintConfig": {
"extends": "react-app"
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
}
}

Binary file not shown.

Binary file not shown.

View File

@ -1,7 +0,0 @@
import React from 'react'
import './CircleIcon.scss'
export default function CircleIcon({ children }) {
return <div className="circle-icon">{children}</div>
}

View File

@ -1,108 +0,0 @@
export default {
hljs: {
display: 'block',
overflowX: 'auto',
padding: '0.5em',
background: '#171917',
color: '#e6e1dc',
},
'hljs-comment': {
color: '#bc9458',
fontStyle: 'italic',
},
'hljs-quote': {
color: '#bc9458',
fontStyle: 'italic',
},
'hljs-keyword': {
color: '#c26230',
},
'hljs-selector-tag': {
color: '#c26230',
},
'hljs-string': {
color: '#a5c261',
},
'hljs-number': {
color: '#a5c261',
},
'hljs-regexp': {
color: '#a5c261',
},
'hljs-variable': {
color: '#a5c261',
},
'hljs-template-variable': {
color: '#a5c261',
},
'hljs-subst': {
color: '#519f50',
},
'hljs-tag': {
color: '#e8bf6a',
},
'hljs-name': {
color: '#e8bf6a',
},
'hljs-type': {
color: '#da4939',
},
'hljs-symbol': {
color: '#6d9cbe',
},
'hljs-bullet': {
color: '#6d9cbe',
},
'hljs-built_in': {
color: '#6d9cbe',
},
'hljs-builtin-name': {
color: '#6d9cbe',
},
'hljs-attr': {
color: '#6d9cbe',
},
'hljs-link': {
color: '#6d9cbe',
textDecoration: 'underline',
},
'hljs-params': {
color: '#d0d0ff',
},
'hljs-attribute': {
color: '#cda869',
},
'hljs-meta': {
color: '#9b859d',
},
'hljs-title': {
color: '#ffc66d',
},
'hljs-section': {
color: '#ffc66d',
},
'hljs-addition': {
backgroundColor: '#144212',
color: '#e6e1dc',
display: 'inline-block',
width: '100%',
},
'hljs-deletion': {
backgroundColor: '#600',
color: '#e6e1dc',
display: 'inline-block',
width: '100%',
},
'hljs-selector-class': {
color: '#9b703f',
},
'hljs-selector-id': {
color: '#8b98ab',
},
'hljs-emphasis': {
fontStyle: 'italic',
},
'hljs-strong': {
fontWeight: 'bold',
},
}

View File

@ -1,38 +0,0 @@
import App from './App/App'
import Button from './Button/Button'
import CodeExamples from './CodeExamples/CodeExamples'
import Sample from './Sample/Sample'
import SocialLink from './SocialLink/SocialLink'
import CircleIcon from './CircleIcon/CircleIcon'
import FAQ from './FAQ/FAQ'
import UploadFile from './UploadFile/UploadFile'
import LoadingSpinner from './LoadingSpinner/LoadingSpinner'
import Footer from './Footer/Footer'
import Mailing from './Mailing/Mailing'
import HomeTop from './HomeTop/HomeTop'
import HomeUpload from './HomeUpload/HomeUpload'
import HomeBuilt from './HomeBuilt/HomeBuilt'
import HomeSamples from './HomeSamples/HomeSamples'
import HomeStay from './HomeStay/HomeStay'
import HomeNetwork from './HomeNetwork/HomeNetwork'
export {
App,
HomeTop,
HomeUpload,
Button,
HomeBuilt,
CodeExamples,
Sample,
HomeSamples,
HomeStay,
SocialLink,
CircleIcon,
HomeNetwork,
FAQ,
UploadFile,
LoadingSpinner,
Footer,
Mailing,
}

View File

@ -1,7 +0,0 @@
import React from 'react'
import ReactDOM from 'react-dom'
import './global.scss'
import { App } from './components'
ReactDOM.render(<App />, document.getElementById('root'))

File diff suppressed because it is too large Load Diff

View File

@ -1,5 +0,0 @@
node_modules
build
npm-debug.log
error.log
info.log

View File

@ -1,22 +0,0 @@
# Custom Webpack Configuration With Typescript Example
## How to use
Download the example (or clone the whole project)[https://github.com/palmerhq/backpack.git]:
```bash
curl https://codeload.github.com/palmerhq/backpack/tar.gz/master | tar -xz --strip=2 backpack-master/examples/with-typescript
cd with-typescript
```
Install it and run:
```bash
npm install
npm run dev
```
## Idea behind the example
This demonstrates how to customize the underlying Webpack 2 configuration in a Backpack project using a `backpack.config.js` file.
The app itself is exactly the same project as the Webpack configuration example. However, the express application is written in TypeScript.

View File

@ -1,28 +0,0 @@
{
"name": "siaviewnode-server",
"version": "0.0.1",
"scripts": {
"start": "yarn build && PORT=4000 node ./build/main.js",
"build": "tsc --sourceMap"
},
"license": "MIT",
"dependencies": {
"@types/cors": "^2.8.6",
"@types/express": "^4.0.34",
"@types/express-fileupload": "^1.1.2",
"@types/express-request-id": "^1.4.1",
"@types/morgan": "^1.7.37",
"@types/shortid": "0.0.29",
"@types/winston": "^2.4.4",
"axios": "^0.19.2",
"cors": "2.8.5",
"express": "^4.14.0",
"express-fileupload": "1.1.6",
"express-request-id": "^1.4.1",
"express-session": "1.17.0",
"morgan": "^1.9.1",
"shortid": "2.2.15",
"typescript": "^3.7.5",
"winston": "^3.2.1"
}
}

View File

@ -1,26 +0,0 @@
import { createLogger, format, transports } from 'winston';
const { combine, timestamp, prettyPrint } = format;
export default createLogger({
format: combine(
timestamp(),
prettyPrint(),
),
transports: [
new transports.Console(),
new transports.File({
filename: './error.log',
level: 'error',
maxsize: 5242880,
maxFiles: 2
}),
new transports.File({
filename: './info.log',
level: 'info',
maxsize: 5242880,
maxFiles: 5
}),
],
exitOnError: false,
});

View File

@ -1,177 +0,0 @@
import axios from "axios"
import cors from "cors"
import express, { Request, Response } from "express"
import fileUpload, { UploadedFile } from "express-fileupload"
import requestId from "express-request-id"
import fs from "fs"
import morgan from 'morgan'
import { homedir } from "os"
import { Logger } from "winston"
import logger from "./logger"
const MAX_UPLOAD_FILESIZE = 1000 * 1024 * 1024
const SIAD_ENDPOINT = "http://localhost:9980"
// simple siad connection with static strings
const siad = axios.create({
baseURL: SIAD_ENDPOINT,
headers: {
"User-Agent": "Sia-Agent",
"Access-Control-Allow-Origin": "*"
},
auth: {
username: "",
password: fs.readFileSync(homedir().concat("/.sia/apipassword"), "utf8").trim()
}
})
class Server {
public app: express.Express
constructor(private logger: Logger) {
this.boot()
}
private boot() {
this.app = express()
this.logger.info("Configuring middleware...")
this.configureMiddleware()
this.logger.info("Configuring routes...")
this.configureRoutes()
this.logger.info("Booting server...")
const port = parseInt(process.env.PORT, 10) || 3000
this.app.listen(port, () => {
this.logger.info(`Listening on port ${port}`)
})
this.logger.info("Verifying connection to siad...")
this.verifyConnection().then((version: string | null) => {
if (version) {
this.logger.info(`siad reachable, version ${version}`)
}
})
}
private configureMiddleware() {
// add request id middleware (add unique id to X-Request-Id header)
this.app.use(requestId())
// add morgan middleware (HTTP request logging)
const options = {
stream: {
write: (msg: string) => {
this.logger.info(msg)
}
}
}
this.app.use(morgan("combined", options));
// configure CORS (simply enable all CORS requests)
this.app.use(cors())
// configure upload limits
this.app.use(fileUpload({ limits: { fileSize: MAX_UPLOAD_FILESIZE } }))
}
private configureRoutes() {
this.app.post("/skynet/skyfile/:uuid", this.handleSkyfilePOST.bind(this))
this.app.get(
"/stats", this.handleStatsGET.bind(this)
// TODO: redirect to protalstats
// proxy("http://localhost:9980/renter/portalstats", {
// proxyReqOptDecorator: (opts, _) => {
// opts.headers["User-Agent"] = "Sia-Agent"
// return opts
// },
// })
)
}
private async handleStatsGET(req: Request, res: Response): Promise<Response> {
const mockPSeries = {
'p80-1': 40,
'p95-1': 44,
'p99-1': 48,
'p80-24': 42,
'p95-24': 44,
'p99-24': 46,
'p80-168': 41,
'p95-168': 45,
'p99-168': 49,
}
const mockSeries = {
1: 22,
24: 438,
168: 2389,
}
const mockSeriesLarge = {
1: 22,
24: 438,
168: 2389,
720: 12045,
2160: 63900
}
const data = {
'ttfb': mockPSeries,
'download_small': mockPSeries,
'download_throughput': mockPSeries,
'download_total': mockSeries,
'upload_small': mockPSeries,
'upload_throughput': mockPSeries,
'upload_total': mockSeries,
'money_spent': mockSeriesLarge,
'total_files_pinned': 143,
'total_files_served': mockSeries,
}
return res.send(data)
}
private async verifyConnection(): Promise<string | null> {
try {
const resp = await siad.get('/daemon/version')
return resp.data.version
} catch (err) {
const { message } = err;
this.logger.error(message)
return null
}
}
private async handleSkyfilePOST(req: Request, res: Response): Promise<Response> {
const file = req?.files?.file as UploadedFile
if (!file) {
res.status(400).send({ error: "Missing file" })
}
if( !req.params.uuid ) {
res.status(400).send({ error: "Missing uuid" })
}
this.logger.info(`POST skyfile w/name ${file.name} and uid ${req.params.uuid}`)
try {
const { data } = await siad.post(
`/skynet/skyfile/${req.params.uuid}`,
file.data,
{
maxContentLength: MAX_UPLOAD_FILESIZE,
params: { filename: file.name }
}
)
return res.send(data)
} catch (err) {
const { message } = err;
this.logger.error(message)
return res.status(500).send({ error: err.message })
}
}
}
export default new Server(logger).app

View File

@ -1,66 +0,0 @@
{
"compilerOptions": {
/* Basic Options */
// "incremental": true, /* Enable incremental compilation */
"target": "es2020", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019' or 'ESNEXT'. */
"module": "commonjs", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */
"lib": ["es2020", "dom"], /* Specify library files to be included in the compilation. */
// "allowJs": true, /* Allow javascript files to be compiled. */
// "checkJs": true, /* Report errors in .js files. */
// "jsx": "preserve", /* Specify JSX code generation: 'preserve', 'react-native', or 'react'. */
// "declaration": true, /* Generates corresponding '.d.ts' file. */
// "declarationMap": true, /* Generates a sourcemap for each corresponding '.d.ts' file. */
// "sourceMap": true, /* Generates corresponding '.map' file. */
// "outFile": "./", /* Concatenate and emit output to single file. */
"outDir": "./build", /* Redirect output structure to the directory. */
// "rootDir": "./", /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */
// "composite": true, /* Enable project compilation */
// "tsBuildInfoFile": "./", /* Specify file to store incremental compilation information */
// "removeComments": true, /* Do not emit comments to output. */
// "noEmit": true, /* Do not emit outputs. */
// "importHelpers": true, /* Import emit helpers from 'tslib'. */
// "downlevelIteration": true, /* Provide full support for iterables in 'for-of', spread, and destructuring when targeting 'ES5' or 'ES3'. */
// "isolatedModules": true, /* Transpile each file as a separate module (similar to 'ts.transpileModule'). */
/* Strict Type-Checking Options */
"strict": false, /* Enable all strict type-checking options. */
// "noImplicitAny": true, /* Raise error on expressions and declarations with an implied 'any' type. */
// "strictNullChecks": true, /* Enable strict null checks. */
// "strictFunctionTypes": true, /* Enable strict checking of function types. */
// "strictBindCallApply": true, /* Enable strict 'bind', 'call', and 'apply' methods on functions. */
// "strictPropertyInitialization": true, /* Enable strict checking of property initialization in classes. */
// "noImplicitThis": true, /* Raise error on 'this' expressions with an implied 'any' type. */
// "alwaysStrict": true, /* Parse in strict mode and emit "use strict" for each source file. */
/* Additional Checks */
"noUnusedLocals": true, /* Report errors on unused locals. */
// "noUnusedParameters": true, /* Report errors on unused parameters. */
"noImplicitReturns": true, /* Report error when not all code paths in function return a value. */
// "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */
/* Module Resolution Options */
// "moduleResolution": "node", /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */
// "baseUrl": "./", /* Base directory to resolve non-absolute module names. */
// "paths": {}, /* A series of entries which re-map imports to lookup locations relative to the 'baseUrl'. */
// "rootDirs": [], /* List of root folders whose combined content represents the structure of the project at runtime. */
// "typeRoots": [], /* List of folders to include type definitions from. */
// "types": [], /* Type declaration files to be included in compilation. */
// "allowSyntheticDefaultImports": true, /* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */
"esModuleInterop": true, /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */
// "preserveSymlinks": true, /* Do not resolve the real path of symlinks. */
// "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */
/* Source Map Options */
// "sourceRoot": "", /* Specify the location where debugger should locate TypeScript files instead of source locations. */
// "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */
// "inlineSourceMap": true, /* Emit a single file with source maps instead of having a separate file. */
"inlineSources": true, /* Emit the source alongside the sourcemaps within a single file; requires '--inlineSourceMap' or '--sourceMap' to be set. */
/* Experimental Options */
// "experimentalDecorators": true, /* Enables experimental support for ES7 decorators. */
// "emitDecoratorMetadata": true, /* Enables experimental support for emitting type metadata for decorators. */
/* Advanced Options */
"forceConsistentCasingInFileNames": true /* Disallow inconsistently-cased references to the same file. */
}
}

File diff suppressed because it is too large Load Diff

View File

@ -1,10 +0,0 @@
{
"apps": [
{
"name": "skynet-api",
"script": "yarn",
"args": "start:server",
"interpreter": "/bin/bash"
}
]
}

View File

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 11 KiB

View File

Before

Width:  |  Height:  |  Size: 37 KiB

After

Width:  |  Height:  |  Size: 37 KiB

View File

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 15 KiB

View File

Before

Width:  |  Height:  |  Size: 1014 B

After

Width:  |  Height:  |  Size: 1014 B

View File

Before

Width:  |  Height:  |  Size: 1.9 KiB

After

Width:  |  Height:  |  Size: 1.9 KiB

View File

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 1.5 KiB

BIN
public/privacy.pdf Normal file

Binary file not shown.

BIN
public/terms.pdf Normal file

Binary file not shown.

View File

@ -5,6 +5,7 @@ configure some basic requirements for running a Skynet Portal. The assumption is
that we are working with a Debian Buster Minimal system or similar. that we are working with a Debian Buster Minimal system or similar.
## Initial Setup ## Initial Setup
(Assumes we are logged in as root on a fresh installation of Debian) (Assumes we are logged in as root on a fresh installation of Debian)
You may want to fork this repository and add your ssh pubkey to You may want to fork this repository and add your ssh pubkey to
@ -12,9 +13,9 @@ You may want to fork this repository and add your ssh pubkey to
0. SSH in a freshly installed Debian machine. 0. SSH in a freshly installed Debian machine.
1. `apt-get update && apt-get install sudo` 1. `apt-get update && apt-get install sudo`
2. `adduser user` 1. `adduser user`
3. `usermod -a -G sudo user` 1. `usermod -a -G sudo user`
4. Quit the ssh session. 1. Quit the ssh session.
You a can now ssh into your machine as the user `user`. You a can now ssh into your machine as the user `user`.
@ -43,6 +44,7 @@ NOTE: You must be running `siad` and `siac` by building from a version at least
as recent as `v1.4.3`. as recent as `v1.4.3`.
You still need to setup `siad` for the backend to be complete. You still need to setup `siad` for the backend to be complete.
1. `cd ~/; mkdir siad` 1. `cd ~/; mkdir siad`
2. `nohup siad &>/dev/null &` 2. `nohup siad &>/dev/null &`
@ -54,6 +56,7 @@ When `siad` is done syncing, create a new wallet and unlock the wallet.
Then set an allowance (`siac renter setallowance`), with the suggested values Then set an allowance (`siac renter setallowance`), with the suggested values
below: below:
- 10 KS (keep 25 KS in your wallet) - 10 KS (keep 25 KS in your wallet)
- default period - default period
- default number of hosts - default number of hosts
@ -71,11 +74,12 @@ Now your node will begin making 10 contracts per block with many hosts so it can
potentially view the whole network's files. potentially view the whole network's files.
## Running the Portal ## Running the Portal
`cd` into the parent directory and run `yarn` to build dependencies.
Skynet webportal consists of a client package and api package: Make sure you have [nodejs](https://nodejs.org/en/download/package-manager/) and [yarn](https://yarnpkg.com/getting-started/install) installed.
You can check that with `node -v` and `yarn -v` commands respectively.
- run `yarn build:client` to build the client package - it will be picked up by nginx automatically - run `cd /home/user/skynet-webportal`
- run `pm2 start pm2.json` to start the api service (we recommend https://pm2.keymetrics.io/ for process management) - run `yarn` to build dependencies
- run `yarn build:client` to build the client package
If you don't want to use pm2, you can call `yarn start:server` directly. Client package will be outputted to `/build` and nginx configuration will pick it up automatically.

View File

@ -11,18 +11,28 @@ server {
server_name siasky.net www.siasky.net; # replace with actual server names server_name siasky.net www.siasky.net; # replace with actual server names
location / { location / {
root /home/user/skynet-webportal/packages/sia-skynet/build; # path to root of index.html root /home/user/skynet-webportal/build; # path to root of index.html
} }
location /skynet/skyfile/ { location /skynet/skyfile/ {
client_max_body_size 1000M; # make sure to limit the size of upload to a sane value client_max_body_size 1000M; # make sure to limit the size of upload to a sane value
proxy_read_timeout 600; proxy_read_timeout 600;
proxy_pass http://127.0.0.1:4000; # proxy this call to siad endpoint (make sure the ip is correct)
proxy_pass http://127.0.0.1:9980;
proxy_set_header Expect $http_expect;
proxy_set_header Access-Control-Allow-Origin: *;
# make sure to override user agent header - siad requirement
proxy_set_header User-Agent: Sia-Agent;
# replace BASE64_AUTHENTICATION with base64 encoded <user>:<password>
# for sia user is empty so it's just :<password>
# to generate the passcode use https://www.base64encode.org or any other base64 encoder
proxy_set_header Authorization "Basic BASE64_AUTHENTICATION";
proxy_pass_header Authorization;
} }
location ~ "^/([a-zA-Z0-9-_]{46})$" { location ~ "^/([a-zA-Z0-9-_]{46})$" {
proxy_read_timeout 600; proxy_read_timeout 600;
# proxy this call to siad /skunet/skylink/ endpoint (make sure the ip is correct) # proxy this call to siad /skynet/skylink/ endpoint (make sure the ip is correct)
proxy_pass http://127.0.0.1:9980/skynet/skylink/$1; proxy_pass http://127.0.0.1:9980/skynet/skylink/$1;
proxy_set_header Access-Control-Allow-Origin: *; proxy_set_header Access-Control-Allow-Origin: *;
# make sure to override user agent header - siad requirement # make sure to override user agent header - siad requirement

View File

@ -1,7 +1,7 @@
import React from 'react' import React from "react";
import './App.scss' import "./App.scss";
import { HomeTop, HomeUpload, HomeBuilt, HomeSamples, HomeStay, HomeNetwork, Footer } from '../' import { HomeTop, HomeUpload, HomeBuilt, HomeSamples, HomeStay, HomeNetwork, Footer } from "../";
function App() { function App() {
return ( return (
@ -24,7 +24,7 @@ function App() {
<Footer /> <Footer />
</div> </div>
) );
} }
export default App export default App;

View File

@ -3,21 +3,8 @@ import classNames from "classnames";
import "./Button.scss"; import "./Button.scss";
export default function Button({ export default function Button({ href, type, children, full, className, iconLeft, iconRight, ...rest }) {
href, const classes = classNames("button", { iconLeft, iconRight, full }, className);
type,
children,
full,
className,
iconLeft,
iconRight,
...rest
}) {
const classes = classNames(
"button",
{ iconLeft, iconRight, full },
className
);
if (href) { if (href) {
return ( return (

View File

@ -0,0 +1,7 @@
import React from "react";
import "./CircleIcon.scss";
export default function CircleIcon({ children }) {
return <div className="circle-icon">{children}</div>;
}

View File

@ -6,13 +6,13 @@ print("Upload successful, skylink: " + skylink)
# download # download
Skynet.DownloadFile("./dst.jpg", skylink) Skynet.DownloadFile("./dst.jpg", skylink)
print("Download successful")` print("Download successful")`;
export const curl = `# upload export const curl = `# upload
curl -X POST "https://siasky.net/skynet/skyfile/[uuid]" -F file=@src.jpg curl -X POST "https://siasky.net/skynet/skyfile/[uuid]" -F file=@src.jpg
# download # download
curl "https://siasky.net/[skylink]" -o dst.jpg` curl "https://siasky.net/[skylink]" -o dst.jpg`;
export const node = `const skynet = require('@nebulous/skynet'); export const node = `const skynet = require('@nebulous/skynet');
@ -31,7 +31,7 @@ export const node = `const skynet = require('@nebulous/skynet');
skynet.DefaultDownloadOptions skynet.DefaultDownloadOptions
); );
console.log('Download successful'); console.log('Download successful');
})()` })()`;
export const go = `package main export const go = `package main
@ -56,8 +56,8 @@ func main() {
return return
} }
fmt.Println("Download successful") fmt.Println("Download successful")
}` }`;
export const ruby = `` export const ruby = ``;
export const php = `` export const php = ``;

View File

@ -1,13 +1,13 @@
import React, { useState } from 'react' import React, { useState } from "react";
import SyntaxHighlighter from 'react-syntax-highlighter' import SyntaxHighlighter from "react-syntax-highlighter";
import classNames from 'classnames' import classNames from "classnames";
import './CodeExamples.scss' import "./CodeExamples.scss";
import Colors from './Colors' import Colors from "./Colors";
import { python, curl, node, go } from './Code' import { python, curl, node, go } from "./Code";
export default function CodeExamples() { export default function CodeExamples() {
const [active, setActive] = useState(1) const [active, setActive] = useState(1);
return ( return (
<div className="code-examples"> <div className="code-examples">
@ -52,5 +52,5 @@ export default function CodeExamples() {
)} )}
</div> </div>
</div> </div>
) );
} }

View File

@ -0,0 +1,108 @@
export default {
hljs: {
display: "block",
overflowX: "auto",
padding: "0.5em",
background: "#171917",
color: "#e6e1dc"
},
"hljs-comment": {
color: "#bc9458",
fontStyle: "italic"
},
"hljs-quote": {
color: "#bc9458",
fontStyle: "italic"
},
"hljs-keyword": {
color: "#c26230"
},
"hljs-selector-tag": {
color: "#c26230"
},
"hljs-string": {
color: "#a5c261"
},
"hljs-number": {
color: "#a5c261"
},
"hljs-regexp": {
color: "#a5c261"
},
"hljs-variable": {
color: "#a5c261"
},
"hljs-template-variable": {
color: "#a5c261"
},
"hljs-subst": {
color: "#519f50"
},
"hljs-tag": {
color: "#e8bf6a"
},
"hljs-name": {
color: "#e8bf6a"
},
"hljs-type": {
color: "#da4939"
},
"hljs-symbol": {
color: "#6d9cbe"
},
"hljs-bullet": {
color: "#6d9cbe"
},
"hljs-built_in": {
color: "#6d9cbe"
},
"hljs-builtin-name": {
color: "#6d9cbe"
},
"hljs-attr": {
color: "#6d9cbe"
},
"hljs-link": {
color: "#6d9cbe",
textDecoration: "underline"
},
"hljs-params": {
color: "#d0d0ff"
},
"hljs-attribute": {
color: "#cda869"
},
"hljs-meta": {
color: "#9b859d"
},
"hljs-title": {
color: "#ffc66d"
},
"hljs-section": {
color: "#ffc66d"
},
"hljs-addition": {
backgroundColor: "#144212",
color: "#e6e1dc",
display: "inline-block",
width: "100%"
},
"hljs-deletion": {
backgroundColor: "#600",
color: "#e6e1dc",
display: "inline-block",
width: "100%"
},
"hljs-selector-class": {
color: "#9b703f"
},
"hljs-selector-id": {
color: "#8b98ab"
},
"hljs-emphasis": {
fontStyle: "italic"
},
"hljs-strong": {
fontWeight: "bold"
}
};

View File

@ -1,6 +1,6 @@
import React from 'react' import React from "react";
import './FAQ.scss' import "./FAQ.scss";
export default function FAQ({ title, children }) { export default function FAQ({ title, children }) {
return ( return (
@ -11,5 +11,5 @@ export default function FAQ({ title, children }) {
{children} {children}
</div> </div>
</div> </div>
) );
} }

View File

@ -13,7 +13,7 @@ export default function Footer() {
<div className="width"> <div className="width">
<Fade duration={700} distance="40px" bottom> <Fade duration={700} distance="40px" bottom>
<div className="footer-column"> <div className="footer-column">
<Built width={120} height={120} preserveAspectRatio={'xMinYMin'}/> <Built width={120} height={120} preserveAspectRatio={"xMinYMin"} />
</div> </div>
</Fade> </Fade>
@ -28,13 +28,13 @@ export default function Footer() {
</a> </a>
</li> </li>
<li> <li>
<a href="https://skynet.luxor.tech/" target="_blank" rel="noopener noreferrer"> <a href="https://sialoop.net" target="_blank" rel="noopener noreferrer">
skynet.luxor.tech sialoop.net
</a> </a>
</li> </li>
<li> <li>
<a href="https://sialoop.net" target="_blank" rel="noopener noreferrer"> <a href="https://skynet.luxor.tech" target="_blank" rel="noopener noreferrer">
sialoop.net skynet.luxor.tech
</a> </a>
</li> </li>
<li> <li>

View File

@ -50,23 +50,14 @@ export default class HomeNetwork extends Component {
</header> </header>
<Fade duration={700} distance="40px" bottom> <Fade duration={700} distance="40px" bottom>
<VisibilitySensor <VisibilitySensor onChange={this.onChange} partialVisibility offset={{ bottom: 100 }} scrollThrottle={50}>
onChange={this.onChange}
partialVisibility
offset={{ bottom: 100 }}
scrollThrottle={50}
>
<div className="home-network-stats"> <div className="home-network-stats">
{stats.map((stat, i) => ( {stats.map((stat, i) => (
<React.Fragment key={i}> <React.Fragment key={i}>
<div key={i} className="home-network-stat"> <div key={i} className="home-network-stat">
<div className="inner"> <div className="inner">
<h3> <h3>
{this.state.visable ? ( {this.state.visable ? <CountUp end={stat.value} duration={3.2} /> : 0}
<CountUp end={stat.value} duration={3.2} />
) : (
0
)}
{stat.cent && "¢"} {stat.cent && "¢"}
</h3> </h3>
<span className="network-stat-name">{stat.name}</span> <span className="network-stat-name">{stat.name}</span>
@ -86,24 +77,20 @@ export default class HomeNetwork extends Component {
<div className="home-network-column left"> <div className="home-network-column left">
<Fade duration={700} distance="40px" bottom> <Fade duration={700} distance="40px" bottom>
<p> <p>
<strong>Skynet Webportals</strong> are low cost servers that sit between Skynet <strong>Skynet Webportals</strong> are low cost servers that sit between Skynet and everyday users,
and everyday users, enabling them to access Skynet content enabling them to access Skynet content without needing to operate any special software. As Skylinks are
without needing to operate any special software. As generated, they can be shared with anyone to retrieve data from any Webportal. The original uploader
Skylinks are generated, they can be shared with anyone to retrieve does not need to stay online in order for the file to remain available. The Sia network serves as the
data from any Webportal. The original uploader does not need to stay backend storage layer for Skynet and handles all of the pinning, guaranteeing both high speeds and
online in order for the file to remain available. The Sia network excellent uptime.
serves as the backend storage layer for Skynet and handles all
of the pinning, guaranteeing both high speeds and excellent uptime.
</p> </p>
</Fade> </Fade>
<Fade duration={700} distance="40px" bottom> <Fade duration={700} distance="40px" bottom>
<p> <p>
<strong>Sia</strong> is the leading decentralized cloud storage platform. No <strong>Sia</strong> is the leading decentralized cloud storage platform. No signups, no servers, no
signups, no servers, no trusted third parties. Sia leverages trusted third parties. Sia leverages blockchain technology to create a data storage marketplace that is
blockchain technology to create a data storage marketplace that more robust and more affordable than traditional cloud storage providers.
is more robust and more affordable than traditional cloud
storage providers.
</p> </p>
<p> <p>
@ -117,10 +104,16 @@ export default class HomeNetwork extends Component {
<Fade duration={700} distance="40px" bottom> <Fade duration={700} distance="40px" bottom>
<FAQ title="How do I use Skynet?"> <FAQ title="How do I use Skynet?">
<p> <p>
Anyone can access files that have been uploaded to Skynet as long Anyone can access files that have been uploaded to Skynet as long as they possess the corresponding
as they possess the corresponding Skylinks. You can use any Webportal Skylinks. You can use any Webportal to download files!
to download files! <a
<a href="https://skynet.helpdocs.io/article/3p9z5g9s0e-skynet-how-to" target="_blank" rel="noopener noreferrer" className="more read-more">read more</a> href="https://skynet.helpdocs.io/article/3p9z5g9s0e-skynet-how-to"
target="_blank"
rel="noopener noreferrer"
className="more read-more"
>
read more
</a>
</p> </p>
</FAQ> </FAQ>
</Fade> </Fade>
@ -128,10 +121,16 @@ export default class HomeNetwork extends Component {
<Fade duration={700} distance="40px" bottom> <Fade duration={700} distance="40px" bottom>
<FAQ title="How do I integrate Skynet into my app?"> <FAQ title="How do I integrate Skynet into my app?">
<p> <p>
Applications can be deployed in under a minute and be immediately Applications can be deployed in under a minute and be immediately available globally. Skynet includes
available globally. Skynet includes an API and SDKs which integrate an API and SDKs which integrate seamlessly with existing applications.
seamlessly with existing applications. <a
<a href="https://skynet.helpdocs.io/article/hrshqsn9wz-integrating-skynet" target="_blank" rel="noopener noreferrer" className="more read-more">read more</a> href="https://skynet.helpdocs.io/article/hrshqsn9wz-integrating-skynet"
target="_blank"
rel="noopener noreferrer"
className="more read-more"
>
read more
</a>
</p> </p>
</FAQ> </FAQ>
</Fade> </Fade>
@ -139,9 +138,16 @@ export default class HomeNetwork extends Component {
<Fade duration={700} distance="40px" bottom> <Fade duration={700} distance="40px" bottom>
<FAQ title="How fast is Skynet?"> <FAQ title="How fast is Skynet?">
<p> <p>
Skynet's speeds rival centralized providers and surpass all decentralized offerings. Skynet's speeds rival centralized providers and surpass all decentralized offerings. A typical Skynet
A typical Skynet download starts in under 500 ms and can stream at rates as high as 1 Gbps! download starts in under 500 ms and can stream at rates as high as 1 Gbps!
<a href="https://skynet.helpdocs.io/article/430teoxgqc-skynet-speed" target="_blank" rel="noopener noreferrer" className="more read-more">read more</a> <a
href="https://skynet.helpdocs.io/article/430teoxgqc-skynet-speed"
target="_blank"
rel="noopener noreferrer"
className="more read-more"
>
read more
</a>
</p> </p>
</FAQ> </FAQ>
</Fade> </Fade>
@ -149,8 +155,8 @@ export default class HomeNetwork extends Component {
<Fade duration={700} distance="40px" bottom> <Fade duration={700} distance="40px" bottom>
<FAQ title="How much does it cost to run a Webportal?"> <FAQ title="How much does it cost to run a Webportal?">
<p> <p>
Storage costs 10x lower than centralized providers and bandwidth costs are 100x lower Storage costs 10x lower than centralized providers and bandwidth costs are 100x lower without
without sacrificing performance or reliability. sacrificing performance or reliability.
</p> </p>
</FAQ> </FAQ>
</Fade> </Fade>

View File

@ -11,7 +11,7 @@ const samples = [
{ type: "Image", url: "/IADUs8d9CQjUO34LmdaaNPK_STuZo24rpKVfYW3wPPM2uQ" }, { type: "Image", url: "/IADUs8d9CQjUO34LmdaaNPK_STuZo24rpKVfYW3wPPM2uQ" },
{ type: "Audio", url: "/_A2zt5SKoqwnnZU4cBF8uBycSKULXMyeg1c5ZISBr2Q3dA" }, { type: "Audio", url: "/_A2zt5SKoqwnnZU4cBF8uBycSKULXMyeg1c5ZISBr2Q3dA" },
{ type: "Video", url: "/CABAB_1Dt0FJsxqsu_J4TodNCbCGvtFf1Uys_3EgzOlTcg" }, { type: "Video", url: "/CABAB_1Dt0FJsxqsu_J4TodNCbCGvtFf1Uys_3EgzOlTcg" },
{ type: "JSON", url: "/AAC0uO43g64ULpyrW0zO3bjEknSFbAhm8c-RFP21EQlmSQ" }, { type: "JSON", url: "/AAC0uO43g64ULpyrW0zO3bjEknSFbAhm8c-RFP21EQlmSQ" }
// { type: "Dapps", url: "#" } // { type: "Dapps", url: "#" }
]; ];
@ -20,20 +20,15 @@ export default function HomeSamples() {
<div className="home-samples"> <div className="home-samples">
<Fade duration={700} distance="40px" bottom> <Fade duration={700} distance="40px" bottom>
<p> <p>
Skynet includes SDKs for popular programming languages that integrate Skynet includes SDKs for popular programming languages that integrate seamlessly with your existing apps.
seamlessly with your existing apps. Above are some code snippets Above are some code snippets for uploading and retrieving data.
for uploading and retrieving data.
</p> </p>
</Fade> </Fade>
<Reveal effect="active"> <Reveal effect="active">
<div className="home-samples-samples"> <div className="home-samples-samples">
{samples.map((sample, i) => ( {samples.map((sample, i) => (
<Sample <Sample className={`fadeInUp delay${i + 1}`} key={`${i}-${sample.url}`} {...sample} />
className={`fadeInUp delay${i + 1}`}
key={`${i}-${sample.url}`}
{...sample}
/>
))} ))}
</div> </div>
</Reveal> </Reveal>

View File

@ -1,6 +1,6 @@
import React from "react"; import React from "react";
import Reveal from "react-reveal/Reveal"; import Reveal from "react-reveal/Reveal";
import logo from '../../images/logo.svg'; import logo from "../../images/logo.svg";
import "./HomeTop.scss"; import "./HomeTop.scss";
import { Skynet, Deco1, Deco2 } from "../../svg"; import { Skynet, Deco1, Deco2 } from "../../svg";
@ -8,14 +8,14 @@ export default function HomeTop() {
return ( return (
<Reveal effect="active"> <Reveal effect="active">
<div className="home-top"> <div className="home-top">
<img src={logo} alt="Skynet logo" className="logo"/> <img src={logo} alt="Skynet logo" className="logo" />
<Skynet className="wordmark" /> <Skynet className="wordmark" />
<h1 className="fadeInUp delay2">Build a Free Internet.</h1> <h1 className="fadeInUp delay2">Build a Free Internet.</h1>
<p className="fadeInUp delay3"> <p className="fadeInUp delay3">
The decentralized CDN and file sharing platform for devs. The decentralized CDN and file sharing platform for devs. Skynet is the storage foundation for a Free
Skynet is the storage foundation for a Free Internet! Internet!
</p> </p>
<Deco1 className="deco-1 fadeInUp delay6" /> <Deco1 className="deco-1 fadeInUp delay6" />

View File

@ -1,26 +1,23 @@
import React, { Component } from 'react' import React, { Component } from "react";
import classNames from 'classnames' import classNames from "classnames";
import Dropzone from 'react-dropzone' import Dropzone from "react-dropzone";
import Reveal from 'react-reveal/Reveal' import Reveal from "react-reveal/Reveal";
import shortid from 'shortid'; import shortid from "shortid";
import { Button, UploadFile } from '../' import { Button, UploadFile } from "../";
import { Deco3, Deco4, Deco5, Folder, DownArrow } from '../../svg' import { Deco3, Deco4, Deco5, Folder, DownArrow } from "../../svg";
import './HomeUpload.scss' import "./HomeUpload.scss";
export default class HomeUpload extends Component { export default class HomeUpload extends Component {
state = { files: [] } state = { files: [] };
handleDrop = async acceptedFiles => { handleDrop = async acceptedFiles => {
this.setState({ this.setState({
files: [ files: [...acceptedFiles.map(file => ({ file, status: "uploading" })), ...this.state.files]
...acceptedFiles.map(file => ({ file, status: 'uploading' })), });
...this.state.files,
],
})
const onComplete = (file, status, skylink) => { const onComplete = (file, status, skylink) => {
this.setState(state => { this.setState(state => {
const index = state.files.findIndex(f => f.file === file) const index = state.files.findIndex(f => f.file === file);
return { return {
files: [ files: [
@ -28,39 +25,39 @@ export default class HomeUpload extends Component {
{ {
...state.files[index], ...state.files[index],
status, status,
url: `https://siasky.net/${skylink}`, url: `https://siasky.net/${skylink}`
}, },
...state.files.slice(index + 1), ...state.files.slice(index + 1)
], ]
} };
}) });
} };
acceptedFiles.forEach(async file => { acceptedFiles.forEach(async file => {
try { try {
const fd = new FormData() const fd = new FormData();
fd.append('file', file) fd.append("file", file);
const uuid = shortid.generate(); const uuid = shortid.generate();
const response = await fetch(`/skynet/skyfile/${uuid}`, { method: 'POST', body: fd }) const response = await fetch(`/skynet/skyfile/${uuid}`, { method: "POST", body: fd });
const { skylink } = await response.json() const { skylink } = await response.json();
onComplete(file, 'complete', skylink) onComplete(file, "complete", skylink);
} catch (error) { } catch (error) {
onComplete(file, 'error') onComplete(file, "error");
}
})
} }
});
};
handleSkylink = event => { handleSkylink = event => {
event.preventDefault() event.preventDefault();
const skylink = event.target.skylink.value.replace('sia://', '') const skylink = event.target.skylink.value.replace("sia://", "");
if (skylink.match(/^[a-zA-Z0-9_-]{46}$/)) { if (skylink.match(/^[a-zA-Z0-9_-]{46}$/)) {
window.open(skylink, '_blank') window.open(skylink, "_blank");
}
} }
};
render() { render() {
return ( return (
@ -73,8 +70,8 @@ export default class HomeUpload extends Component {
{({ getRootProps, getInputProps, isDragActive }) => ( {({ getRootProps, getInputProps, isDragActive }) => (
<> <>
<div <div
className={classNames('home-upload-dropzone', { className={classNames("home-upload-dropzone", {
'drop-active': isDragActive, "drop-active": isDragActive
})} })}
{...getRootProps()} {...getRootProps()}
> >
@ -111,15 +108,15 @@ export default class HomeUpload extends Component {
{this.state.files.length > 0 && ( {this.state.files.length > 0 && (
<div className="home-uploaded-files"> <div className="home-uploaded-files">
{this.state.files.map((file, i) => { {this.state.files.map((file, i) => {
return <UploadFile key={i} {...file} /> return <UploadFile key={i} {...file} />;
})} })}
</div> </div>
)} )}
</div> </div>
<p className="bottom-text fadeInUp delay5"> <p className="bottom-text fadeInUp delay5">
Upon uploading a file, Skynet generates a 46 byte link called a <strong>Skylink</strong>. This link can then be shared Upon uploading a file, Skynet generates a 46 byte link called a <strong>Skylink</strong>. This link can then
with anyone to retrieve the file on any Skynet Webportal. be shared with anyone to retrieve the file on any Skynet Webportal.
</p> </p>
<Deco3 className="deco-3 fadeInUp delay6" /> <Deco3 className="deco-3 fadeInUp delay6" />
@ -127,6 +124,6 @@ export default class HomeUpload extends Component {
<Deco5 className="deco-5 fadeInUp delay6" /> <Deco5 className="deco-5 fadeInUp delay6" />
</div> </div>
</Reveal> </Reveal>
) );
} }
} }

View File

@ -1,12 +1,12 @@
import React from 'react' import React from "react";
import './LoadingSpinner.scss' import "./LoadingSpinner.scss";
import { Loading } from '../../svg' import { Loading } from "../../svg";
export default function LoadingSpinner() { export default function LoadingSpinner() {
return ( return (
<div className="loading-spinner"> <div className="loading-spinner">
<Loading /> <Loading />
</div> </div>
) );
} }

View File

@ -1,25 +1,25 @@
import React from 'react' import React from "react";
import MailchimpSubscribe from 'react-mailchimp-subscribe' import MailchimpSubscribe from "react-mailchimp-subscribe";
import classNames from 'classnames' import classNames from "classnames";
import './Mailing.scss' import "./Mailing.scss";
const url = 'https://tech.us11.list-manage.com/subscribe/post?u=5df238d9e852f9801b5f2c92e&amp;id=ab6bea4cc2' const url = "https://tech.us11.list-manage.com/subscribe/post?u=5df238d9e852f9801b5f2c92e&amp;id=ab6bea4cc2";
const CustomForm = ({ status, message, onValidated, light, id }) => { const CustomForm = ({ status, message, onValidated, light, id }) => {
let email, user let email, user;
const submit = () => { const submit = () => {
if ((email, user, email.value.indexOf('@') > -1)) { if ((email, user, email.value.indexOf("@") > -1)) {
onValidated({ onValidated({
EMAIL: email.value, EMAIL: email.value,
USER: user.checked ? 'Yes' : 'No', USER: user.checked ? "Yes" : "No"
}) });
}
} }
};
return ( return (
<form className={classNames('home-stay-form', { light })} onSubmit={e => e.preventDefault()}> <form className={classNames("home-stay-form", { light })} onSubmit={e => e.preventDefault()}>
<input ref={node => (email = node)} type="email" placeholder="Email Address" validate="true" /> <input ref={node => (email = node)} type="email" placeholder="Email Address" validate="true" />
<div className="home-form-stay-existing"> <div className="home-form-stay-existing">
<input ref={node => (user = node)} type="checkbox" id={id} /> <input ref={node => (user = node)} type="checkbox" id={id} />
@ -29,12 +29,12 @@ const CustomForm = ({ status, message, onValidated, light, id }) => {
Get Updates Get Updates
</button> </button>
{status === 'sending' && <p className="message">sending...</p>} {status === "sending" && <p className="message">sending...</p>}
{status === 'error' && <p className="message red-text" dangerouslySetInnerHTML={{ __html: message }} />} {status === "error" && <p className="message red-text" dangerouslySetInnerHTML={{ __html: message }} />}
{status === 'success' && <p className="message" dangerouslySetInnerHTML={{ __html: message }} />} {status === "success" && <p className="message" dangerouslySetInnerHTML={{ __html: message }} />}
</form> </form>
) );
} };
export default function Mailing({ light, id }) { export default function Mailing({ light, id }) {
return ( return (
@ -50,5 +50,5 @@ export default function Mailing({ light, id }) {
/> />
)} )}
/> />
) );
} }

View File

@ -1,12 +1,12 @@
import React from 'react' import React from "react";
import classNames from 'classnames' import classNames from "classnames";
import './Sample.scss' import "./Sample.scss";
import { Download } from '../../svg' import { Download } from "../../svg";
export default function Sample({ type, url, className }) { export default function Sample({ type, url, className }) {
return ( return (
<div className={classNames('sample', className)}> <div className={classNames("sample", className)}>
<a href={url} target="_blank" rel="noopener noreferrer"> <a href={url} target="_blank" rel="noopener noreferrer">
<Download /> <Download />
<span className="sample-name"> <span className="sample-name">
@ -15,5 +15,5 @@ export default function Sample({ type, url, className }) {
<span className="sample-download">Download</span> <span className="sample-download">Download</span>
</a> </a>
</div> </div>
) );
} }

View File

@ -1,18 +1,18 @@
import React from 'react' import React from "react";
import './SocialLink.scss' import "./SocialLink.scss";
import { Github, Discord, Twitter } from '../../svg' import { Github, Discord, Twitter } from "../../svg";
export default function SocialLink({ icon, title, greenText, url }) { export default function SocialLink({ icon, title, greenText, url }) {
const getIcon = () => { const getIcon = () => {
if (icon === 'github') { if (icon === "github") {
return <Github /> return <Github />;
} else if (icon === 'discord') { } else if (icon === "discord") {
return <Discord /> return <Discord />;
} else if (icon === 'twitter') { } else if (icon === "twitter") {
return <Twitter /> return <Twitter />;
}
} }
};
return ( return (
<a href={url} className="social-link"> <a href={url} className="social-link">
@ -22,5 +22,5 @@ export default function SocialLink({ icon, title, greenText, url }) {
<span className="social-link-green">{greenText}</span> <span className="social-link-green">{greenText}</span>
</span> </span>
</a> </a>
) );
} }

View File

@ -46,9 +46,7 @@ export default class UploadFile extends Component {
<p> <p>
{status === "uploading" && "Uploading..."} {status === "uploading" && "Uploading..."}
{status === "processing" && "Processing..."} {status === "processing" && "Processing..."}
{status === "error" && ( {status === "error" && <span className="red-text">Error processing file.</span>}
<span className="red-text">Error processing file.</span>
)}
{status === "complete" && ( {status === "complete" && (
<a href={url} className="url green-text"> <a href={url} className="url green-text">
{url} {url}

38
src/components/index.js Normal file
View File

@ -0,0 +1,38 @@
import App from "./App/App";
import Button from "./Button/Button";
import CodeExamples from "./CodeExamples/CodeExamples";
import Sample from "./Sample/Sample";
import SocialLink from "./SocialLink/SocialLink";
import CircleIcon from "./CircleIcon/CircleIcon";
import FAQ from "./FAQ/FAQ";
import UploadFile from "./UploadFile/UploadFile";
import LoadingSpinner from "./LoadingSpinner/LoadingSpinner";
import Footer from "./Footer/Footer";
import Mailing from "./Mailing/Mailing";
import HomeTop from "./HomeTop/HomeTop";
import HomeUpload from "./HomeUpload/HomeUpload";
import HomeBuilt from "./HomeBuilt/HomeBuilt";
import HomeSamples from "./HomeSamples/HomeSamples";
import HomeStay from "./HomeStay/HomeStay";
import HomeNetwork from "./HomeNetwork/HomeNetwork";
export {
App,
HomeTop,
HomeUpload,
Button,
HomeBuilt,
CodeExamples,
Sample,
HomeSamples,
HomeStay,
SocialLink,
CircleIcon,
HomeNetwork,
FAQ,
UploadFile,
LoadingSpinner,
Footer,
Mailing
};

View File

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 1.5 KiB

7
src/index.js Normal file
View File

@ -0,0 +1,7 @@
import React from "react";
import ReactDOM from "react-dom";
import "./global.scss";
import { App } from "./components";
ReactDOM.render(<App />, document.getElementById("root"));

View File

@ -1,9 +1,9 @@
import React from 'react' import React from "react";
export default function Arrow({ className }) { export default function Arrow({ className }) {
return ( return (
<svg className={className} viewBox="0 0 15 7" width={15} height={7} xmlns="http://www.w3.org/2000/svg"> <svg className={className} viewBox="0 0 15 7" width={15} height={7} xmlns="http://www.w3.org/2000/svg">
<path d="M0 6h12L7 1" stroke="currentColor" strokeWidth="2" fill="none" fillRule="evenodd" /> <path d="M0 6h12L7 1" stroke="currentColor" strokeWidth="2" fill="none" fillRule="evenodd" />
</svg> </svg>
) );
} }

View File

@ -1,4 +1,4 @@
import React from 'react' import React from "react";
export default function Built(props) { export default function Built(props) {
return ( return (
@ -19,5 +19,5 @@ export default function Built(props) {
</g> </g>
</g> </g>
</svg> </svg>
) );
} }

View File

@ -1,4 +1,4 @@
import React from 'react' import React from "react";
export default function Cylinder({ className }) { export default function Cylinder({ className }) {
return ( return (
@ -12,5 +12,5 @@ export default function Cylinder({ className }) {
strokeLinejoin="round" strokeLinejoin="round"
/> />
</svg> </svg>
) );
} }

View File

@ -1,4 +1,4 @@
import React from 'react' import React from "react";
export default function Deco1(props) { export default function Deco1(props) {
return ( return (
@ -16,5 +16,5 @@ export default function Deco1(props) {
/> />
</g> </g>
</svg> </svg>
) );
} }

View File

@ -1,4 +1,4 @@
import React from 'react' import React from "react";
export default function Deco2(props) { export default function Deco2(props) {
return ( return (
@ -16,5 +16,5 @@ export default function Deco2(props) {
/> />
</g> </g>
</svg> </svg>
) );
} }

View File

@ -1,4 +1,4 @@
import React from 'react' import React from "react";
export default function Deco3(props) { export default function Deco3(props) {
return ( return (
@ -16,5 +16,5 @@ export default function Deco3(props) {
/> />
</g> </g>
</svg> </svg>
) );
} }

View File

@ -1,4 +1,4 @@
import React from 'react' import React from "react";
export default function Deco4(props) { export default function Deco4(props) {
return ( return (
@ -16,5 +16,5 @@ export default function Deco4(props) {
/> />
</g> </g>
</svg> </svg>
) );
} }

View File

@ -1,4 +1,4 @@
import React from 'react' import React from "react";
export default function Deco5(props) { export default function Deco5(props) {
return ( return (
@ -37,5 +37,5 @@ export default function Deco5(props) {
</g> </g>
</g> </g>
</svg> </svg>
) );
} }

View File

@ -1,4 +1,4 @@
import React from 'react' import React from "react";
export default function Deco6(props) { export default function Deco6(props) {
return ( return (
@ -16,5 +16,5 @@ export default function Deco6(props) {
/> />
</g> </g>
</svg> </svg>
) );
} }

View File

@ -1,4 +1,4 @@
import React from 'react' import React from "react";
export default function Deco7(props) { export default function Deco7(props) {
return ( return (
@ -13,5 +13,5 @@ export default function Deco7(props) {
/> />
</g> </g>
</svg> </svg>
) );
} }

View File

@ -1,4 +1,4 @@
import React from 'react' import React from "react";
export default function Deco8(props) { export default function Deco8(props) {
return ( return (
@ -17,5 +17,5 @@ export default function Deco8(props) {
/> />
</g> </g>
</svg> </svg>
) );
} }

Some files were not shown because too many files have changed in this diff Show More