17 changed files with 0 additions and 4379 deletions
@ -1,8 +0,0 @@
|
||||
# EULA |
||||
|
||||
* Projects are subdirectories in the `projects`-root. |
||||
* Projects posted without a license, will default to `Åndsverksloven`. |
||||
|
||||
Agreed: |
||||
@zalox |
||||
@HxxxxxS |
||||
@ -1,7 +0,0 @@
|
||||
# projects |
||||
##### a social experiment. |
||||
|
||||
# Introduction |
||||
Commit what you want, whenever you want, but you must sign the EULA to contribute. |
||||
|
||||
|
||||
@ -1,22 +0,0 @@
|
||||
The MIT License (MIT) |
||||
|
||||
Copyright (c) 2017 zalox |
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy |
||||
of this software and associated documentation files (the "Software"), to deal |
||||
in the Software without restriction, including without limitation the rights |
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
||||
copies of the Software, and to permit persons to whom the Software is |
||||
furnished to do so, subject to the following conditions: |
||||
|
||||
The above copyright notice and this permission notice shall be included in all |
||||
copies or substantial portions of the Software. |
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
||||
SOFTWARE. |
||||
|
||||
@ -1,23 +0,0 @@
|
||||
const Webpack = require('webpack'); |
||||
const WebpackDevServer = require('webpack-dev-server'); |
||||
const webpack_config = require('../webpack.config'); |
||||
|
||||
const compiler = Webpack(webpack_config); |
||||
|
||||
const server = new WebpackDevServer(compiler, { |
||||
contentBase: webpack_config.output.path, |
||||
publicPath: webpack_config.output.publicPath, |
||||
disableHostCheck: true, |
||||
stats: { |
||||
colors: true |
||||
}, |
||||
headers: {}, |
||||
hot: true, |
||||
}); |
||||
|
||||
const listen_interface = "0.0.0.0"; |
||||
const listen_port = 2000; |
||||
|
||||
server.listen(listen_port, listen_interface, () => { |
||||
console.log("Starting server on " + listen_interface + ":" + listen_port); |
||||
}); |
||||
@ -1,64 +0,0 @@
|
||||
{ |
||||
"name": "lay", |
||||
"version": "0.0.1", |
||||
"description": "Client for toREST bittorrent server", |
||||
"main": "run.js", |
||||
"scripts": { |
||||
"test": "echo \"Error: no test specified\" && exit 1", |
||||
"webpack": "webpack", |
||||
"pack": "webpack", |
||||
"dev": "node ./bin/server.js" |
||||
}, |
||||
"repository": { |
||||
"type": "git", |
||||
"url": "git+https://github.com/n/A.git" |
||||
}, |
||||
"keywords": [ |
||||
"bittorrent", |
||||
"torrent", |
||||
"rest", |
||||
"react", |
||||
"redux" |
||||
], |
||||
"author": "zalox - Jørgen Lien Sellæg", |
||||
"license": "MIT", |
||||
"dependencies": { |
||||
"react": "^15.5.4", |
||||
"react-dom": "^15.5.4", |
||||
"react-redux": "^5.0.5", |
||||
"redux": "^3.6.0", |
||||
"redux-thunk": "^2.2.0" |
||||
}, |
||||
"devDependencies": { |
||||
"babel-core": "^6.24.1", |
||||
"babel-loader": "^7.0.0", |
||||
"babel-preset-env": "^1.5.1", |
||||
"babel-preset-es2015": "^6.24.1", |
||||
"babel-preset-react": "^6.24.1", |
||||
"babel-preset-stage-0": "^6.24.1", |
||||
"css-loader": "^0.28.2", |
||||
"react-hot-loader": "^3.0.0-beta.7", |
||||
"style-loader": "^0.18.1", |
||||
"webpack": "^2.6.0", |
||||
"webpack-dev-server": "^2.4.5" |
||||
}, |
||||
"babel": { |
||||
"presets": [ |
||||
[ |
||||
"env", |
||||
{ |
||||
"targets": { |
||||
"chrome": 52, |
||||
"firefox": 53 |
||||
}, |
||||
"modules": false |
||||
} |
||||
], |
||||
"stage-0", |
||||
"react" |
||||
], |
||||
"plugins": [ |
||||
"react-hot-loader/babel" |
||||
] |
||||
} |
||||
} |
||||
@ -1,19 +0,0 @@
|
||||
import React from 'react'; |
||||
|
||||
import { component as Ws } from '../WebSocket'; |
||||
|
||||
export class component extends React.Component { |
||||
render(props){ |
||||
return <div> |
||||
<h1> lay - toREST </h1> |
||||
<Ws /> |
||||
</div> |
||||
} |
||||
}; |
||||
|
||||
export const reducer = state => { |
||||
return { |
||||
message: "Hello, World", |
||||
title: "LayToRest" |
||||
}; |
||||
}; |
||||
@ -1,65 +0,0 @@
|
||||
import React from 'react'; |
||||
import { connect } from 'react-redux'; |
||||
|
||||
import style from './style.css'; |
||||
|
||||
let openConnection = () => { |
||||
return dispatch => { |
||||
dispatch(() => connectionOpened(new WebSocket("ws://localhost:3000"))); |
||||
return { |
||||
type: 'WS_OPEN_CONNECTION' |
||||
} |
||||
} |
||||
}; |
||||
|
||||
let connectionOpened = ws => { |
||||
return { |
||||
type: 'WS_CONNECTION_OPENED', |
||||
ws |
||||
} |
||||
}; |
||||
|
||||
|
||||
let closenOpened = () => { |
||||
return { |
||||
type: 'WS_CLOSE_CONNECTION', |
||||
} |
||||
}; |
||||
|
||||
|
||||
class component_ extends React.Component { |
||||
|
||||
componentDidMount(){ |
||||
const { dispatch } = this.props; |
||||
dispatch(openConnection); |
||||
} |
||||
|
||||
componentWillUnmount(){ |
||||
const dispatch = this.props; |
||||
dispatch(closeConnection); |
||||
} |
||||
|
||||
render() { |
||||
const { state, attempts } = this.props; |
||||
const connection_style = (() => { |
||||
switch(state) { |
||||
case "Connecting": |
||||
return style.status + " " + style.pending; |
||||
case "Connected": |
||||
return style.status + " " + style.success; |
||||
case "Disconnected": |
||||
return style.status + " " + style.error; |
||||
default: |
||||
return ""; |
||||
} |
||||
})(); |
||||
return ( |
||||
<div> |
||||
<p>Status: <span className={connection_style} >{ state }</span></p> |
||||
<p>Connection attempts: <span className={style.status} >{ attempts }</span></p> |
||||
</div> |
||||
); |
||||
} |
||||
}; |
||||
|
||||
export const component = connect(state => state.websocket)(component_); |
||||
@ -1,40 +0,0 @@
|
||||
const init = { |
||||
ws: null, |
||||
attempts: 0, |
||||
state: "Disconnected", |
||||
onopen: event => console.log(event), |
||||
onclose: event => console.log(event), |
||||
onmessage: event => console.log(event), |
||||
onerror: event => console.log(event), |
||||
}; |
||||
|
||||
export const reducer = (state = init, action) => { |
||||
switch(action.type) { |
||||
case 'WS_OPEN_CONNECTION': |
||||
action.ws.onmessage = state.onmessage; |
||||
action.ws.close = state.onclose; |
||||
action.ws.onopen = state.onopen; |
||||
action.ws.onerror = state.onerror; |
||||
return { |
||||
state: "Connecting", |
||||
attempts: attempts + 1, |
||||
ws: action.ws, |
||||
...state |
||||
}; |
||||
case 'WS_CONNECTION_OPENED': |
||||
return { |
||||
state: "Connected", |
||||
...state |
||||
} |
||||
case 'WS_CLOSE_CONNECTION': |
||||
return { |
||||
ws: null, |
||||
state: "Disconnected", |
||||
attempts: 0, |
||||
...state |
||||
}; |
||||
default:
|
||||
return state; |
||||
}; |
||||
return state; |
||||
}; |
||||
@ -1,18 +0,0 @@
|
||||
.error { |
||||
color: red; |
||||
} |
||||
|
||||
.success { |
||||
color: green; |
||||
} |
||||
|
||||
.pending { |
||||
color: yellow; |
||||
} |
||||
|
||||
.status { |
||||
font-style: italic; |
||||
} |
||||
|
||||
|
||||
|
||||
@ -1,25 +0,0 @@
|
||||
import React from 'react'; |
||||
import ReactDOM from 'react-dom'; |
||||
import { AppContainer } from 'react-hot-loader'; |
||||
|
||||
import store from './store'; |
||||
import Root from './root'; |
||||
|
||||
const render = Component => { |
||||
ReactDOM.render( |
||||
<AppContainer> |
||||
<Component store={store} /> |
||||
</AppContainer> |
||||
, document.getElementById(document_node) |
||||
); |
||||
} |
||||
|
||||
const document_node = 'lay'; |
||||
|
||||
render(Root); |
||||
|
||||
if(module.hot){ |
||||
module.hot.accept('./root', () => { |
||||
render(Root); |
||||
}); |
||||
} |
||||
@ -1,11 +0,0 @@
|
||||
import { combineReducers } from 'redux'; |
||||
|
||||
import { reducer as app } from './App'; |
||||
import { reducer as websocket } from './WebSocket/reducer'; |
||||
|
||||
const rootReducer = combineReducers({ |
||||
websocket, |
||||
app |
||||
}); |
||||
|
||||
export default rootReducer; |
||||
@ -1,14 +0,0 @@
|
||||
import React, { Component } from 'react'; |
||||
import { Provider } from 'react-redux'; |
||||
import { component as App } from './App'; |
||||
|
||||
export default class Root extends Component { |
||||
render() { |
||||
const { store } = this.props; |
||||
return ( |
||||
<Provider store={store()}> |
||||
<App /> |
||||
</Provider> |
||||
); |
||||
} |
||||
} |
||||
@ -1,24 +0,0 @@
|
||||
import { createStore, applyMiddleware, compose } from 'redux'; |
||||
|
||||
import thunk from 'redux-thunk'; |
||||
|
||||
import rootReducer from './reducer'; |
||||
|
||||
export default initialState => { |
||||
const store = createStore( |
||||
rootReducer, |
||||
initialState, |
||||
// compose(
|
||||
// window.__REDUX_DEVTOOLS_EXTENSION__ && window.__REDUX_DEVTOOLS_EXTENSION__(),
|
||||
applyMiddleware(thunk) |
||||
// )
|
||||
); |
||||
|
||||
if(module.hot){ |
||||
module.hot.accept('./', () => { |
||||
store.replaceReducer(require('./reducer').default) |
||||
}); |
||||
} |
||||
|
||||
return store; |
||||
}; |
||||
@ -1,12 +0,0 @@
|
||||
<!DOCTYPE html> |
||||
<html lang="en"> |
||||
<head> |
||||
<meta charset="utf-8"> |
||||
<meta name="viewport" content="width=device-width, initial-scale=1"> |
||||
<title>layToREST</title> |
||||
</head> |
||||
<body> |
||||
<div id="lay"></div> |
||||
<script src="public/js/index.js"></script> |
||||
</body> |
||||
</html> |
||||
@ -1,34 +0,0 @@
|
||||
const webpack = require('webpack'); |
||||
const path = require('path'); |
||||
|
||||
module.exports = { |
||||
devtool: 'cheap-module-inline-source-map', |
||||
entry: { |
||||
'index': [ |
||||
'react-hot-loader/patch', |
||||
'webpack-dev-server/client?http://10.0.0.117:2000', |
||||
'webpack/hot/only-dev-server', |
||||
'./src', |
||||
] |
||||
}, |
||||
output: { |
||||
path: path.resolve(__dirname,'web'), |
||||
publicPath: '/public/', |
||||
filename: 'js/[name].js' |
||||
}, |
||||
plugins: [ |
||||
new webpack.HotModuleReplacementPlugin(), |
||||
new webpack.NamedModulesPlugin() |
||||
], |
||||
module: { |
||||
rules: [ |
||||
{ test: /\.jsx?$/, use: [ 'babel-loader', ], exclude: /node_modules/ }, |
||||
{ test: /\.css$/, use: [ 'style-loader', 'css-loader?modules', ], }, |
||||
], |
||||
}, |
||||
resolve: { |
||||
extensions: [".js","jsx",".json"], |
||||
mainFiles: ["index"] |
||||
} |
||||
} |
||||
|
||||
Loading…
Reference in new issue