Skip to content

Commit

Permalink
Merge branch 'master' into dependabot/npm_and_yarn/it-pipe-2.0.4
Browse files Browse the repository at this point in the history
  • Loading branch information
kodiakhq[bot] authored Aug 30, 2022
2 parents 17b3225 + 9e1b982 commit 41f3bf4
Show file tree
Hide file tree
Showing 4 changed files with 54 additions and 48 deletions.
1 change: 0 additions & 1 deletion .prettierignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
# package.json is formatted by package managers, so we ignore it here
package.json
build
10 changes: 8 additions & 2 deletions packages/daemon/src/server/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,8 @@ function registerWebsocketEndpoints(
).reduce((acc, [path, factory]) => ({ ...acc, [path]: factory(controlAuthToken) }), {});

server.server.on('upgrade', (request, socket, headers) => {
const url = new URL(request.url!, 'https://127.0.0.0.1');
const wsServer: WSServer | undefined = serversByPath[url.pathname];
const path = cleanPath(request.url!);
const wsServer: WSServer | undefined = serversByPath[path];
if (wsServer) {
wsServer.handleUpgrade(request, socket, headers, (websocket) => {
wsServer.emit('connection', websocket, request);
Expand All @@ -78,3 +78,9 @@ function registerWebsocketEndpoints(
}
});
}

function cleanPath(path: string): string {
// Suddenly `new URL(path, base).pathname` no longer works on macOS, so we have to manually
// remove the query string and fragment.
return path.split('?')[0].split('#')[0];
}
4 changes: 2 additions & 2 deletions packages/ui/electron-builder.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ appId: tech.relaycorp.gateway
directories:
buildResources: "./buildResources"
extraResources:
- from: app/daemon/node_modules
to: app/daemon/node_modules/
- from: app/node_modules/daemon
to: app/node_modules/daemon/
filter:
- "**/*"
linux:
Expand Down
87 changes: 44 additions & 43 deletions packages/ui/webpack.config.js
Original file line number Diff line number Diff line change
@@ -1,44 +1,46 @@
const HtmlWebpackPlugin = require('html-webpack-plugin');
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
const CopyPlugin = require("copy-webpack-plugin");
const CopyPlugin = require('copy-webpack-plugin');

const rendererBaseConfig = {
mode: 'development',
target: 'electron-renderer',
devtool: 'source-map',
module: { rules: [
{
test: /\.ts(x?)$/,
include: /src/,
use: [{ loader: 'ts-loader' }]
},
{
test: /\.css$/i,
use: [ MiniCssExtractPlugin.loader, 'css-loader' ],
},
{
test: /\.(svg|png)$/i,
type: 'asset/resource'
},
{
test: /\.(woff|woff2|eot|ttf|otf)$/i,
type: 'asset/resource',
},
] },
module: {
rules: [
{
test: /\.ts(x?)$/,
include: /src/,
use: [{ loader: 'ts-loader' }],
},
{
test: /\.css$/i,
use: [MiniCssExtractPlugin.loader, 'css-loader'],
},
{
test: /\.(svg|png)$/i,
type: 'asset/resource',
},
{
test: /\.(woff|woff2|eot|ttf|otf)$/i,
type: 'asset/resource',
},
],
},
resolve: {
extensions: ['.js', '.jsx', '.ts', '.tsx']
extensions: ['.js', '.jsx', '.ts', '.tsx'],
},
output: {
path: __dirname + '/app',
filename: '[name].js'
filename: '[name].js',
},
plugins: [
new HtmlWebpackPlugin({
template: './src/electron/index.html',
filename: '[name].html'
filename: '[name].html',
}),
new MiniCssExtractPlugin({filename: "styles.[hash].css"})
]
new MiniCssExtractPlugin({ filename: 'styles.[hash].css' }),
],
};

module.exports = [
Expand All @@ -51,16 +53,16 @@ module.exports = [
{
test: /\.ts$/,
include: /src/,
use: [{ loader: 'ts-loader' }]
use: [{ loader: 'ts-loader' }],
},
{
test: /\.(png)$/i,
type: 'asset/resource'
type: 'asset/resource',
},
]
],
},
resolve: {
extensions: ['.js', '.ts']
extensions: ['.js', '.ts'],
},
output: {
path: __dirname + '/app',
Expand All @@ -74,34 +76,33 @@ module.exports = [
from: './node_modules/daemon/**/*',
to: '.',
globOptions: {
gitignore: true,
ignore: [
'**/coverage/**',
'**/src/**',
'**/README.md',
'**/jest.*.js',
'**/tsconfig.json',
'coverage/**',
'src/**',
'README.md',
'jest.*.js',
'tsconfig.json',
'build/**/*.spec.js',
'**/*.d.ts',
'**/*.map.js',
],
].map(path => `**/daemon/${path}`),
},
},
{ from: './node_modules/daemon/ormconfig.json', to: '.' }
{ from: './node_modules/daemon/ormconfig.json', to: '.' },
],
}),
]
],
},
{
...rendererBaseConfig,
entry: { app: './src/electron/app.tsx', },
entry: { app: './src/electron/app.tsx' },
},
{
...rendererBaseConfig,
entry: { about: './src/electron/about.tsx', },
entry: { about: './src/electron/about.tsx' },
},
{
...rendererBaseConfig,
entry: { libraries: './src/electron/libraries.tsx', },
}
entry: { libraries: './src/electron/libraries.tsx' },
},
];

0 comments on commit 41f3bf4

Please sign in to comment.