Skip to content

Commit

Permalink
Merge branch 'master' into WIP-2276-releases
Browse files Browse the repository at this point in the history
  • Loading branch information
ainar-g committed Dec 30, 2020
2 parents 2292b67 + 5e20ac7 commit 99bb2f2
Show file tree
Hide file tree
Showing 200 changed files with 20,850 additions and 61 deletions.
2 changes: 0 additions & 2 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,2 @@
# Ignore everything except for explicitly allowed stuff.
*

!dist/docker/
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

'env':
'GO_VERSION': '1.14'
'NODE_VERSION': '13'
'NODE_VERSION': '14'

'on':
'push':
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,11 @@
# Only build, run, and test outputs here. Sorted.
*-packr.go
*.db
*.log
*.snap
/bin/
/build/
/build2/
/data/
/dist/
/dnsfilter/tests/dnsfilter.TestLotsOfRules*.pprof
Expand All @@ -19,4 +21,5 @@
/snapcraft_login
AdGuardHome*
coverage.txt
leases.db
node_modules/
2 changes: 2 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ RUN apk --update --no-cache add \
gcc \
git \
npm \
yarn \
&& rm -rf /tmp/* /var/cache/apk/*

WORKDIR /app
Expand All @@ -30,6 +31,7 @@ COPY . ./

# Prepare the client code
RUN npm --prefix client ci && npm --prefix client run build-prod
RUN yarn --cwd client2 build

# Download go dependencies
RUN go mod download
Expand Down
18 changes: 14 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
.POSIX:

CHANNEL = development
CLIENT_BETA_DIR = client2
CLIENT_DIR = client
COMMIT = $$(git rev-parse --short HEAD)
DIST_DIR = dist
Expand All @@ -20,6 +21,8 @@ NPM_FLAGS = --prefix $(CLIENT_DIR)
SIGN = 1
VERBOSE = 0
VERSION = v0.0.0
YARN = yarn
YARN_FLAGS = --cwd $(CLIENT_BETA_DIR)

ENV = env\
COMMIT='$(COMMIT)'\
Expand Down Expand Up @@ -57,10 +60,17 @@ build-release: deps js-build
clean: ; $(ENV) "$(SHELL)" ./scripts/make/clean.sh
init: ; git config core.hooksPath ./scripts/hooks

js-build: ; $(NPM) $(NPM_FLAGS) run build-prod
js-deps: ; $(NPM) $(NPM_FLAGS) ci
js-lint: ; $(NPM) $(NPM_FLAGS) run lint
js-test: ; $(NPM) $(NPM_FLAGS) run test
js-build:
$(NPM) $(NPM_FLAGS) run build-prod
$(YARN) $(YARN_FLAGS) build
js-deps:
$(NPM) $(NPM_FLAGS) ci
$(YARN) $(YARN_FLAGS) install
js-lint:
$(NPM) $(NPM_FLAGS) run lint
$(YARN) $(YARN_FLAGS) lint
js-test:
$(NPM) $(NPM_FLAGS) run test

go-build: ; $(ENV) "$(SHELL)" ./scripts/make/go-build.sh
go-deps: ; $(ENV) "$(SHELL)" ./scripts/make/go-deps.sh
Expand Down
6 changes: 6 additions & 0 deletions client2/.eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
scripts
node_modules
postcss.config.js
src/lib/entities
src/lib/apis
openApi
5 changes: 5 additions & 0 deletions client2/.eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"extends": [
"./scripts/lint/dev.js"
]
}
18 changes: 18 additions & 0 deletions client2/declaration.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
declare module '*.pcss' {
const content: {[className: string]: string};
export default content;
}
declare module '*.css' {
const content: {[className: string]: string};
export default content;
}
declare module '*.png'
declare module '*.jpg'
declare let AUTH_TOKEN: string;
declare let MAIN_TOKEN: string | undefined;
declare let NO_CAPTCHA: boolean | undefined;
declare module 'dygraphs';
declare module '@novnc/novnc/core/rfb';
// cp - CloudPayments script
declare let cp: any;
declare const DEV: any;
92 changes: 92 additions & 0 deletions client2/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
{
"author": "Performix",
"private": true,
"name": "adguard-home",
"version": "0.1.0",
"scripts": {
"build": "rm -rf ../build2 && yarn install && webpack --config ./scripts/webpack/webpack.config.prod.js",
"start": "webpack serve --config ./scripts/webpack/webpack.config.dev.js",
"generate": "rm -rf ./src/lib/entities ./src/lib/apis && ts-node --compiler-options '{ \"module\": \"CommonJS\" }' ./scripts/generator/index.ts",
"translations:check": "ts-node --compiler-options '{ \"module\": \"CommonJS\" }' ./scripts/plugins/checkTranslations.ts",
"lint": "eslint -c ./scripts/lint/prod.js --ext .tsx --ext .ts ./",
"go:build": "cd .. && make REBUILD_CLIENT=0 build",
"go:run": "sudo ../AdguardHome"
},
"husky": {
"hooks": {
"pre-commit": "yarn lint"
}
},
"license": "ISC",
"dependencies": {
"@sentry/react": "^5.27.0",
"antd": "^4.7.2",
"classnames": "^2.2.6",
"dayjs": "^1.9.3",
"formik": "^2.2.0",
"mobx": "^6.0.1",
"mobx-react-lite": "^3.0.1",
"qs": "^6.9.4",
"react": "^17.0.0",
"react-dom": "^17.0.0",
"react-router-dom": "^5.2.0"
},
"devDependencies": {
"@types/classnames": "^2.2.10",
"@types/qs": "^6.9.5",
"@types/react": "^16.9.53",
"@types/react-dom": "^16.9.8",
"@types/react-redux": "^7.1.9",
"@types/react-router-dom": "^5.1.6",
"@typescript-eslint/eslint-plugin": "^4.5.0",
"@typescript-eslint/parser": "^4.5.0",
"antd-dayjs-webpack-plugin": "^1.0.1",
"autoprefixer": "^10.0.1",
"connect-history-api-fallback": "^1.6.0",
"copy-webpack-plugin": "^6.2.1",
"css-loader": "^5.0.0",
"eslint": "^7.11.0",
"eslint-config-airbnb-base": "^14.2.0",
"eslint-config-airbnb-typescript": "^12.0.0",
"eslint-import-resolver-typescript": "^2.3.0",
"eslint-loader": "^4.0.2",
"eslint-plugin-import": "^2.22.1",
"eslint-plugin-react": "^7.21.5",
"eslint-plugin-react-hooks": "^4.2.0",
"file-loader": "^6.1.1",
"html-webpack-plugin": "^4.5.0",
"http-proxy-middleware": "^1.0.6",
"husky": "^4.3.0",
"less": "^3.12.2",
"less-loader": "^5.0.0",
"mini-css-extract-plugin": "^1.1.1",
"optimize-css-assets-webpack-plugin": "^5.0.4",
"postcss": "^8.1.2",
"postcss-calc": "^7.0.5",
"postcss-css-variables": "^0.17.0",
"postcss-custom-media": "^7.0.8",
"postcss-import": "^13.0.0",
"postcss-inline-svg": "^4.1.0",
"postcss-loader": "^4.0.4",
"postcss-mixins": "^7.0.1",
"postcss-modules": "^3.2.2",
"postcss-nested": "^5.0.1",
"postcss-preset-env": "^6.7.0",
"postcss-reporter": "^7.0.1",
"postcss-variables": "^1.1.1",
"style-loader": "^2.0.0",
"stylelint": "^13.7.2",
"stylelint-webpack-plugin": "^2.1.1",
"terser-webpack-plugin": "^5.0.0",
"ts-loader": "^8.0.6",
"ts-morph": "^8.1.2",
"ts-node": "^9.0.0",
"typescript": "^4.0.3",
"url-loader": "^4.1.1",
"webpack": "^5.10.0",
"webpack-cli": "^4.2.0",
"webpack-dev-server": "^3.11.0",
"webpack-merge": "^5.2.0",
"yaml": "^1.10.0"
}
}
17 changes: 17 additions & 0 deletions client2/postcss.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
module.exports = {
plugins: [
['postcss-import', {}],
['postcss-nested', {}],
['postcss-custom-media', {}],
['postcss-variables', {}],
['postcss-calc', {}],
['postcss-mixins', {}],
['postcss-preset-env', { stage: 3, features: { 'nesting-rules': true } }],
['postcss-reporter', { clearMessages: true }],
['postcss-inline-svg', {
paths: ['frontend/icons', 'vendor/adguard/utils-bundle/src/Resources/frontend/icons'],
svgo: { plugins: [{ cleanupAttrs: true }] }
}],
['autoprefixer'],
]
};
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added client2/public/assets/favicon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 8 additions & 0 deletions client2/public/assets/safari-pinned-tab.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
23 changes: 23 additions & 0 deletions client2/public/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, shrink-to-fit=no">
<meta name="theme-color" content="#000000">
<meta name="google" content="notranslate">
<meta http-equiv="x-dns-prefetch-control" content="off">
<meta name="mobile-web-app-capable" content="yes" />
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="apple-mobile-web-app-status-bar-style" content="default">
<link rel="apple-touch-icon" sizes="180x180" href="assets/apple-touch-icon-180x180.png" />
<link rel="mask-icon" href="assets/safari-pinned-tab.svg" color="#67B279">
<link rel="icon" type="image/png" href="assets/favicon.png" sizes="48x48">
<title>AdGuard Home</title>
</head>
<body>
<noscript>
You need to enable JavaScript to run this app.
</noscript>
<div id="app"></div>
</body>
</html>
22 changes: 22 additions & 0 deletions client2/public/install.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, shrink-to-fit=no">
<meta name="theme-color" content="#000000">
<meta name="google" content="notranslate">
<meta name="mobile-web-app-capable" content="yes" />
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="apple-mobile-web-app-status-bar-style" content="default">
<link rel="apple-touch-icon" sizes="180x180" href="assets/apple-touch-icon-180x180.png" />
<link rel="mask-icon" href="assets/safari-pinned-tab.svg" color="#67B279">
<link rel="icon" type="image/png" href="assets/favicon.png" sizes="48x48">
<title>Setup AdGuard Home</title>
</head>
<body>
<noscript>
You need to enable JavaScript to run this app.
</noscript>
<div id="app"></div>
</body>
</html>
22 changes: 22 additions & 0 deletions client2/public/login.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, shrink-to-fit=no">
<meta name="theme-color" content="#000000">
<meta name="google" content="notranslate">
<link rel="apple-touch-icon" sizes="180x180" href="assets/apple-touch-icon-180x180.png" />
<meta name="mobile-web-app-capable" content="yes" />
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="apple-mobile-web-app-status-bar-style" content="default">
<link rel="mask-icon" href="assets/safari-pinned-tab.svg" color="#67B279">
<link rel="icon" type="image/png" href="assets/favicon.png" sizes="48x48">
<title>Login</title>
</head>
<body>
<noscript>
You need to enable JavaScript to run this app.
</noscript>
<div id="app"></div>
</body>
</html>
12 changes: 12 additions & 0 deletions client2/scripts/consts.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
export const OPEN_API_PATH = '../openapi/openapi.yaml';
export const ENT_DIR = './src/lib/entities';
export const API_DIR = './src/lib/apis';
export const LOCALE_FOLDER_PATH = './src/lib/intl/__locales';
export const TRANSLATOR_CLASS_NAME = 'Translator';
export const USE_INTL_NAME = 'useIntl';

export const trimQuotes = (str: string) => {
return str.replace(/\'|\"/g, '');
};

export const GENERATOR_ENTITY_ALLIAS = 'Entities/';
18 changes: 18 additions & 0 deletions client2/scripts/generator/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import * as fs from 'fs';
import * as YAML from 'yaml';
import { OPEN_API_PATH } from '../consts';

import EntitiesGenerator from './src/generateEntities';
import ApisGenerator from './src/generateApis';


const generateApi = (openApi: Record<string, any>) => {
const ent = new EntitiesGenerator(openApi);
ent.save();

const api = new ApisGenerator(openApi);
api.save();
}

const openApiFile = fs.readFileSync(OPEN_API_PATH, 'utf8');
generateApi(YAML.parse(openApiFile));
Loading

0 comments on commit 99bb2f2

Please sign in to comment.