()
23 | .Build();
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/src/Web/Sayranet.WebRTC.WebReact.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | netcoreapp2.0
5 | true
6 | Latest
7 | false
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 | %(DistFiles.Identity)
48 | PreserveNewest
49 |
50 |
51 |
52 |
53 |
54 |
--------------------------------------------------------------------------------
/src/Web/Startup.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Threading.Tasks;
5 | using Microsoft.AspNetCore.Builder;
6 | using Microsoft.AspNetCore.Hosting;
7 | using Microsoft.AspNetCore.SpaServices.Webpack;
8 | using Microsoft.Extensions.Configuration;
9 | using Microsoft.Extensions.DependencyInjection;
10 |
11 | namespace Sayranet.WebRTC.WebReact
12 | {
13 | public class Startup
14 | {
15 | public Startup(IConfiguration configuration)
16 | {
17 | Configuration = configuration;
18 | }
19 |
20 | public IConfiguration Configuration { get; }
21 |
22 | // This method gets called by the runtime. Use this method to add services to the container.
23 | public void ConfigureServices(IServiceCollection services)
24 | {
25 | services.AddMvc();
26 | }
27 |
28 | // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
29 | public void Configure(IApplicationBuilder app, IHostingEnvironment env)
30 | {
31 | if (env.IsDevelopment())
32 | {
33 | app.UseDeveloperExceptionPage();
34 | app.UseWebpackDevMiddleware(new WebpackDevMiddlewareOptions
35 | {
36 | HotModuleReplacement = true,
37 | ReactHotModuleReplacement = true
38 | });
39 | }
40 | else
41 | {
42 | app.UseExceptionHandler("/Home/Error");
43 | }
44 |
45 | app.UseStaticFiles();
46 |
47 | app.UseMvc(routes =>
48 | {
49 | routes.MapRoute(
50 | name: "default",
51 | template: "{controller=Home}/{action=Index}/{id?}");
52 |
53 | routes.MapSpaFallbackRoute(
54 | name: "spa-fallback",
55 | defaults: new { controller = "Home", action = "Index" });
56 | });
57 | }
58 | }
59 | }
60 |
--------------------------------------------------------------------------------
/src/Web/Views/Home/Index.cshtml:
--------------------------------------------------------------------------------
1 | @{
2 | ViewData["Title"] = "Home Page";
3 | }
4 |
5 | Loading...
6 |
7 | @section scripts {
8 |
9 | }
10 |
--------------------------------------------------------------------------------
/src/Web/Views/Shared/Error.cshtml:
--------------------------------------------------------------------------------
1 | @{
2 | ViewData["Title"] = "Error";
3 | }
4 |
5 | Error.
6 | An error occurred while processing your request.
7 |
8 | @if (!string.IsNullOrEmpty((string)ViewData["RequestId"]))
9 | {
10 |
11 | Request ID: @ViewData["RequestId"]
12 |
13 | }
14 |
15 | Development Mode
16 |
17 | Swapping to Development environment will display more detailed information about the error that occurred.
18 |
19 |
20 | Development environment should not be enabled in deployed applications , as it can result in sensitive information from exceptions being displayed to end users. For local debugging, development environment can be enabled by setting the ASPNETCORE_ENVIRONMENT environment variable to Development , and restarting the application.
21 |
22 |
--------------------------------------------------------------------------------
/src/Web/Views/Shared/_Layout.cshtml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | @ViewData["Title"] - Sayranet.WebRTC.WebReact
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 | @RenderBody()
17 |
18 |
19 | @RenderSection("scripts", required: false)
20 |
21 |
22 |
--------------------------------------------------------------------------------
/src/Web/Views/_ViewImports.cshtml:
--------------------------------------------------------------------------------
1 | @using Sayranet.WebRTC.WebReact
2 | @addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers
3 | @addTagHelper *, Microsoft.AspNetCore.SpaServices
4 |
--------------------------------------------------------------------------------
/src/Web/Views/_ViewStart.cshtml:
--------------------------------------------------------------------------------
1 | @{
2 | Layout = "_Layout";
3 | }
4 |
--------------------------------------------------------------------------------
/src/Web/appsettings.Development.json:
--------------------------------------------------------------------------------
1 | {
2 | "Logging": {
3 | "LogLevel": {
4 | "Default": "Debug",
5 | "System": "Information",
6 | "Microsoft": "Information"
7 | }
8 | }
9 | }
10 |
--------------------------------------------------------------------------------
/src/Web/appsettings.json:
--------------------------------------------------------------------------------
1 | {
2 | "Logging": {
3 | "LogLevel": {
4 | "Default": "Warning"
5 | }
6 | }
7 | }
8 |
--------------------------------------------------------------------------------
/src/Web/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "Sayranet.WebRTC.WebReact",
3 | "private": true,
4 | "version": "0.0.0",
5 | "devDependencies": {
6 | "@types/history": "4.6.0",
7 | "@types/react": "^15.0.35",
8 | "@types/react-dom": "15.5.1",
9 | "@types/react-hot-loader": "3.0.3",
10 | "@types/react-router": "4.0.12",
11 | "@types/react-router-dom": "4.0.5",
12 | "@types/webpack-env": "1.13.0",
13 | "aspnet-webpack": "^2.0.1",
14 | "aspnet-webpack-react": "^3.0.0",
15 | "awesome-typescript-loader": "3.2.1",
16 | "bootstrap": "^4.1.1",
17 | "css-loader": "0.28.4",
18 | "event-source-polyfill": "0.0.9",
19 | "extract-text-webpack-plugin": "2.1.2",
20 | "file-loader": "0.11.2",
21 | "isomorphic-fetch": "2.2.1",
22 | "jquery": "^3.2.1",
23 | "json-loader": "0.5.4",
24 | "react": "15.6.1",
25 | "react-dom": "15.6.1",
26 | "react-hot-loader": "3.0.0-beta.7",
27 | "react-router-dom": "4.1.1",
28 | "style-loader": "0.18.2",
29 | "typescript": "2.4.1",
30 | "url-loader": "0.5.9",
31 | "webpack": "2.5.1",
32 | "webpack-hot-middleware": "2.18.2"
33 | },
34 | "peerDependencies": {
35 | "popper.js": "1.14.3"
36 | },
37 | "dependencies": {
38 | "@aspnet/signalr": "^1.0.0-rc1-update1",
39 | "@types/node": "^10.0.8",
40 | "@types/toastr": "^2.1.35",
41 | "@types/uuid": "^3.4.3",
42 | "popper.js": "^1.14.3",
43 | "toastr": "^2.1.4",
44 | "uuid": "^3.2.1",
45 | "webrtc-adapter": "^6.1.5"
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/src/Web/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "baseUrl": ".",
4 | "module": "es2015",
5 | "moduleResolution": "node",
6 | "target": "es5",
7 | "lib": [ "es6", "dom" ],
8 | "jsx": "react",
9 | "sourceMap": true,
10 | "skipDefaultLibCheck": true,
11 | "strict": true,
12 | "strictNullChecks": false,
13 | "types": [ "webpack-env", "node" ]
14 | //"typeRoots": [ "node_modules/@types" ]
15 | },
16 | "exclude": [
17 | "bin",
18 | "node_modules"
19 | ]
20 | }
21 |
--------------------------------------------------------------------------------
/src/Web/web.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/src/Web/webpack.config.js:
--------------------------------------------------------------------------------
1 | const path = require('path');
2 | const webpack = require('webpack');
3 | const ExtractTextPlugin = require('extract-text-webpack-plugin');
4 | const CheckerPlugin = require('awesome-typescript-loader').CheckerPlugin;
5 | const bundleOutputDir = './wwwroot/dist';
6 |
7 | module.exports = (env) => {
8 | const isDevBuild = !(env && env.prod);
9 | return [{
10 | stats: { modules: false },
11 | entry: { 'main': './ClientApp/boot.tsx' },
12 | resolve: { extensions: ['.js', '.jsx', '.ts', '.tsx'] },
13 | output: {
14 | path: path.join(__dirname, bundleOutputDir),
15 | filename: '[name].js',
16 | publicPath: 'dist/'
17 | },
18 | module: {
19 | rules: [
20 | { test: /\.tsx?$/, include: /ClientApp/, use: 'awesome-typescript-loader?silent=true' },
21 | { test: /\.css$/, use: isDevBuild ? ['style-loader', 'css-loader'] : ExtractTextPlugin.extract({ use: 'css-loader?minimize' }) },
22 | { test: /\.(png|jpg|jpeg|gif|svg)$/, use: 'url-loader?limit=25000' }
23 | ]
24 | },
25 | plugins: [
26 | new CheckerPlugin(),
27 | new webpack.DllReferencePlugin({
28 | context: __dirname,
29 | manifest: require('./wwwroot/dist/vendor-manifest.json')
30 | })
31 | ].concat(isDevBuild ? [
32 | // Plugins that apply in development builds only
33 | new webpack.SourceMapDevToolPlugin({
34 | filename: '[file].map', // Remove this line if you prefer inline source maps
35 | moduleFilenameTemplate: path.relative(bundleOutputDir, '[resourcePath]') // Point sourcemap entries to the original file locations on disk
36 | })
37 | ] : [
38 | // Plugins that apply in production builds only
39 | new webpack.optimize.UglifyJsPlugin(),
40 | new ExtractTextPlugin('site.css')
41 | ])
42 | }];
43 | };
--------------------------------------------------------------------------------
/src/Web/webpack.config.vendor.js:
--------------------------------------------------------------------------------
1 | const path = require('path');
2 | const webpack = require('webpack');
3 | const ExtractTextPlugin = require('extract-text-webpack-plugin');
4 |
5 | module.exports = (env) => {
6 | const extractCSS = new ExtractTextPlugin('vendor.css');
7 | const isDevBuild = !(env && env.prod);
8 | return [{
9 | stats: { modules: false },
10 | resolve: {
11 | extensions: [ '.js' ]
12 | },
13 | module: {
14 | rules: [
15 | { test: /\.(png|woff|woff2|eot|ttf|svg)(\?|$)/, use: 'url-loader?limit=100000' },
16 | { test: /\.css(\?|$)/, use: extractCSS.extract([ isDevBuild ? 'css-loader' : 'css-loader?minimize' ]) }
17 | ]
18 | },
19 | entry: {
20 | vendor: ['bootstrap', 'bootstrap/dist/css/bootstrap.css', 'event-source-polyfill', 'isomorphic-fetch', 'react', 'react-dom', 'react-router-dom', 'jquery'],
21 | },
22 | output: {
23 | path: path.join(__dirname, 'wwwroot', 'dist'),
24 | publicPath: 'dist/',
25 | filename: '[name].js',
26 | library: '[name]_[hash]',
27 | },
28 | plugins: [
29 | extractCSS,
30 | new webpack.ProvidePlugin({ $: 'jquery', jQuery: 'jquery' }), // Maps these identifiers to the jQuery package (because Bootstrap expects it to be a global variable)
31 | new webpack.DllPlugin({
32 | path: path.join(__dirname, 'wwwroot', 'dist', '[name]-manifest.json'),
33 | name: '[name]_[hash]'
34 | }),
35 | new webpack.DefinePlugin({
36 | 'process.env.NODE_ENV': isDevBuild ? '"development"' : '"production"'
37 | })
38 | ].concat(isDevBuild ? [] : [
39 | new webpack.optimize.UglifyJsPlugin()
40 | ])
41 | }];
42 | };
43 |
--------------------------------------------------------------------------------
/src/Web/wwwroot/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mstachyra/WebRtc/331087d1bca94d9e3e3d31392815a05af876fadd/src/Web/wwwroot/favicon.ico
--------------------------------------------------------------------------------