diff --git a/.eslintrc.json b/.eslintrc.json index cf573c4859..bdb0a2eef1 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -25,37 +25,37 @@ "from": ".", "except": ["./src/infrastructure", "./node_modules"] }, - // Similar to above but for src/www/model, but you can use files from both the - // src/www/model and src/www/infrastructure paths. + // Similar to above but for web/model, but you can use files from both the + // web/model and web/infrastructure paths. { - "target": "./src/www/model", + "target": "./web/model", "from": ".", - "except": ["./src/www/model", "./src/infrastructure", "./node_modules"] + "except": ["./web/model", "./src/infrastructure", "./node_modules"] }, // Prevents the internals of the outline_server_repository from being used publicly in the app. { - "target": "./src/www/app/*.ts", - "from": "./src/www/app/outline_server_repository/server.ts" + "target": "./web/app/*.ts", + "from": "./web/app/outline_server_repository/server.ts" }, { - "target": "./src/www/app/*.ts", - "from": "./src/www/app/outline_server_repository/access_key_serialization.ts" + "target": "./web/app/*.ts", + "from": "./web/app/outline_server_repository/access_key_serialization.ts" }, { - "target": "./src/www/views", - "from": "./src/www/model" + "target": "./web/views", + "from": "./web/model" }, { - "target": "./src/www/ui_components", - "from": "./src/www/model" + "target": "./web/ui_components", + "from": "./web/model" }, { - "target": "./src/www/views", - "from": "./src/www/app" + "target": "./web/views", + "from": "./web/app" }, { - "target": "./src/www/ui_components", - "from": "./src/www/app" + "target": "./web/ui_components", + "from": "./web/app" } ] } @@ -94,7 +94,7 @@ }, // No need to check browser compatibility for electron files { - "files": ["./src/www/app/electron_main.ts"], + "files": ["./web/app/electron_main.ts"], "rules": { "compat/compat": "off" } diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 917fc8e934..e5042b4677 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -5,4 +5,4 @@ /third_party/ @Jigsaw-Code/outline-networking-owners /tools/ @Jigsaw-Code/outline-networking-owners -/src/www/model/ @fortuna +/web/model/ @fortuna diff --git a/.github/workflows/build_and_test_debug_client.yml b/.github/workflows/build_and_test_debug_client.yml index 0b0f6a1b1d..b1b8a993e8 100644 --- a/.github/workflows/build_and_test_debug_client.yml +++ b/.github/workflows/build_and_test_debug_client.yml @@ -37,14 +37,14 @@ jobs: run: npm run action lint - name: Build Web App - run: npm run action client/www/build + run: npm run action client/web/build - name: Test Web App - run: npm run action client/www/test + run: npm run action client/web/test - uses: codecov/codecov-action@v3 with: - files: ./client/output/coverage/www/coverage-final.json + files: ./client/output/coverage/web/coverage-final.json flags: unittests, www linux_debug_build: diff --git a/.github/workflows/pull_request_checks.yml b/.github/workflows/pull_request_checks.yml index aeb4753c2c..ae60682f77 100644 --- a/.github/workflows/pull_request_checks.yml +++ b/.github/workflows/pull_request_checks.yml @@ -56,8 +56,8 @@ jobs: LICENSE package-lock.json resources - src/www/assets/** - src/www/messages/** + web/assets/** + web/messages/** third_party/** with: sizes: > diff --git a/client/.gitignore b/client/.gitignore index 061ad13c3c..f6718b983a 100644 --- a/client/.gitignore +++ b/client/.gitignore @@ -1,5 +1,4 @@ /node_modules -/build /output /platforms /plugins diff --git a/client/README.md b/client/README.md index a7659ac6c4..1c00f3e9ab 100644 --- a/client/README.md +++ b/client/README.md @@ -24,18 +24,18 @@ npm install ## Building the shared web app -Outline clients share the same web app across all platforms. This code is located in the src/www directory. If you are making changes to the shared web app and do not need to test platform-specific functionality, you can test in a desktop browser by running: +Outline clients share the same web app across all platforms. This code is located in the web directory. If you are making changes to the shared web app and do not need to test platform-specific functionality, you can test in a desktop browser by running: ```sh -npm run action client/www/start +npm run action client/web/start ``` The latter command will open a browser instance running the app. Browser platform development will use fake servers to test successful and unsuccessful connections. -The app logic is located in [src/www/app](src/www/app). UI components are located in [src/www/ui_components](src/www/ui_components). If you want to work specifically on an individual UI element, try the storybook!: +The app logic is located in [web/app](web/app). UI components are located in [web/ui_components](web/ui_components). If you want to work specifically on an individual UI element, try the storybook!: ```sh -npm run action client/www/storybook +npm run action client/web/storybook ``` > [!NOTE] diff --git a/client/cordova/apple/xcode/macos/osx.json b/client/cordova/apple/xcode/macos/osx.json index e80c4faf33..5142f267db 100644 --- a/client/cordova/apple/xcode/macos/osx.json +++ b/client/cordova/apple/xcode/macos/osx.json @@ -34,7 +34,7 @@ "modules": [ { "id": "cordova-plugin-clipboard.Clipboard", - "file": "plugins/cordova-plugin-clipboard/www/clipboard.js", + "file": "plugins/cordova-plugin-clipboard/web/clipboard.js", "pluginId": "cordova-plugin-clipboard", "clobbers": [ "cordova.plugins.clipboard" @@ -42,7 +42,7 @@ }, { "id": "cordova-webintent.WebIntent", - "file": "plugins/cordova-webintent/www/webintent.js", + "file": "plugins/cordova-webintent/web/webintent.js", "pluginId": "cordova-webintent", "clobbers": [ "WebIntent" diff --git a/client/cordova/apple/xcode/macos/www/cordova_plugins.js b/client/cordova/apple/xcode/macos/www/cordova_plugins.js index 471088fcd3..33938c8e53 100644 --- a/client/cordova/apple/xcode/macos/www/cordova_plugins.js +++ b/client/cordova/apple/xcode/macos/www/cordova_plugins.js @@ -2,7 +2,7 @@ cordova.define('cordova/plugin_list', function(require, exports, module) { module.exports = [ { "id": "cordova-plugin-clipboard.Clipboard", - "file": "plugins/cordova-plugin-clipboard/www/clipboard.js", + "file": "plugins/cordova-plugin-clipboard/web/clipboard.js", "pluginId": "cordova-plugin-clipboard", "clobbers": [ "cordova.plugins.clipboard" @@ -10,7 +10,7 @@ cordova.define('cordova/plugin_list', function(require, exports, module) { }, { "id": "cordova-webintent.WebIntent", - "file": "plugins/cordova-webintent/www/webintent.js", + "file": "plugins/cordova-webintent/web/webintent.js", "pluginId": "cordova-webintent", "clobbers": [ "WebIntent" diff --git a/client/cordova/build.action.mjs b/client/cordova/build.action.mjs index 72b9d6bc56..32354698d7 100644 --- a/client/cordova/build.action.mjs +++ b/client/cordova/build.action.mjs @@ -34,7 +34,7 @@ import {getBuildParameters} from '../build/get_build_parameters.mjs'; export async function main(...parameters) { const {platform, buildMode, verbose} = getBuildParameters(parameters); - await runAction('client/www/build', ...parameters); + await runAction('client/web/build', ...parameters); await runAction('client/tun2socks/build', ...parameters); await runAction('client/cordova/setup', ...parameters); @@ -95,7 +95,7 @@ function getXcodeBuildArgs(platform) { } return [ '-workspace', - path.join(getRootDir(), 'client', 'src', 'cordova', 'apple', workspaceFilename), + path.join(getRootDir(), 'client', 'cordova', 'apple', workspaceFilename), '-scheme', 'Outline', '-destination', diff --git a/client/cordova/setup.action.mjs b/client/cordova/setup.action.mjs index 889959a358..ad797aa7ee 100644 --- a/client/cordova/setup.action.mjs +++ b/client/cordova/setup.action.mjs @@ -39,7 +39,7 @@ const WORKING_CORDOVA_OSX_COMMIT = '07e62a53aa6a8a828fd988bc9e884c38c3495a67'; export async function main(...parameters) { const {platform, buildMode, verbose, buildNumber, versionName} = getBuildParameters(parameters); - await runAction('client/www/build', ...parameters); + await runAction('client/web/build', ...parameters); await runAction('client/tun2socks/build', ...parameters); await rmfr(path.resolve(getRootDir(), 'platforms')); diff --git a/client/cordova/test.action.mjs b/client/cordova/test.action.mjs index c0acf56d90..bf8e99bbf5 100644 --- a/client/cordova/test.action.mjs +++ b/client/cordova/test.action.mjs @@ -22,7 +22,7 @@ import rmfr from 'rmfr'; import {getRootDir} from '../..//src/build/get_root_dir.mjs'; import {spawnStream} from '../..//src/build/spawn_stream.mjs'; -const APPLE_ROOT = path.join(getRootDir(), 'client', 'src', 'cordova', 'apple'); +const APPLE_ROOT = path.join(getRootDir(), 'client', 'cordova', 'apple'); const APPLE_LIBRARY_NAME = 'OutlineAppleLib'; const SUPPORTED_PLATFORMS = new Set(['ios', 'macos', 'maccatalyst']); diff --git a/client/electron/build.action.mjs b/client/electron/build.action.mjs index 0ed0d1ad37..0178e0fff1 100644 --- a/client/electron/build.action.mjs +++ b/client/electron/build.action.mjs @@ -48,7 +48,7 @@ export async function main(...parameters) { ); } - await runAction('client/www/build', ...parameters); + await runAction('client/web/build', ...parameters); await runAction('client/tun2socks/build', ...parameters); await runAction('src/electron/build_main', ...parameters); diff --git a/client/electron/build_main.action.mjs b/client/electron/build_main.action.mjs index d5f616880c..76190cfa20 100644 --- a/client/electron/build_main.action.mjs +++ b/client/electron/build_main.action.mjs @@ -36,7 +36,7 @@ export async function main(...parameters) { ); } - await runAction('client/www/build', ...parameters); + await runAction('client/web/build', ...parameters); // TODO(daniellacosse): separate building the preload script out into its own separate step await runWebpack( diff --git a/client/electron/connectivity.ts b/client/electron/connectivity.ts index 283a56b99d..62b8fe4bc2 100644 --- a/client/electron/connectivity.ts +++ b/client/electron/connectivity.ts @@ -15,7 +15,7 @@ import * as dns from 'dns'; import {timeoutPromise} from '../../client/infrastructure/timeout_promise'; -import * as errors from '../../client/www/model/errors'; +import * as errors from '../../client/web/model/errors'; const DNS_LOOKUP_TIMEOUT_MS = 10000; diff --git a/client/electron/go_vpn_tunnel.ts b/client/electron/go_vpn_tunnel.ts index eec101d08f..d32a91f5bf 100755 --- a/client/electron/go_vpn_tunnel.ts +++ b/client/electron/go_vpn_tunnel.ts @@ -16,9 +16,9 @@ import {powerMonitor} from 'electron'; import {platform} from 'os'; import {pathToEmbeddedBinary} from '../../client/infrastructure/electron/app_paths'; -import {ShadowsocksSessionConfig} from '../../client/www/app/tunnel'; -import {TunnelStatus} from '../../client/www/app/tunnel'; -import {ErrorCode, fromErrorCode, UnexpectedPluginError} from '../../client/www/model/errors'; +import {ShadowsocksSessionConfig} from '../../client/web/app/tunnel'; +import {TunnelStatus} from '../../client/web/app/tunnel'; +import {ErrorCode, fromErrorCode, UnexpectedPluginError} from '../../client/web/model/errors'; import {ChildProcessHelper, ProcessTerminatedExitCodeError, ProcessTerminatedSignalError} from './process'; import {RoutingDaemon} from './routing_service'; diff --git a/client/electron/index.ts b/client/electron/index.ts index dab99993af..3dedfcf463 100644 --- a/client/electron/index.ts +++ b/client/electron/index.ts @@ -23,10 +23,10 @@ import * as process from 'process'; import * as url from 'url'; import autoLaunch = require('auto-launch'); // tslint:disable-line -import * as errors from '../../client/www/model/errors'; +import * as errors from '../../client/web/model/errors'; -import {ShadowsocksSessionConfig} from '../../client/www/app/tunnel'; -import {TunnelStatus} from '../../client/www/app/tunnel'; +import {ShadowsocksSessionConfig} from '../../client/web/app/tunnel'; +import {TunnelStatus} from '../../client/web/app/tunnel'; import {GoVpnTunnel} from './go_vpn_tunnel'; import {installRoutingServices, RoutingDaemon} from './routing_service'; import {TunnelStore, SerializableTunnel} from './tunnel_store'; @@ -145,7 +145,7 @@ function setupWindow(): void { mainWindow.setIcon(path.join(app.getAppPath(), 'build', 'icons', 'png', '64x64.png')); } - const pathToIndexHtml = path.join(app.getAppPath(), 'client', 'www', 'index_electron.html'); + const pathToIndexHtml = path.join(app.getAppPath(), 'client', 'web', 'index_electron.html'); const webAppUrl = new url.URL(`file://${pathToIndexHtml}`); // Debug mode, etc. diff --git a/client/electron/routing_service.ts b/client/electron/routing_service.ts index ead1b74234..c672eaa040 100755 --- a/client/electron/routing_service.ts +++ b/client/electron/routing_service.ts @@ -20,8 +20,8 @@ import * as path from 'path'; import * as sudo from 'sudo-prompt'; import {getAppPath} from '../../client/infrastructure/electron/app_paths'; -import {TunnelStatus} from '../../client/www/app/tunnel'; -import {ErrorCode, SystemConfigurationException} from '../../client/www/model/errors'; +import {TunnelStatus} from '../../client/web/app/tunnel'; +import {ErrorCode, SystemConfigurationException} from '../../client/web/model/errors'; const isLinux = platform() === 'linux'; const isWindows = platform() === 'win32'; diff --git a/client/electron/tsconfig.json b/client/electron/tsconfig.json index 250734fd0d..50838aba08 100644 --- a/client/electron/tsconfig.json +++ b/client/electron/tsconfig.json @@ -1,6 +1,6 @@ { - "extends": "../../client/www/tsconfig.json", + "extends": "../web/tsconfig.json", "compilerOptions": { - "outDir": "../../build/electron" + "outDir": "../output/electron" } } diff --git a/client/electron/tunnel_store.ts b/client/electron/tunnel_store.ts index 7c0b3b9f86..4bdb4cc043 100755 --- a/client/electron/tunnel_store.ts +++ b/client/electron/tunnel_store.ts @@ -15,7 +15,7 @@ import * as fs from 'fs'; import * as path from 'path'; -import {ShadowsocksSessionConfig} from '../../client/www/app/tunnel'; +import {ShadowsocksSessionConfig} from '../../client/web/app/tunnel'; // Format to store a tunnel configuration. export interface SerializableTunnel { diff --git a/client/electron/vpn_tunnel.ts b/client/electron/vpn_tunnel.ts index fe096687b0..3a3fa57ba0 100755 --- a/client/electron/vpn_tunnel.ts +++ b/client/electron/vpn_tunnel.ts @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -import {TunnelStatus} from '../../client/www/app/tunnel'; +import {TunnelStatus} from '../../client/web/app/tunnel'; // Represents a VPN tunnel to a proxy server. export interface VpnTunnel { diff --git a/client/package.json b/client/package.json index 557e46cdc0..83cce5c4d5 100644 --- a/client/package.json +++ b/client/package.json @@ -3,7 +3,7 @@ "version": "0.0.0", "comments": { "version": "The 'version' in this file is just a placeholder for 'npx generate-license-file', please do not change it.", - "codrova-osx": "Version-controlled platform config files at src/cordova/apple/xcode/osx/Outline/config.xml, src/cordova/apple/xcode/osx/osx.json, and src/cordova/apple/xcode/osx/www/cordova_plugins.js as a workaround for https://github.com/apache/cordova-osx/issues/106. Delete these files when the issue is fixed." + "codrova-osx": "Version-controlled platform config files at src/cordova/apple/xcode/osx/Outline/config.xml, src/cordova/apple/xcode/osx/osx.json, and src/cordova/apple/xcode/osx/web/cordova_plugins.js as a workaround for https://github.com/apache/cordova-osx/issues/106. Delete these files when the issue is fixed." }, "dependencies": { "@material/mwc-button": "^0.25.3", diff --git a/client/tools/outline_proxy_controller/outline_controller_server.h b/client/tools/outline_proxy_controller/outline_controller_server.h index 55517999db..ba0ff2a06b 100644 --- a/client/tools/outline_proxy_controller/outline_controller_server.h +++ b/client/tools/outline_proxy_controller/outline_controller_server.h @@ -69,7 +69,7 @@ class OutlineClientSession : public std::enable_shared_from_this MonitorNetworkChanges(); private: - /** @brief `TunnelStatus` in "src/www/app/tunnel.ts" */ + /** @brief `TunnelStatus` in "web/app/tunnel.ts" */ enum class ConnectionState : int { kConnected = 0, kDisconnected = 1, diff --git a/client/tools/outline_proxy_controller/outline_error.h b/client/tools/outline_proxy_controller/outline_error.h index fa648e099b..c5949058e7 100644 --- a/client/tools/outline_proxy_controller/outline_error.h +++ b/client/tools/outline_proxy_controller/outline_error.h @@ -23,7 +23,7 @@ namespace outline { /** * @brief The standard error code constants used by outline. - * @remarks The codes are copied from "/src/www/model/errors.ts". + * @remarks The codes are copied from "/web/model/errors.ts". */ enum class ErrorCode { kOk = 0, diff --git a/client/tun2socks/outline/neterrors/neterrors.go b/client/tun2socks/outline/neterrors/neterrors.go index 3ebebbc248..6ec175ba1d 100644 --- a/client/tun2socks/outline/neterrors/neterrors.go +++ b/client/tun2socks/outline/neterrors/neterrors.go @@ -24,7 +24,7 @@ func (e Error) Number() int { return int(e) } -// Outline error codes. Must be kept in sync with definitions in https://github.com/Jigsaw-Code/outline-apps/blob/master/src/www/model/errors.ts +// Outline error codes. Must be kept in sync with definitions in https://github.com/Jigsaw-Code/outline-apps/blob/master/web/model/errors.ts const ( NoError Error = 0 Unexpected Error = 1 diff --git a/client/web/build.action.mjs b/client/web/build.action.mjs index 355f2c42ee..006c3d0d11 100644 --- a/client/web/build.action.mjs +++ b/client/web/build.action.mjs @@ -56,10 +56,10 @@ export async function main(...parameters) { } } - await fs.mkdir(path.resolve(getRootDir(), 'client', 'www'), {recursive: true}); + await fs.mkdir(path.resolve(getRootDir(), 'client', 'web'), {recursive: true}); await fs.writeFile( - path.resolve(getRootDir(), 'client', 'www', 'environment.json'), + path.resolve(getRootDir(), 'client', 'web', 'environment.json'), JSON.stringify({ SENTRY_DSN: sentryDsn, APP_VERSION: versionName, diff --git a/client/web/environment.json b/client/web/environment.json new file mode 100644 index 0000000000..fc6ea72ff2 --- /dev/null +++ b/client/web/environment.json @@ -0,0 +1 @@ +{"APP_VERSION":"0.0.0-debug","APP_BUILD_NUMBER":475939} \ No newline at end of file diff --git a/client/web/start.action.mjs b/client/web/start.action.mjs index e7d5dc3165..7e1588d284 100644 --- a/client/web/start.action.mjs +++ b/client/web/start.action.mjs @@ -23,7 +23,7 @@ import {getBrowserWebpackConfig} from './get_browser_webpack_config.mjs'; * @description Starts the web app for development. */ export async function main() { - await runAction('client/www/build', 'browser'); + await runAction('client/web/build', 'browser'); // TODO(daniellacosse): Browser-only webpack setup that's extended both by electron and cordova. // Currently, only the cordova web build works in standalone mode. diff --git a/client/web/test.action.mjs b/client/web/test.action.mjs index 10279e334c..786db83cc2 100644 --- a/client/web/test.action.mjs +++ b/client/web/test.action.mjs @@ -19,7 +19,7 @@ import puppeteer from 'puppeteer'; import path from 'path'; import {getRootDir} from '../..//src/build/get_root_dir.mjs'; -const KARMA_CONFIG_PATH = ['client', 'src', 'www', 'karma.conf.js']; +const KARMA_CONFIG_PATH = ['client', 'web', 'karma.conf.js']; /** * @description Runs the Karma tests against the web UI. diff --git a/client/web/tsconfig.json b/client/web/tsconfig.json index 93c6c6f982..6408374c98 100644 --- a/client/web/tsconfig.json +++ b/client/web/tsconfig.json @@ -1,7 +1,7 @@ { - "extends": "../../tsconfig.json", + "extends": "../tsconfig.json", "compilerOptions": { - "outDir": "../../www", + "outDir": "../www", "lib": ["es2022", "dom", "dom.iterable"] } } diff --git a/client/web/ui_components/licenses/README.md b/client/web/ui_components/licenses/README.md index dc3d92fa3e..5d7bfaa45d 100644 --- a/client/web/ui_components/licenses/README.md +++ b/client/web/ui_components/licenses/README.md @@ -4,7 +4,7 @@ - `cd` to the root of your clone of this repo. - Ensure `node_modules` is up to date by running `npm ci`. -- `npx generate-license-file --input package.json --output src/www/ui_components/licenses/licenses.txt` -- `./src/www/ui_components/licenses/third_party.sh >> ./src/www/ui_components/licenses/licenses.txt` +- `npx generate-license-file --input package.json --output web/ui_components/licenses/licenses.txt` +- `./web/ui_components/licenses/third_party.sh >> ./web/ui_components/licenses/licenses.txt` Done! diff --git a/client/web/webpack_base.mjs b/client/web/webpack_base.mjs index ef7cec8cf5..139a3b4905 100644 --- a/client/web/webpack_base.mjs +++ b/client/web/webpack_base.mjs @@ -55,7 +55,7 @@ export const baseConfig = { export const browserConfig = { entry: [path.resolve(__dirname, 'style.css')], output: { - path: path.resolve(__dirname, '..', '..', 'www'), + path: path.resolve(__dirname, '..', 'www'), filename: 'main.js', }, module: { diff --git a/package-lock.json b/package-lock.json index a5a2d9ae48..c0a44758e6 100644 --- a/package-lock.json +++ b/package-lock.json @@ -148,7 +148,7 @@ "client/cordova/plugin": { "name": "cordova-plugin-outline", "version": "0.0.0", - "extraneous": true + "dev": true }, "client/node_modules/@electron/universal": { "version": "1.2.1", @@ -443,8 +443,8 @@ "node": ">=10" } }, - "client/cordova/plugin": { - "dev": true + "client/src/cordova/plugin": { + "extraneous": true }, "node_modules/@ampproject/remapping": { "version": "2.2.0",