Skip to content

Commit 5a642d4

Browse files
committed
chore: initial commit
0 parents  commit 5a642d4

File tree

222 files changed

+350246
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

222 files changed

+350246
-0
lines changed

.dockerignore

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
.vscode
2+
node_modules
3+
.firebaserc
4+
webdist/*
5+
dist/*

.env.sample

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
FIREBASE_API_KEY=
2+
FIREBASE_AUTH_DOMAIN=
3+
FIREBASE_DATABASE_URL=
4+
FIREBASE_PROJECT_ID=
5+
FIREBASE_STORAGE_BUCKET=
6+
FIREBASE_MESSAGING_SENDER_ID=
7+
FIREBASE_APP_ID=
8+
FIREBASE_MEASUREMENT_ID=
9+
PARSE_APP_ID=
10+
PARSE_SERVER_URL=
11+
WEBSITE_URL=

.gitignore

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
dist/js
2+
node_modules
3+
.env
4+
.env.prod
5+
.firebaserc
6+
webdist/*
7+
dist/extension
8+
dist/extension/js
9+
dist/extension/img
10+
dist/extension/background.html
11+
dist/extension/popup.html
12+
dist/*.zip
13+
dist/web
14+
docker/default.conf
15+
server-fonts/*
16+
Dockerfile

.prettierrc.js

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
module.exports = {
2+
proseWrap: "always"
3+
};
4+

Dockerfile.sample

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
FROM node:14.15.1-alpine3.12 as build
2+
3+
WORKDIR /app
4+
ENV PATH /app/node_modules/.bin:$PATH
5+
6+
RUN npm ci
7+
8+
COPY . ./
9+
RUN npm run build:web
10+
11+
FROM nginx:stable-alpine
12+
COPY docker/default.conf /etc/nginx/conf.d/default.conf
13+
COPY --from=build /app/dist/web /usr/share/nginx/html
14+
EXPOSE 80
15+
CMD ["nginx", "-g", "daemon off;"]

LICENSE

+676
Large diffs are not rendered by default.

README.md

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# NekoCap Extension & Website

babel.config.json

+37
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
{
2+
"plugins": [
3+
[
4+
"import",
5+
{
6+
"libraryName": "antd",
7+
"libraryDirectory": "lib"
8+
},
9+
"import-antd"
10+
],
11+
[
12+
"import",
13+
{
14+
"libraryName": "lodash",
15+
"libraryDirectory": "",
16+
"camel2DashComponentName": false
17+
},
18+
"import-lodash"
19+
],
20+
[
21+
"import",
22+
{
23+
"libraryName": "@fortawesome/free-solid-svg-icons",
24+
"libraryDirectory": "",
25+
"camel2DashComponentName": false,
26+
"transformToDefaultImport": false
27+
},
28+
"import-fontawesome"
29+
],
30+
"@babel/plugin-transform-runtime"
31+
],
32+
"presets": [
33+
"@babel/preset-env",
34+
"@babel/preset-react",
35+
["@babel/preset-typescript", { "allowNamespaces": true }]
36+
]
37+
}

config/common.js

+101
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
const path = require("path");
2+
const webpack = require("webpack");
3+
const TsconfigPathsPlugin = require("tsconfig-paths-webpack-plugin");
4+
const LicenseWebpackPlugin = require("license-webpack-plugin")
5+
.LicenseWebpackPlugin;
6+
const BundleAnalyzerPlugin = require("webpack-bundle-analyzer")
7+
.BundleAnalyzerPlugin;
8+
const MiniCssExtractPlugin = require("mini-css-extract-plugin");
9+
const TerserPlugin = require("terser-webpack-plugin");
10+
const OptimizeCssAssetsPlugin = require("optimize-css-assets-webpack-plugin");
11+
12+
module.exports.optimization = {
13+
minimize: true,
14+
minimizer: [
15+
new TerserPlugin({
16+
parallel: true,
17+
terserOptions: {
18+
output: { ascii_only: true },
19+
},
20+
}),
21+
],
22+
};
23+
24+
module.exports.resolveExtensions = [".ts", ".tsx", ".js", ".scss", ".css"];
25+
module.exports.resolvePlugins = [new TsconfigPathsPlugin()];
26+
27+
module.exports.getRules = (devMode, root, imageOutputPath = undefined) => [
28+
{
29+
exclude: /node_modules/,
30+
test: /\.tsx?$/,
31+
use: "babel-loader",
32+
},
33+
{
34+
test: /\.less$/,
35+
use: [
36+
{
37+
loader: devMode ? "style-loader" : MiniCssExtractPlugin.loader,
38+
},
39+
{
40+
loader: "css-loader",
41+
options: {
42+
importLoaders: 1,
43+
sourceMap: devMode,
44+
},
45+
},
46+
{
47+
loader: "less-loader",
48+
options: {
49+
javascriptEnabled: true,
50+
},
51+
},
52+
],
53+
},
54+
{
55+
exclude: /node_modules/,
56+
test: /\.scss$/,
57+
issuer: {
58+
exclude: /\.less$/,
59+
},
60+
use: [
61+
devMode ? "style-loader" : MiniCssExtractPlugin.loader,
62+
// "@teamsupercell/typings-for-css-modules-loader",
63+
{ loader: "css-loader", options: { modules: true } },
64+
"sass-loader",
65+
],
66+
},
67+
{
68+
test: /\.scss$/,
69+
issuer: /\.less$/,
70+
use: {
71+
loader: path.resolve(root, "src", "sass-vars-to-less.js"), // Change path if necessary
72+
},
73+
},
74+
{
75+
test: /\.css$/,
76+
use: [devMode ? "style-loader" : MiniCssExtractPlugin.loader, "css-loader"],
77+
},
78+
{
79+
test: /\.(png|jpe?g|gif|svg)$/i,
80+
use: [
81+
{
82+
loader: "file-loader",
83+
options: {
84+
outputPath: imageOutputPath,
85+
},
86+
},
87+
],
88+
},
89+
];
90+
91+
module.exports.getPlugins = (devMode, envKeys, analyze) =>
92+
[
93+
!devMode
94+
? new LicenseWebpackPlugin({
95+
preferredLicenseTypes: ["MIT", "ISC", "BSD"],
96+
})
97+
: null,
98+
new webpack.DefinePlugin(envKeys),
99+
new OptimizeCssAssetsPlugin(),
100+
analyze && new BundleAnalyzerPlugin(),
101+
].filter(Boolean);

docker/default.conf.template

+53
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
server {
2+
listen 80 default_server;
3+
server_name localhost;
4+
listen [::]:80 default_server;
5+
6+
gzip on;
7+
gzip_types text/plain application/xml text/css application/javascript;
8+
9+
return 301 https://$host$request_uri;
10+
}
11+
12+
server {
13+
listen 443 ssl http2;
14+
listen [::]:443 ssl http2;
15+
16+
gzip on;
17+
gzip_types text/plain application/xml text/css application/javascript;
18+
19+
# Uncomment and supply your own certificate path
20+
# ssl_certificate /path/to/cert;
21+
# ssl_certificate_key /path/to/key;
22+
ssl_session_timeout 1d;
23+
ssl_session_cache shared:MozSSL:10m; # about 40000 sessions
24+
ssl_session_tickets off;
25+
26+
# Uncomment and supply your own path
27+
# curl https://ssl-config.mozilla.org/ffdhe2048.txt > /path/to/dhparam
28+
# ssl_dhparam /path/to/dhparam;
29+
30+
# intermediate configuration
31+
ssl_protocols TLSv1.2 TLSv1.3;
32+
ssl_ciphers ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384;
33+
ssl_prefer_server_ciphers off;
34+
35+
# HSTS (ngx_http_headers_module is required) (63072000 seconds)
36+
add_header Strict-Transport-Security "max-age=63072000" always;
37+
38+
# OCSP stapling
39+
ssl_stapling on;
40+
ssl_stapling_verify on;
41+
42+
# verify chain of trust of OCSP response using Root CA and Intermediate certs
43+
# Uncomment and supply your own path
44+
# ssl_trusted_certificate /path/to/trusted/cert;
45+
46+
# replace with the IP address of your resolver
47+
resolver 127.0.0.1;
48+
49+
location / {
50+
root /usr/share/nginx/html;
51+
index index.html index.htm;
52+
}
53+
}

extension-statics/icon128.png

4.72 KB
Loading

extension-statics/icon16.png

498 Bytes
Loading

extension-statics/icon48.png

1.64 KB
Loading

extension-statics/manifest.json

+60
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
{
2+
"manifest_version": 2,
3+
4+
"name": "NekoCap",
5+
"description": "NekoCap",
6+
"version": "0.2.10",
7+
8+
"browser_action": {
9+
"default_icon": "icon16.png",
10+
"default_popup": "popup.html"
11+
},
12+
13+
"background": {
14+
"page": "background.html",
15+
"persistent": false
16+
},
17+
18+
"content_scripts": [
19+
{
20+
"matches": [
21+
"https://*.youtube.com/*",
22+
"https://*.tver.jp/*",
23+
"https://*.nicovideo.jp/*",
24+
"https://*.vimeo.com/*",
25+
"https://*.bilibili.com/*"
26+
],
27+
"run_at": "document_end",
28+
"js": ["js/content.js"]
29+
},
30+
{
31+
"matches": [
32+
"https://*.youtube.com/*",
33+
"https://*.tver.jp/*",
34+
"https://*.nicovideo.jp/*",
35+
"https://*.vimeo.com/*",
36+
"https://*.bilibili.com/*"
37+
],
38+
"run_at": "document_start",
39+
"css": ["js/content.css"]
40+
}
41+
],
42+
43+
"icons": {
44+
"16": "icon16.png",
45+
"48": "icon48.png",
46+
"128": "icon128.png"
47+
},
48+
49+
"permissions": ["storage", "webNavigation"],
50+
51+
"web_accessible_resources": [
52+
"img/*.jpg",
53+
"img/*.png",
54+
"img/*.gif",
55+
"img/*.svg",
56+
"sub-assets/*.*",
57+
"js/subtitle-octopus/*.*"
58+
],
59+
"content_security_policy": "script-src 'self' https://*.google.com;",
60+
}

0 commit comments

Comments
 (0)