This commit is contained in:
Dawid Wysokiński 2022-12-31 11:15:23 +01:00
commit 8a7cadbbb9
Signed by: Kichiyaki
GPG Key ID: B5445E357FB8B892
13 changed files with 2246 additions and 0 deletions

5
.dockerignore Normal file
View File

@ -0,0 +1,5 @@
.parcel-cache
dist
yarn-error.log
README.md

133
.gitignore vendored Normal file
View File

@ -0,0 +1,133 @@
# ---> Node
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*
.pnpm-debug.log*
# Diagnostic reports (https://nodejs.org/api/report.html)
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
# Runtime data
pids
*.pid
*.seed
*.pid.lock
# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov
# Coverage directory used by tools like istanbul
coverage
*.lcov
# nyc test coverage
.nyc_output
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
.grunt
# Bower dependency directory (https://bower.io/)
bower_components
# node-waf configuration
.lock-wscript
# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release
# Dependency directories
node_modules/
jspm_packages/
# Snowpack dependency directory (https://snowpack.dev/)
web_modules/
# TypeScript cache
*.tsbuildinfo
# Optional npm cache directory
.npm
# Optional eslint cache
.eslintcache
# Optional stylelint cache
.stylelintcache
# Microbundle cache
.rpt2_cache/
.rts2_cache_cjs/
.rts2_cache_es/
.rts2_cache_umd/
# Optional REPL history
.node_repl_history
# Output of 'npm pack'
*.tgz
# Yarn Integrity file
.yarn-integrity
# dotenv environment variable files
.env
.env.development.local
.env.test.local
.env.production.local
.env.local
# parcel-bundler cache (https://parceljs.org/)
.cache
.parcel-cache
# Next.js build output
.next
out
# Nuxt.js build / generate output
.nuxt
dist
# Gatsby files
.cache/
# Comment in the public line in if your project uses Gatsby and not Next.js
# https://nextjs.org/blog/next-9-1#public-directory-support
# public
# vuepress build output
.vuepress/dist
# vuepress v2.x temp and cache directory
.temp
.cache
# Docusaurus cache and generated files
.docusaurus
# Serverless directories
.serverless/
# FuseBox cache
.fusebox/
# DynamoDB Local files
.dynamodb/
# TernJS port file
.tern-port
# Stores VSCode versions used for testing VSCode extensions
.vscode-test
# yarn v2
.yarn/cache
.yarn/unplugged
.yarn/build-state.yml
.yarn/install-state.gz
.pnp.*
.idea

3
.prettierrc.js Normal file
View File

@ -0,0 +1,3 @@
module.exports = {
singleQuote: true,
};

23
.terserrc.js Normal file
View File

@ -0,0 +1,23 @@
const preambles = {
'extended-player-profile': `// ==UserScript==
// @name Extended player profile
// @version 1.0.0
// @description Adds additional info to player profile.
// @author Dawid Wysokiński - Kichiyaki - contact@dwysokinski.me
// @match https://*/game.php?*screen=info_player*
// @downloadURL ${process.env.PUBLIC_URL}/extendedPlayerProfile.js
// @updateURL ${process.env.PUBLIC_URL}/extendedPlayerProfile.js
// @icon https://www.google.com/s2/favicons?domain=plemiona.pl
// @grant none
// @run-at document-end
// ==/UserScript==`,
};
const preamble = preambles[process.env.PREAMBLE];
module.exports = preamble
? {
output: {
preamble: preamble,
},
}
: {};

5
Caddyfile Normal file
View File

@ -0,0 +1,5 @@
:80 {
root * /var/www
file_server
header -Server
}

15
Dockerfile Normal file
View File

@ -0,0 +1,15 @@
FROM node:16.19-alpine as build-deps
WORKDIR /app
COPY package.json yarn.lock ./
RUN yarn
COPY . ./
ENV NODE_ENV=production
RUN yarn build
FROM caddy:2.6.2-alpine
COPY --from=build-deps /app/dist /var/www
COPY --from=build-deps /app/static /var/www
COPY Caddyfile /etc/caddy/Caddyfile

21
LICENSE Normal file
View File

@ -0,0 +1,21 @@
The MIT License (MIT)
Copyright (c) 2022 Dawid Wysokiński
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

2
README.md Normal file
View File

@ -0,0 +1,2 @@
# scripts

29
package.json Normal file
View File

@ -0,0 +1,29 @@
{
"name": "tw-scripts",
"version": "0.1.0",
"license": "MIT",
"scripts": {
"build-single": "PUBLIC_URL=https://scripts.tribalwarshelp.com parcel build --dist-dir dist",
"build:extended-player-profile": "PREAMBLE=extended-player-profile yarn build-single src/extendedPlayerProfile.ts",
"build": "npm-run-all build:*"
},
"author": {
"name": "Dawid Wysokiński",
"email": "contact@dwysokinski.me",
"url": "https://dwysokinski.me/"
},
"browserslist": [
"since 2017-06"
],
"devDependencies": {
"@types/jquery": "^3.5.14",
"@types/node": "^18.11.17",
"npm-run-all": "^4.1.5",
"parcel": "^2.8.1",
"prettier": "^2.8.1",
"typescript": "^4.9.4"
},
"dependencies": {
"date-fns": "^2.29.3"
}
}

View File

@ -0,0 +1 @@
// Extended player profile

25
src/global.d.ts vendored Normal file
View File

@ -0,0 +1,25 @@
export {};
declare global {
interface Window {
game_data: {
group_id: number;
player: {
id: number;
};
village: {
id: number;
};
locale: string;
screen: string;
mode: string | null;
};
TribalWars: {
redirect: (queryParams: Record<string, string>) => void;
};
UI: {
InfoMessage: (s: string) => void;
ErrorMessage: (s: string) => void;
};
}
}

11
tsconfig.json Normal file
View File

@ -0,0 +1,11 @@
{
"compilerOptions": {
"target": "es2017",
"strict": true,
"moduleResolution": "Node",
"strictNullChecks": true,
"strictFunctionTypes": true,
"skipLibCheck": true,
"noImplicitAny": true
}
}

1973
yarn.lock Normal file

File diff suppressed because it is too large Load Diff