Merge branch 'release/2.0.0'

merge-requests/3/merge v2.0.0
Nato Boram 2019-12-03 01:40:36 -05:00
commit 03cdf26234
58 changed files with 9768 additions and 381 deletions

13
.editorconfig Normal file
View File

@ -0,0 +1,13 @@
# Editor configuration, see https://editorconfig.org
root = true
[*]
charset = utf-8
indent_style = space
indent_size = 2
insert_final_newline = true
trim_trailing_whitespace = true
[*.md]
max_line_length = off
trim_trailing_whitespace = false

190
.gitignore vendored
View File

@ -1,170 +1,46 @@
# See http://help.github.com/ignore-files/ for more about ignoring files.
# Created by https://www.gitignore.io/api/node,linux,macos,windows,visualstudiocode
# Edit at https://www.gitignore.io/?templates=node,linux,macos,windows,visualstudiocode
# compiled output
/dist
/tmp
/out-tsc
# Only exists if Bazel was run
/bazel-out
### Linux ###
*~
# dependencies
/node_modules
# temporary files which can be created if a process still has a handle open of a deleted file
.fuse_hidden*
# profiling files
chrome-profiler-events*.json
speed-measure-plugin*.json
# KDE directory preferences
.directory
# IDEs and editors
/.idea
.project
.classpath
.c9/
*.launch
.settings/
*.sublime-workspace
# Linux trash folder which might appear on any partition or disk
.Trash-*
# .nfs files are created when an open file is removed but is still being accessed
.nfs*
### macOS ###
# General
.DS_Store
.AppleDouble
.LSOverride
# Icon must end with two \r
Icon
# Thumbnails
._*
# Files that might appear in the root of a volume
.DocumentRevisions-V100
.fseventsd
.Spotlight-V100
.TemporaryItems
.Trashes
.VolumeIcon.icns
.com.apple.timemachine.donotpresent
# Directories potentially created on remote AFP share
.AppleDB
.AppleDesktop
Network Trash Folder
Temporary Items
.apdisk
### Node ###
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-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
# 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/
# TypeScript v1 declaration files
typings/
# Optional npm cache directory
.npm
# Optional eslint cache
.eslintcache
# Optional REPL history
.node_repl_history
# Output of 'npm pack'
*.tgz
# Yarn Integrity file
.yarn-integrity
# dotenv environment variables file
.env
.env.test
# parcel-bundler cache (https://parceljs.org/)
.cache
# next.js build output
.next
# nuxt.js build output
.nuxt
# vuepress build output
.vuepress/dist
# Serverless directories
.serverless/
# FuseBox cache
.fusebox/
# DynamoDB Local files
.dynamodb/
### VisualStudioCode ###
# IDE - VSCode
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
.history/*
### VisualStudioCode Patch ###
# Ignore all local history of files
.history
# misc
/.sass-cache
/connect.lock
/coverage
/libpeerconnection.log
npm-debug.log
yarn-error.log
testem.log
/typings
### Windows ###
# Windows thumbnail cache files
# System Files
.DS_Store
Thumbs.db
ehthumbs.db
ehthumbs_vista.db
# Dump file
*.stackdump
# Folder config file
[Dd]esktop.ini
# Recycle Bin used on file shares
$RECYCLE.BIN/
# Windows Installer files
*.cab
*.msi
*.msix
*.msm
*.msp
# Windows shortcuts
*.lnk
# End of https://www.gitignore.io/api/node,linux,macos,windows,visualstudiocode

38
.gitlab-ci.yml Normal file
View File

@ -0,0 +1,38 @@
image: node:13
before_script:
- yarn
cache:
key:
files:
- package.json
- yarn.lock
paths:
- node_modules
build:
stage: build
script:
- yarn run build:prod
artifacts:
paths:
- dist/angular
test:
stage: test
script:
- yarn run lint
pages:
stage: deploy
script:
- yarn run build:gitlab
- mv dist/angular public
- cp public/index.html public/404.html
artifacts:
paths:
- public
only:
- master
- pages

3
.ipfs-npmrc Normal file
View File

@ -0,0 +1,3 @@
{
"packageManager": "yarn"
}

View File

@ -1,3 +0,0 @@
{
"esversion": 6
}

4
.markdownlint.json Normal file
View File

@ -0,0 +1,4 @@
{
"line-length": false,
"no-duplicate-heading": false
}

View File

@ -1,13 +1,20 @@
{
// See http://go.microsoft.com/fwlink/?LinkId=827846 to learn about workspace recommendations.
// Extension identifier format: ${publisher}.${name}. Example: vscode.csharp
// List of extensions which should be recommended for users of this workspace.
"recommendations": [
"dbaeumer.jshint"
],
// List of extensions recommended by VS Code that should not be recommended for users of this workspace.
"unwantedRecommendations": [
"dbaeumer.vscode-eslint",
"eg2.tslint"
]
}
// See https://go.microsoft.com/fwlink/?LinkId=827846 to learn about workspace recommendations.
// Extension identifier format: ${publisher}.${name}. Example: vscode.csharp
// List of extensions which should be recommended for users of this workspace.
"recommendations": [
"angular.ng-template",
"davidanson.vscode-markdownlint",
"editorconfig.editorconfig",
"hookyqr.beautify",
"johnpapa.angular2",
"ms-vscode.typescript-javascript-grammar",
"ms-vscode.vscode-typescript-tslint-plugin",
"msjsdiag.debugger-for-chrome",
"visualstudioexptteam.vscodeintellicode",
],
// List of extensions recommended by VS Code that should not be recommended for users of this workspace.
"unwantedRecommendations": [
"eg2.tslint"
]
}

45
.vscode/launch.json vendored Normal file
View File

@ -0,0 +1,45 @@
{
"version": "0.2.0",
"configurations": [
{
"name": "ng serve",
"type": "chrome",
"request": "launch",
"preLaunchTask": "npm: start",
"url": "http://localhost:4200/#",
"webRoot": "${workspaceFolder}",
"sourceMapPathOverrides": {
"webpack:/*": "${webRoot}/*",
"/./*": "${webRoot}/*",
"/src/*": "${webRoot}/*",
"/*": "*",
"/./~/*": "${webRoot}/node_modules/*"
}
},
{
"name": "ng test",
"type": "chrome",
"request": "launch",
"url": "http://localhost:9876/debug.html",
"webRoot": "${workspaceFolder}",
"sourceMaps": true,
"sourceMapPathOverrides": {
"webpack:/*": "${webRoot}/*",
"/./*": "${webRoot}/*",
"/src/*": "${webRoot}/*",
"/*": "*",
"/./~/*": "${webRoot}/node_modules/*"
}
},
{
"name": "ng e2e",
"type": "node",
"request": "launch",
"program": "${workspaceFolder}/node_modules/protractor/bin/protractor",
"protocol": "inspector",
"args": [
"${workspaceFolder}/e2e/protractor.conf.js"
]
}
]
}

25
.vscode/settings.json vendored
View File

@ -1,10 +1,17 @@
{
"editor.detectIndentation": false,
"editor.formatOnSave": true,
"editor.insertSpaces": false,
"editor.wordWrap": "on",
"html.format.indentHandlebars": true,
"html.format.maxPreserveNewLines": 1,
"html.format.wrapLineLength": 0,
"jshint.lintHTML": true,
}
"editor.codeActionsOnSave": {
"source.fixAll": true,
},
"editor.formatOnSave": true,
"editor.rulers": [
140
],
"html.format.indentHandlebars": true,
"html.format.maxPreserveNewLines": 1,
"html.format.wrapAttributes": "auto",
"html.format.wrapLineLength": 140,
"npm.packageManager": "yarn",
"tslint.packageManager": "yarn",
"typescript.preferences.importModuleSpecifier": "relative",
"typescript.updateImportsOnFileMove.enabled": "always",
}

37
.vscode/tasks.json vendored Normal file
View File

@ -0,0 +1,37 @@
{
"version": "2.0.0",
"tasks": [
{
"type": "npm",
"script": "start",
"isBackground": true,
"presentation": {
"focus": true,
"panel": "dedicated"
},
"group": {
"kind": "build",
"isDefault": true
},
"problemMatcher": {
"owner": "typescript",
"source": "ts",
"applyTo": "closedDocuments",
"fileLocation": [
"relative",
"${cwd}"
],
"pattern": "$tsc",
"background": {
"activeOnStart": true,
"beginsPattern": {
"regexp": "(.*?)"
},
"endsPattern": {
"regexp": "Compiled |Failed to compile."
}
}
}
},
]
}

42
CHANGELOG.md Normal file
View File

@ -0,0 +1,42 @@
# Changelog
All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/), and this project adheres to [Semantic Versioning](https://semver.org/).
## [Unreleased]
### Added
### Changed
### Deprecated
### Removed
### Fixed
### Security
## [2.0.0] - 2019-12-03
Now based on Angular!
Tests were done with `ipfs-npm` : They weren't successful. `ipfs-css` is only minimally used.
### Added
* GitLab Pages - <https://natoboram.gitlab.io/public-gateway-cacher/>
## [1.0.0] - 2019-11-28
This version is a fork of [github.com/ipfs/public-gateway-checker](https://github.com/ipfs/public-gateway-checker).
## Types of changes
* `Added` for new features.
* `Changed` for changes in existing functionality.
* `Deprecated` for soon-to-be removed features.
* `Removed` for now removed features.
* `Fixed` for any bug fixes.
* `Security` in case of vulnerabilities.

View File

@ -4,10 +4,38 @@ Cache a specific hash on a bunch of public gateways.
**Note :** All of these (except gateway.ipfs.io and ipfs.io) are hosted by third-parties and should be treated as such.
You can view this website on [IPFS](https://bafybeifqneiiwgcejnisxd6vjic2xrmfieffldiqembuagflb2xaup772a.cf-ipfs.com).
You can view this website on [IPFS](https://bafybeibjf6z3sxavox6uahfl4vogkuenimlpvn4eghdv6mtsm55rpnalve.cf-ipfs.com).
Here's a screenshot :
![screenshot](https://ipfs.io/ipfs/QmUeCSd4gHio7MxZuRXCcLFXED9GpfntKcL87gmXvZV3ed)
If you'd like to add a new public gateway, please go to [github.com/ipfs/public-gateway-checker](https://github.com/ipfs/public-gateway-checker), submit a pull request then open an issue here.
## Angular
This project was generated with [Angular CLI](https://github.com/angular/angular-cli) version 8.3.20.
### Development server
Run `ng serve` for a dev server. Navigate to `http://localhost:4200/`. The app will automatically reload if you change any of the source files.
### Code scaffolding
Run `ng generate component component-name` to generate a new component. You can also use `ng generate directive|pipe|service|class|guard|interface|enum|module`.
### Build
Run `ng build` to build the project. The build artifacts will be stored in the `dist/` directory. Use the `--prod` flag for a production build.
### Running unit tests
Run `ng test` to execute the unit tests via [Karma](https://karma-runner.github.io).
### Running end-to-end tests
Run `ng e2e` to execute the end-to-end tests via [Protractor](http://www.protractortest.org/).
### Further help
To get more help on the Angular CLI use `ng help` or go check out the [Angular CLI README](https://github.com/angular/angular-cli/blob/master/README.md).

201
angular.json Normal file
View File

@ -0,0 +1,201 @@
{
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
"version": 1,
"newProjectRoot": "projects",
"projects": {
"public-gateway-cacher": {
"projectType": "application",
"schematics": {
"@schematics/angular:component": {
"style": "scss"
}
},
"root": "",
"sourceRoot": "src",
"prefix": "app",
"architect": {
"build": {
"builder": "@angular-devkit/build-angular:browser",
"options": {
"outputPath": "dist/angular",
"index": "src/index.html",
"main": "src/main.ts",
"polyfills": "src/polyfills.ts",
"tsConfig": "tsconfig.app.json",
"aot": true,
"assets": [
"src/favicon.png",
"src/assets",
{
"glob": "*",
"input": "node_modules/ipfs-css",
"output": "assets/ipfs-css"
}
],
"styles": [
"src/styles.scss"
],
"scripts": []
},
"configurations": {
"production": {
"fileReplacements": [
{
"replace": "src/environments/environment.ts",
"with": "src/environments/environment.prod.ts"
}
],
"optimization": true,
"outputHashing": "all",
"sourceMap": true,
"extractCss": true,
"namedChunks": true,
"aot": true,
"extractLicenses": true,
"vendorChunk": true,
"buildOptimizer": true,
"budgets": [
{
"type": "initial",
"maximumWarning": "2mb",
"maximumError": "5mb"
},
{
"type": "anyComponentStyle",
"maximumWarning": "6kb",
"maximumError": "10kb"
}
]
},
"gitlab": {
"fileReplacements": [
{
"replace": "src/environments/environment.ts",
"with": "src/environments/environment.gitlab.ts"
}
],
"optimization": true,
"outputHashing": "all",
"sourceMap": true,
"extractCss": true,
"namedChunks": true,
"aot": true,
"extractLicenses": true,
"vendorChunk": true,
"buildOptimizer": true,
"budgets": [
{
"type": "initial",
"maximumWarning": "2mb",
"maximumError": "5mb"
},
{
"type": "anyComponentStyle",
"maximumWarning": "6kb",
"maximumError": "10kb"
}
]
},
"ipfs": {
"fileReplacements": [
{
"replace": "src/environments/environment.ts",
"with": "src/environments/environment.ipfs.ts"
}
],
"optimization": true,
"outputHashing": "all",
"sourceMap": true,
"extractCss": true,
"namedChunks": true,
"aot": true,
"extractLicenses": true,
"vendorChunk": true,
"buildOptimizer": true,
"budgets": [
{
"type": "initial",
"maximumWarning": "2mb",
"maximumError": "5mb"
},
{
"type": "anyComponentStyle",
"maximumWarning": "6kb",
"maximumError": "10kb"
}
]
}
}
},
"serve": {
"builder": "@angular-devkit/build-angular:dev-server",
"options": {
"browserTarget": "public-gateway-cacher:build"
},
"configurations": {
"production": {
"browserTarget": "public-gateway-cacher:build:production"
}
}
},
"extract-i18n": {
"builder": "@angular-devkit/build-angular:extract-i18n",
"options": {
"browserTarget": "public-gateway-cacher:build"
}
},
"test": {
"builder": "@angular-devkit/build-angular:karma",
"options": {
"main": "src/test.ts",
"polyfills": "src/polyfills.ts",
"tsConfig": "tsconfig.spec.json",
"karmaConfig": "karma.conf.js",
"assets": [
"src/favicon.png",
"src/assets",
{
"glob": "*",
"input": "node_modules/ipfs-css",
"output": "assets/ipfs-css"
}
],
"styles": [
"src/styles.scss"
],
"scripts": []
}
},
"lint": {
"builder": "@angular-devkit/build-angular:tslint",
"options": {
"tsConfig": [
"tsconfig.app.json",
"tsconfig.spec.json",
"e2e/tsconfig.json"
],
"exclude": [
"**/node_modules/**"
]
}
},
"e2e": {
"builder": "@angular-devkit/build-angular:protractor",
"options": {
"protractorConfig": "e2e/protractor.conf.js",
"devServerTarget": "public-gateway-cacher:serve"
},
"configurations": {
"production": {
"devServerTarget": "public-gateway-cacher:serve:production"
}
}
}
}
}
},
"defaultProject": "public-gateway-cacher",
"cli": {
"packageManager": "yarn"
}
}

12
browserslist Normal file
View File

@ -0,0 +1,12 @@
# This file is used by the build system to adjust CSS and JS output to support the specified browsers below.
# For additional information regarding the format and rule options, please see:
# https://github.com/browserslist/browserslist#queries
# You can see what browsers were selected by your queries by running:
# npx browserslist
> 0.5%
last 2 versions
Firefox ESR
not dead
not IE 9-11 # For IE 9-11 support, remove 'not'.

32
e2e/protractor.conf.js Normal file
View File

@ -0,0 +1,32 @@
// @ts-check
// Protractor configuration file, see link for more information
// https://github.com/angular/protractor/blob/master/lib/config.ts
const { SpecReporter } = require('jasmine-spec-reporter');
/**
* @type { import("protractor").Config }
*/
exports.config = {
allScriptsTimeout: 11000,
specs: [
'./src/**/*.e2e-spec.ts'
],
capabilities: {
browserName: 'chrome'
},
directConnect: true,
baseUrl: 'http://localhost:4200/',
framework: 'jasmine',
jasmineNodeOpts: {
showColors: true,
defaultTimeoutInterval: 30000,
print: function() {}
},
onPrepare() {
require('ts-node').register({
project: require('path').join(__dirname, './tsconfig.json')
});
jasmine.getEnv().addReporter(new SpecReporter({ spec: { displayStacktrace: true } }));
}
};

23
e2e/src/app.e2e-spec.ts Normal file
View File

@ -0,0 +1,23 @@
import { browser, logging } from 'protractor';
import { AppPage } from './app.po';
describe('workspace-project App', () => {
let page: AppPage;
beforeEach(() => {
page = new AppPage();
});
it('should display welcome message', () => {
page.navigateTo();
expect(page.getTitleText()).toEqual('public-gateway-cacher app is running!');
});
afterEach(async () => {
// Assert that there are no errors emitted from the browser
const logs = await browser.manage().logs().get(logging.Type.BROWSER);
expect(logs).not.toContain(jasmine.objectContaining({
level: logging.Level.SEVERE,
} as logging.Entry));
});
});

11
e2e/src/app.po.ts Normal file
View File

@ -0,0 +1,11 @@
import { browser, by, element } from 'protractor';
export class AppPage {
navigateTo() {
return browser.get(browser.baseUrl) as Promise<any>;
}
getTitleText() {
return element(by.css('app-root .content span')).getText() as Promise<string>;
}
}

13
e2e/tsconfig.json Normal file
View File

@ -0,0 +1,13 @@
{
"extends": "../tsconfig.json",
"compilerOptions": {
"outDir": "../out-tsc/e2e",
"module": "commonjs",
"target": "es5",
"types": [
"jasmine",
"jasminewd2",
"node"
]
}
}

View File

@ -1,76 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<title>Public IPFS Gateways</title>
<link rel="shortcut icon" type="image/png" href="images/favicon.png" />
<!-- Bootstrap 4 -->
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js" integrity="sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1" crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js" integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM" crossorigin="anonymous"></script>
<!-- CSS -->
<link rel="stylesheet" href="css/styles.css">
<!-- JavaScript -->
<script async src="javascript/app.js"></script>
</head>
<body>
<!-- Title -->
<header class="container">
<h1>Public IPFS Gateways</h1>
</header>
<main class="container">
<!-- IPFS Hash -->
<div class="form-group input-group">
<div class="input-group-prepend">
<label class="input-group-text" for="input_ipfs">IPFS Hash</label>
</div>
<input type="text" class="form-control" id="input_ipfs">
<div class="input-group-append">
<button class="btn btn-secondary" type="button" onclick="start_ipfs();">Cache</button>
</div>
</div>
<!-- IPNS Hash -->
<div class="form-group input-group">
<div class="input-group-prepend">
<label class="input-group-text" for="input_ipns">IPNS Hash</label>
</div>
<input type="text" class="form-control" id="input_ipns">
<div class="input-group-append">
<button class="btn btn-secondary" onclick="start_ipns();">Cache</button>
</div>
</div>
<!-- Results -->
<h3 id="stats"></h3>
<div id="results"></div>
</main>
<!-- About -->
<footer class="container">
<h3>About</h3>
<p>
This is a fork of <a href="https://github.com/ipfs/public-gateway-checker">github.com/ipfs/public-gateway-checker</a> that allows you to cache a specific IPFS and IPNS hash to a bunch of public gateways. The code source is available at <a href="https://gitlab.com/NatoBoram/public-gateway-checker">gitlab.com/NatoBoram/public-gateway-checker</a>.
</p>
<p>
If you'd like to add a new public gateway, please go to <a href="https://github.com/ipfs/public-gateway-checker">github.com/ipfs/public-gateway-checker</a>, submit a pull request then open an issue <a href="https://gitlab.com/NatoBoram/public-gateway-checker/issues/new">here</a>.
</p>
</footer>
</body>
</html>

View File

@ -1,79 +0,0 @@
var hashToTest = "";
var protocol = "";
const $results = document.querySelector('#results');
function returnHtmlLink(gateway) {
let gatewayTitle = gateway.split(hashToTest)[0];
return '<a title="' + gatewayTitle + '" href="' + gateway + '">' + gateway + '</a>';
}
function addNode(gateway, online, title) {
const para = document.createElement('div');
let node;
if (online) {
node = document.createElement('strong');
node.innerHTML = '✅ - Online - ' + returnHtmlLink(gateway);
} else {
node = document.createElement('div');
node.innerText = '❌ - Offline - ' + gateway;
}
node.setAttribute('title', title);
para.appendChild(node);
$results.appendChild(para);
}
function updateStats(total, checked) {
document.getElementById('stats').innerText = checked + '/' + total + ' gateways checked';
}
function checkGateways(gateways) {
const total = gateways.length;
let checked = 0;
gateways.forEach((gateway) => {
gateway = gateway.replace('/ipfs/', protocol);
const gatewayAndHash = gateway.replace(':hash', hashToTest);
// opt-out from gateway redirects done by browser extension
const testUrl = gatewayAndHash + '#x-ipfs-companion-no-redirect';
fetch(testUrl)
.then(res => res.text())
.then((text) => {
const matched = true; // TODO : Check if the response is good.
addNode(gatewayAndHash, matched, matched ? 'All good' : 'Output did not match expected output');
checked++;
updateStats(total, checked);
}).catch((err) => {
window.err = err;
addNode(gatewayAndHash, false, err);
checked++;
updateStats(total, checked);
});
});
}
function start_ipfs() {
while ($results.lastChild) {
$results.removeChild($results.lastChild);
}
hashToTest = document.querySelector("#input_ipfs").value;
protocol = "/ipfs/";
fetch('./json/gateways.json')
.then(res => res.json())
.then(gateways => checkGateways(gateways));
}
function start_ipns() {
while ($results.lastChild) {
$results.removeChild($results.lastChild);
}
hashToTest = document.querySelector("#input_ipns").value;
protocol = "/ipns/";
fetch('./json/gateways.json')
.then(res => res.json())
.then(gateways => checkGateways(gateways));
}

View File

@ -1,38 +0,0 @@
[
"https://ipfs.io/ipfs/:hash",
"https://gateway.ipfs.io/ipfs/:hash",
"https://ipfs.infura.io/ipfs/:hash",
"https://rx14.co.uk/ipfs/:hash",
"https://xmine128.tk/ipfs/:hash",
"https://upload.global/ipfs/:hash",
"https://ipfs.jes.xxx/ipfs/:hash",
"https://catalunya.network/ipfs/:hash",
"https://siderus.io/ipfs/:hash",
"https://ipfs.eternum.io/ipfs/:hash",
"https://hardbin.com/ipfs/:hash",
"https://ipfs.macholibre.org/ipfs/:hash",
"https://ipfs.works/ipfs/:hash",
"https://ipfs.wa.hle.rs/ipfs/:hash",
"https://api.wisdom.sh/ipfs/:hash",
"https://gateway.blocksec.com/ipfs/:hash",
"https://ipfs.renehsz.com/ipfs/:hash",
"https://cloudflare-ipfs.com/ipfs/:hash",
"https://ipns.co/:hash",
"https://ipfs.netw0rk.io/ipfs/:hash",
"https://gateway.swedneck.xyz/ipfs/:hash",
"https://ipfs.mrh.io/ipfs/:hash",
"https://gateway.originprotocol.com/ipfs/:hash",
"https://ipfs.dapps.earth/ipfs/:hash",
"https://gateway.pinata.cloud/ipfs/:hash",
"https://ipfs.doolta.com/ipfs/:hash",
"https://ipfs.sloppyta.co/ipfs/:hash",
"https://ipfs.busy.org/ipfs/:hash",
"https://ipfs.greyh.at/ipfs/:hash",
"https://gateway.serph.network/ipfs/:hash",
"https://jorropo.ovh/ipfs/:hash",
"https://ipfs.deo.moe/ipfs/:hash",
"https://gateway.temporal.cloud/ipfs/:hash",
"https://ipfs.fooock.com/ipfs/:hash",
"https://lineageos-on-ipfs.com/ipfs/:hash",
"https://permaweb.io/ipfs/:hash"
]

32
karma.conf.js Normal file
View File

@ -0,0 +1,32 @@
// Karma configuration file, see link for more information
// https://karma-runner.github.io/1.0/config/configuration-file.html
module.exports = function (config) {
config.set({
basePath: '',
frameworks: ['jasmine', '@angular-devkit/build-angular'],
plugins: [
require('karma-jasmine'),
require('karma-chrome-launcher'),
require('karma-jasmine-html-reporter'),
require('karma-coverage-istanbul-reporter'),
require('@angular-devkit/build-angular/plugins/karma')
],
client: {
clearContext: false // leave Jasmine Spec Runner output visible in browser
},
coverageIstanbulReporter: {
dir: require('path').join(__dirname, './coverage/public-gateway-cacher'),
reports: ['html', 'lcovonly', 'text-summary'],
fixWebpackSourcePaths: true
},
reporters: ['progress', 'kjhtml'],
port: 9876,
colors: true,
logLevel: config.LOG_INFO,
autoWatch: true,
browsers: ['Chrome'],
singleRun: false,
restartOnFileChange: true
});
};

62
package.json Normal file
View File

@ -0,0 +1,62 @@
{
"name": "public-gateway-cacher",
"version": "2.0.0",
"scripts": {
"ng": "ng",
"start": "ng serve --ssl",
"build": "ng build --base-href /",
"build:prod": "ng build --configuration=production --base-href /",
"build:gitlab": "ng build --configuration=gitlab --base-href /public-gateway-cacher/",
"build:ipfs": "ng build --configuration=ipfs",
"test": "ng test",
"lint": "ng lint",
"e2e": "ng e2e",
"yarn": "ipfs-yarn",
"publish:ipfs": "yarn run build:ipfs; ipfs add --recursive --chunker=rabin --cid-version=1 dist/angular"
},
"private": false,
"dependencies": {
"@angular/animations": "~8.2.14",
"@angular/cdk": "~8.2.3",
"@angular/common": "~8.2.14",
"@angular/compiler": "~8.2.14",
"@angular/core": "~8.2.14",
"@angular/flex-layout": "^8.0.0-beta.27",
"@angular/forms": "~8.2.14",
"@angular/material": "^8.2.3",
"@angular/platform-browser": "~8.2.14",
"@angular/platform-browser-dynamic": "~8.2.14",
"@angular/router": "~8.2.14",
"bootstrap": "^4.4.1",
"hammerjs": "^2.0.8",
"ipfs-css": "^0.13.1",
"rxjs": "~6.5.3",
"tslib": "^1.10.0",
"zone.js": "~0.9.1"
},
"devDependencies": {
"@angular-devkit/build-angular": "~0.803.20",
"@angular/cli": "~8.3.20",
"@angular/compiler-cli": "~8.2.14",
"@angular/language-service": "~8.2.14",
"@types/jasmine": "~3.3.8",
"@types/jasminewd2": "~2.0.3",
"@types/node": "~8.9.4",
"codelyzer": "^5.0.0",
"jasmine-core": "~3.4.0",
"jasmine-spec-reporter": "~4.2.1",
"karma": "~4.1.0",
"karma-chrome-launcher": "~2.2.0",
"karma-coverage-istanbul-reporter": "~2.0.1",
"karma-jasmine": "~2.0.1",
"karma-jasmine-html-reporter": "^1.4.0",
"protractor": "~5.4.0",
"rxjs-tslint-rules": "^4.26.3",
"ts-node": "~7.0.0",
"tslint": "~5.15.0",
"tslint-consistent-codestyle": "^1.16.0",
"tslint-origin-ordered-imports-rule": "^1.2.2",
"tslint-rxjs-subject-restrictions-rule": "^1.0.4",
"typescript": "~3.5.3"
}
}

View File

@ -1 +0,0 @@
bafybeicnwv6up3wtr7qwhlsrjthhedr4dkcdqqgatow4nsiog2uxl2ue2e

View File

@ -1,3 +0,0 @@
@echo off
ipfs add --recursive --quieter --wrap-with-directory --chunker=rabin --cid-version=1 index.html css images javascript json > public-gateway-cacher.ipfs
echo on

View File

@ -1,2 +0,0 @@
#!/bin/sh
ipfs add --recursive --quieter --wrap-with-directory --chunker=rabin --cid-version=1 index.html css images javascript json > public-gateway-cacher.ipfs

View File

@ -0,0 +1,14 @@
import { NgModule } from '@angular/core';
import { RouterModule, Routes } from '@angular/router';
import { environment } from '../environments/environment';
const routes: Routes = [{
path: '',
loadChildren: () => import('./pages/pages.module').then(m => m.PagesModule),
}];
@NgModule({
imports: [RouterModule.forRoot(routes, { useHash: environment.useHash })],
exports: [RouterModule]
})
export class AppRoutingModule { }

View File

@ -0,0 +1 @@
<router-outlet></router-outlet>

View File

@ -0,0 +1,35 @@
import { TestBed, async } from '@angular/core/testing';
import { RouterTestingModule } from '@angular/router/testing';
import { AppComponent } from './app.component';
describe('AppComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
imports: [
RouterTestingModule
],
declarations: [
AppComponent
],
}).compileComponents();
}));
it('should create the app', () => {
const fixture = TestBed.createComponent(AppComponent);
const app = fixture.debugElement.componentInstance;
expect(app).toBeTruthy();
});
it(`should have as title 'public-gateway-cacher'`, () => {
const fixture = TestBed.createComponent(AppComponent);
const app = fixture.debugElement.componentInstance;
expect(app.title).toEqual('public-gateway-cacher');
});
it('should render title', () => {
const fixture = TestBed.createComponent(AppComponent);
fixture.detectChanges();
const compiled = fixture.debugElement.nativeElement;
expect(compiled.querySelector('.content span').textContent).toContain('public-gateway-cacher app is running!');
});
});

10
src/app/app.component.ts Normal file
View File

@ -0,0 +1,10 @@
import { Component } from '@angular/core';
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.scss']
})
export class AppComponent {
title = 'public-gateway-cacher';
}

23
src/app/app.module.ts Normal file
View File

@ -0,0 +1,23 @@
import { CommonModule } from '@angular/common';
import { HttpClientModule } from '@angular/common/http';
import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { AppRoutingModule } from './app-routing.module';
import { AppComponent } from './app.component';
@NgModule({
declarations: [
AppComponent
],
imports: [
CommonModule,
BrowserModule,
BrowserAnimationsModule,
HttpClientModule,
AppRoutingModule,
],
providers: [],
bootstrap: [AppComponent]
})
export class AppModule { }

View File

@ -0,0 +1,5 @@
export interface Environment {
production: boolean;
base_href?: string;
useHash: boolean;
}

View File

@ -0,0 +1,14 @@
import { NgModule } from '@angular/core';
import { RouterModule, Routes } from '@angular/router';
import { PagesComponent } from './pages.component';
const routes: Routes = [{
path: '',
component: PagesComponent,
}];
@NgModule({
imports: [RouterModule.forChild(routes)],
exports: [RouterModule]
})
export class PagesRoutingModule { }

View File

@ -0,0 +1,84 @@
<div fxLayout="column" fxLayoutAlign="space-evenly center" fxLayoutGap="1em" class="container">
<h1>Public IPFS Cacher</h1>
<!-- IPFS -->
<form fxLayout="row" fxLayoutAlign="space-evenly center" fxLayoutGap="1em">
<!-- Hash -->
<mat-form-field>
<mat-label>IPFS</mat-label>
<input matInput [(ngModel)]="ipfs" name="ipfs">
</mat-form-field>
<!-- Cache -->
<button mat-flat-button color="primary" type="button" (click)="cacheIPFS()">Cache</button>
</form>
<!-- IPNS -->
<form fxLayout="row" fxLayoutAlign="space-evenly center" fxLayoutGap="1em">
<!-- Hash -->
<mat-form-field>
<mat-label>IPNS</mat-label>
<input matInput [(ngModel)]="ipns" name="ipns">
</mat-form-field>
<!-- Cache -->
<button mat-flat-button color="primary" type="button" (click)="cacheIPNS()">Cache</button>
</form>
<mat-progress-bar *ngIf="subscriptions.length" mode="determinate" [value]="dataSource.data.length / gateways.length * 100">
</mat-progress-bar>
<table mat-table [dataSource]="dataSource" class="mat-elevation-z8">
<!-- Result Column -->
<ng-container matColumnDef="error">
<th mat-header-cell *matHeaderCellDef> Status </th>
<td mat-cell *matCellDef="let element">
<div [ngSwitch]="element.error">
<div *ngSwitchCase="null"></div>
<div *ngSwitchDefault [matTooltip]="element.error.statusText"></div>
</div>
</td>
</ng-container>
<!-- Gateway Column -->
<ng-container matColumnDef="gateway">
<th mat-header-cell *matHeaderCellDef> Gateway </th>
<td mat-cell *matCellDef="let element">
<div [ngSwitch]="element.error">
<div *ngSwitchCase="null">
<strong><a href="{{ element.gateway }}#x-ipfs-companion-no-redirect" class="aqua"> {{ element.gateway }} </a></strong>
</div>
<div *ngSwitchDefault>
<a href="{{ element.gateway }}#x-ipfs-companion-no-redirect" class="aqua-muted"> {{ element.gateway }} </a>
</div>
</div>
</td>
</ng-container>
<tr mat-header-row *matHeaderRowDef="displayedColumns"></tr>
<tr mat-row *matRowDef="let row; columns: displayedColumns;"></tr>
</table>
<!-- About -->
<div fxLayout="column" fxLayoutAlign="space-evenly start" fxLayoutGap="1em">
<h3>About</h3>
<p>
This allows you to cache a specific IPFS hash to a bunch of public gateways.
It's inspired from <a href="https://github.com/ipfs/public-gateway-checker">github.com/ipfs/public-gateway-checker</a>.
The source code is available at <a
href="https://gitlab.com/NatoBoram/public-gateway-cacher">gitlab.com/NatoBoram/public-gateway-cacher</a>.
</p>
<p>
If you'd like to add a new public gateway,
please go to <a href="https://github.com/ipfs/public-gateway-checker">github.com/ipfs/public-gateway-checker</a>,
submit a pull request then open an issue <a href="https://gitlab.com/NatoBoram/public-gateway-cacher/issues/new">here</a>.
</p>
</div>
</div>

View File

@ -0,0 +1,27 @@
.mat-form-field {
width: 30em;
max-width: 100%;
}
.mat-table {
width: 100%;
}
.mat-progress-bar {
width: 100%;
}
.mat-header-cell {
padding: 1em;
}
.mat-column-error {
text-align: center;
width: 5em;
max-width: 100%;
}
.mat-column-gateway {
width: 50em;
max-width: 100%;
}

View File

@ -0,0 +1,24 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { PagesComponent } from './pages.component';
describe('PagesComponent', () => {
let component: PagesComponent;
let fixture: ComponentFixture<PagesComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [PagesComponent]
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(PagesComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});

View File

@ -0,0 +1,75 @@
import { HttpErrorResponse } from '@angular/common/http';
import { Component, OnInit, ViewChild } from '@angular/core';
import { MatTable, MatTableDataSource } from '@angular/material/table';
import { Subscription } from 'rxjs';
import { GatewayService } from '../services/gateway.service';
@Component({
selector: 'app-pages',
templateUrl: './pages.component.html',
styleUrls: ['./pages.component.scss']
})
export class PagesComponent implements OnInit {
gateways: string[];
ipfs: string;
ipns: string;
dataSource: MatTableDataSource<Result>;
displayedColumns = [
'error',
'gateway',
];
subscriptions: Subscription[] = [];
@ViewChild(MatTable, { static: false }) matTable: MatTable<Result>;
constructor(
private readonly gatewayService: GatewayService
) { }
ngOnInit(): void {
this.dataSource = new MatTableDataSource([]);
this.gatewayService.list().subscribe(gateways => this.gateways = gateways);
}
cacheIPFS(): void {
this.cache('ipfs', this.ipfs);
}
cacheIPNS(): void {
this.cache('ipns', this.ipns);
}
cache(type: string, hash: string): void {
while (this.subscriptions.length) {
const sub = this.subscriptions.pop();
if (!sub.closed) {
sub.unsubscribe();
}
}
this.dataSource.data = [];
this.matTable.renderRows();
console.clear();
this.gateways.forEach(gateway => {
this.subscriptions.push(
this.gatewayService.get(gateway, type, hash).subscribe(_ => {
this.dataSource.data.push({ gateway: `${gateway.replace(':type', type).replace(':hash', hash)}`, error: null });
this.matTable.renderRows();
}, (error: HttpErrorResponse) => {
this.dataSource.data.push({ gateway: `${gateway.replace(':type', type).replace(':hash', hash)}`, error });
this.matTable.renderRows();
})
);
});
}
}
interface Result {
gateway: string;
error: HttpErrorResponse;
}

View File

@ -0,0 +1,29 @@
import { CommonModule } from '@angular/common';
import { NgModule } from '@angular/core';
import { FlexLayoutModule } from '@angular/flex-layout';
import { FormsModule } from '@angular/forms';
import { MatButtonModule } from '@angular/material/button';
import { MatInputModule } from '@angular/material/input';
import { MatProgressBarModule } from '@angular/material/progress-bar';
import { MatSortModule } from '@angular/material/sort';
import { MatTableModule } from '@angular/material/table';
import { MatTooltipModule } from '@angular/material/tooltip';
import { PagesRoutingModule } from './pages-routing.module';
import { PagesComponent } from './pages.component';
@NgModule({
declarations: [PagesComponent],
imports: [
CommonModule,
FlexLayoutModule,
FormsModule,
MatButtonModule,
MatInputModule,
MatProgressBarModule,
MatSortModule,
MatTableModule,
MatTooltipModule,
PagesRoutingModule,
]
})
export class PagesModule { }

View File

@ -0,0 +1,12 @@
import { TestBed } from '@angular/core/testing';
import { GatewayService } from './gateway.service';
describe('GatewayService', () => {
beforeEach(() => TestBed.configureTestingModule({}));
it('should be created', () => {
const service: GatewayService = TestBed.get(GatewayService);
expect(service).toBeTruthy();
});
});

View File

@ -0,0 +1,29 @@
import { HttpClient } from '@angular/common/http';
import { Injectable } from '@angular/core';
import { Observable } from 'rxjs';
import { environment } from '../../environments/environment';
@Injectable({
providedIn: 'root'
})
export class GatewayService {
constructor(
private readonly http: HttpClient
) { }
list(): Observable<string[]> {
return this.http.get<string[]>(
environment.base_href && environment.base_href !== '/'
? `${environment.base_href}/assets/json/gateways.json`
: `${document.querySelector('base').href}/assets/json/gateways.json`
);
}
get(gateway: string, type: string, hash: string): Observable<Blob> {
return this.http.get<Blob>(`${gateway.replace(':type', type).replace(':hash', hash)}#x-ipfs-companion-no-redirect`, {
responseType: 'blob' as 'json'
});
}
}

0
src/assets/.gitkeep Normal file
View File

View File

@ -0,0 +1,39 @@
[
"https://ipfs.io/:type/:hash",
"https://gateway.ipfs.io/:type/:hash",
"https://ipfs.infura.io/:type/:hash",
"https://rx14.co.uk/:type/:hash",
"https://ninetailed.ninja/:type/:hash",
"https://ipfs.globalupload.io/:hash",
"https://ipfs.jes.xxx/:type/:hash",
"https://siderus.io/:type/:hash",
"https://eu.siderus.io/:type/:hash",
"https://na.siderus.io/:type/:hash",
"https://ap.siderus.io/:type/:hash",
"https://10.via0.com/:type/:hash",
"https://ipfs.eternum.io/:type/:hash",
"https://hardbin.com/:type/:hash",
"https://ipfs.wa.hle.rs/:type/:hash",
"https://gateway.blocksec.com/:type/:hash",
"https://ipfs.renehsz.com/:type/:hash",
"https://cloudflare-ipfs.com/:type/:hash",
"https://ipns.co/:hash",
"https://ipfs.mrh.io/:type/:hash",
"https://gateway.originprotocol.com/:type/:hash",
"https://gateway.pinata.cloud/:type/:hash",
"https://ipfs.doolta.com/:type/:hash",
"https://ipfs.sloppyta.co/:type/:hash",
"https://ipfs.busy.org/:type/:hash",
"https://ipfs.greyh.at/:type/:hash",
"https://gateway.serph.network/:type/:hash",
"https://jorropo.ovh/:type/:hash",
"https://gateway.temporal.cloud/:type/:hash",
"https://ipfs.fooock.com/:type/:hash",
"https://cdn.cwinfo.net/:type/:hash",
"https://ipfs.privacytools.io/:type/:hash",
"https://ipfs.jeroendeneef.com/:type/:hash",
"https://permaweb.io/:type/:hash",
"https://ipfs.stibarc.gq/:type/:hash",
"https://ipfs.best-practice.se/:type/:hash",
"https://lineageos-on-ipfs.com/:type/:hash"
]

View File

@ -0,0 +1,7 @@
import { Environment } from '../app/interfaces/environment';
export const environment: Environment = {
production: true,
base_href: '/public-gateway-cacher',
useHash: false,
};

View File

@ -0,0 +1,6 @@
import { Environment } from '../app/interfaces/environment';
export const environment: Environment = {
production: true,
useHash: true,
};

View File

@ -0,0 +1,7 @@
import { Environment } from '../app/interfaces/environment';
export const environment: Environment = {
production: true,
base_href: '/',
useHash: false,
};

View File

@ -0,0 +1,20 @@
import { Environment } from '../app/interfaces/environment';
// This file can be replaced during build by using the `fileReplacements` array.
// `ng build --prod` replaces `environment.ts` with `environment.prod.ts`.
// The list of file replacements can be found in `angular.json`.
export const environment: Environment = {
production: false,
base_href: '/',
useHash: false,
};
/*
* For easier debugging in development mode, you can import the following file
* to ignore zone related error stack frames such as `zone.run`, `zoneDelegate.invokeTask`.
*
* This import should be commented out in production mode because it will have a negative impact
* on performance if an error is thrown.
*/
// import 'zone.js/dist/zone-error'; // Included with Angular CLI.

View File

Before

Width:  |  Height:  |  Size: 99 KiB

After

Width:  |  Height:  |  Size: 99 KiB

29
src/index.html Normal file
View File

@ -0,0 +1,29 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Public Gateway Cacher</title>
<!-- IPFS -->
<script>
if (document.getElementsByTagName('base').length === 0) document.write('<base href="' + window.location.pathname + '"/>');
</script>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="icon" type="image/x-icon" href="favicon.png">
<!-- Material -->
<link href="https://fonts.googleapis.com/css?family=Roboto:300,400,500&display=swap" rel="stylesheet">
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
<!-- IPFS-CSS -->
<link href="assets/ipfs-css/ipfs.css" rel="stylesheet">
</head>
<body>
<app-root></app-root>
</body>
</html>

12
src/main.ts Normal file
View File

@ -0,0 +1,12 @@
import { enableProdMode } from '@angular/core';
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
import 'hammerjs';
import { AppModule } from './app/app.module';
import { environment } from './environments/environment';
if (environment.production) {
enableProdMode();
}
platformBrowserDynamic().bootstrapModule(AppModule)
.catch(err => console.error(err));

63
src/polyfills.ts Normal file
View File

@ -0,0 +1,63 @@
/**
* This file includes polyfills needed by Angular and is loaded before the app.
* You can add your own extra polyfills to this file.
*
* This file is divided into 2 sections:
* 1. Browser polyfills. These are applied before loading ZoneJS and are sorted by browsers.
* 2. Application imports. Files imported after ZoneJS that should be loaded before your main
* file.
*
* The current setup is for so-called "evergreen" browsers; the last versions of browsers that
* automatically update themselves. This includes Safari >= 10, Chrome >= 55 (including Opera),
* Edge >= 13 on the desktop, and iOS 10 and Chrome on mobile.
*
* Learn more in https://angular.io/guide/browser-support
*/
/***************************************************************************************************
* BROWSER POLYFILLS
*/
/** IE10 and IE11 requires the following for NgClass support on SVG elements */
// import 'classlist.js'; // Run `npm install --save classlist.js`.
/**
* Web Animations `@angular/platform-browser/animations`
* Only required if AnimationBuilder is used within the application and using IE/Edge or Safari.
* Standard animation support in Angular DOES NOT require any polyfills (as of Angular 6.0).
*/
// import 'web-animations-js'; // Run `npm install --save web-animations-js`.
/**
* By default, zone.js will patch all possible macroTask and DomEvents
* user can disable parts of macroTask/DomEvents patch by setting following flags
* because those flags need to be set before `zone.js` being loaded, and webpack
* will put import in the top of bundle, so user need to create a separate file
* in this directory (for example: zone-flags.ts), and put the following flags
* into that file, and then add the following code before importing zone.js.
* import './zone-flags.ts';
*
* The flags allowed in zone-flags.ts are listed here.
*
* The following flags will work for all browsers.
*
* (window as any).__Zone_disable_requestAnimationFrame = true; // disable patch requestAnimationFrame
* (window as any).__Zone_disable_on_property = true; // disable patch onProperty such as onclick
* (window as any).__zone_symbol__UNPATCHED_EVENTS = ['scroll', 'mousemove']; // disable patch specified eventNames
*
* in IE/Edge developer tools, the addEventListener will also be wrapped by zone.js
* with the following flag, it will bypass `zone.js` patch for IE/Edge
*
* (window as any).__Zone_enable_cross_context_check = true;
*
*/
/***************************************************************************************************
* Zone JS is required by default for Angular itself.
*/
import 'zone.js/dist/zone'; // Included with Angular CLI.
/***************************************************************************************************
* APPLICATION IMPORTS
*/

40
src/styles.scss Normal file
View File

@ -0,0 +1,40 @@
// Custom Theming for Angular Material
// For more information: https://material.angular.io/guide/theming
@import '~@angular/material/theming';
// Plus imports for other components in your app.
// Include the common styles for Angular Material. We include this here so that you only
// have to load a single css file for Angular Material in your app.
// Be sure that you only ever include this mixin once!
@include mat-core();
// Define the palettes for your theme using the Material Design palettes available in palette.scss
// (imported above). For each palette, you can optionally specify a default, lighter, and darker
// hue. Available color palettes: https://material.io/design/color/
$public-gateway-cacher-primary: mat-palette($mat-indigo);
$public-gateway-cacher-accent: mat-palette($mat-pink, A200, A100, A400);
// The warn palette is optional (defaults to red).
$public-gateway-cacher-warn: mat-palette($mat-red);
// Create the theme object (a Sass map containing all of the palettes).
$public-gateway-cacher-theme: mat-light-theme($public-gateway-cacher-primary, $public-gateway-cacher-accent, $public-gateway-cacher-warn);
// Include theme styles for core and each component used in your app.
// Alternatively, you can import and @include the theme mixins for each component
// that you are using.
@include angular-material-theme($public-gateway-cacher-theme);
/* You can add global styles to this file, and also import other style files */
html,
body {
height: 100%;
}
body {
margin: 0;
font-family: Roboto, "Helvetica Neue", sans-serif;
}
@import '~bootstrap/scss/bootstrap-grid.scss';

20
src/test.ts Normal file
View File

@ -0,0 +1,20 @@
// This file is required by karma.conf.js and loads recursively all the .spec and framework files
import 'zone.js/dist/zone-testing';
import { getTestBed } from '@angular/core/testing';
import {
BrowserDynamicTestingModule,
platformBrowserDynamicTesting
} from '@angular/platform-browser-dynamic/testing';
declare const require: any;
// First, initialize the Angular testing environment.
getTestBed().initTestEnvironment(
BrowserDynamicTestingModule,
platformBrowserDynamicTesting()
);
// Then we find all the tests.
const context = require.context('./', true, /\.spec\.ts$/);
// And load the modules.
context.keys().map(context);

17
tsconfig.app.json Normal file
View File

@ -0,0 +1,17 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"outDir": "./out-tsc/app",
"types": []
},
"files": [
"src/main.ts",
"src/polyfills.ts"
],
"include": [
"src/**/*.d.ts"
],
"angularCompilerOptions": {
"enableIvy": false
}
}

26
tsconfig.json Normal file
View File

@ -0,0 +1,26 @@
{
"compileOnSave": false,
"compilerOptions": {
"baseUrl": "./",
"outDir": "./dist/out-tsc",
"sourceMap": true,
"declaration": false,
"downlevelIteration": true,
"experimentalDecorators": true,
"module": "esnext",
"moduleResolution": "node",
"importHelpers": true,
"target": "es2015",
"typeRoots": [
"node_modules/@types"
],
"lib": [
"es2018",
"dom"
]
},
"angularCompilerOptions": {
"fullTemplateTypeCheck": true,
"strictInjectionParameters": true
}
}

21
tsconfig.spec.json Normal file
View File

@ -0,0 +1,21 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"outDir": "./out-tsc/spec",
"types": [
"jasmine",
"node"
]
},
"files": [
"src/test.ts",
"src/polyfills.ts"
],
"include": [
"src/**/*.spec.ts",
"src/**/*.d.ts"
],
"angularCompilerOptions": {
"enableIvy": false
}
}

279
tslint.json Normal file
View File

@ -0,0 +1,279 @@
{
"extends": [
"tslint:recommended",
"rxjs-tslint-rules"
],
"rules": {
"array-type": false,
"arrow-parens": false,
"deprecation": {
"severity": "warning"
},
"component-class-suffix": true,
"contextual-lifecycle": true,
"directive-class-suffix": true,
"directive-selector": [
true,
"attribute",
"app",
"camelCase"
],
"component-selector": [
true,
"element",
"app",
"kebab-case"
],
"import-blacklist": [
true,
"rxjs/Rx"
],
"interface-name": false,
"max-classes-per-file": false,
"max-line-length": [
true,
{
"limit": 140,
"ignore-pattern": "^import |^export {(.*?)}|class [a-zA-Z]+ implements |// "
}
],
"member-access": false,
"member-ordering": [
true,
{
"order": [
"public-static-field",
"private-static-field",
"public-instance-field",
"private-instance-field",
"public-constructor",
"private-constructor",
"public-instance-method",
"protected-instance-method",
"private-instance-method",
"public-static-method",
"protected-static-method",
"private-static-method"
]
}
],
"no-consecutive-blank-lines": [
true,
1
],
"no-console": [
true,
"debug",
"info",
"time",
"timeEnd",
"trace"
],
"no-empty": [
true,
"allow-empty-functions"
],
"no-inferrable-types": [
true,
"ignore-params"
],
"no-non-null-assertion": true,
"no-redundant-jsdoc": true,
"no-switch-case-fall-through": true,
"no-use-before-declare": true,
"no-var-requires": false,
"object-literal-key-quotes": [
true,
"as-needed"
],
"object-literal-sort-keys": false,
"ordered-imports": false,
"quotemark": [
true,
"single"
],
"no-conflicting-lifecycle": true,
"no-host-metadata-property": true,
"no-input-rename": true,
"no-inputs-metadata-property": true,
"no-output-native": true,
"no-output-on-prefix": true,
"no-output-rename": true,
"no-outputs-metadata-property": true,
"template-banana-in-box": true,
"template-no-negated-async": true,
"use-lifecycle-interface": true,
"use-pipe-transform-interface": true,
"origin-ordered-imports": [
true
],
"rx-subject-restrictions": true,
"ban-types": [
true,
[
"Object",
"Use {} instead."
],
[
"String"
]
],
"no-unnecessary-class": [
true,
"allow-constructor-only",
"allow-static-only",
"allow-empty-class"
],
"no-for-in-array": true,
"typedef": [
true,
"call-signature",
"property-declaration",
"object-destructuring",
"arrow-call-signature"
],
"no-unused": true,
"no-return-undefined": true,
"no-collapsible-if": true,
"arrow-return-shorthand": [
true,
"multiline"
],
"no-static-this": true,
"template-use-track-by-function": true,
"prefer-template": true,
"contextual-decorator": false,
"no-pipe-impure": true,
"component-max-inline-declarations": true,
"no-attribute-decorator": true,
"no-forward-ref": true,
"no-lifecycle-call": true,
"template-no-call-expression": true,
"no-unused-css": true,
"prefer-output-readonly": true,
"template-conditional-complexity": true,
"use-pipe-decorator": true,
"use-component-view-encapsulation": true,
"no-queries-metadata-property": true,
"prefer-inline-decorator": false,
"import-destructuring-spacing": true,
"newline-before-return": false,
"no-trailing-whitespace": true,
"space-within-parens": true,
"space-before-function-paren": [
true,
{
"anonymous": "never",
"named": "never",
"asyncArrow": "always",
"method": "never",
"constructor": "never"
}
],
"max-file-line-count": [
true,
400
],
"cyclomatic-complexity": [
true,
20
],
"encoding": true,
"no-unsafe-finally": true,
"no-duplicate-switch-case": true,
"increment-decrement": [
true,
"allow-post"
],
"triple-equals": [
true,
"allow-null-check"
],
"no-invalid-template-strings": true,
"no-unnecessary-type-assertion": true,
"callable-types": true,
"no-reference": true,
"no-default-import": true,
"no-default-export": true,
"no-require-imports": true,
"no-duplicate-imports": true,
"no-import-side-effect": [
true,
{
"ignore-module": "(hammerjs|core-js|zone.js)"
}
],
"no-implicit-dependencies": [
true,
"dev"
],
"no-unnecessary-initializer": true,
"no-var-keyword": true,
"prefer-const": true,
"no-return-await": true,
"no-unnecessary-callback-wrapper": true,
"no-arg": true,
"eofline": true,
"no-tautology-expression": true,
"use-isnan": true,
"restrict-plus-operands": true,
"no-this-assignment": true,
"no-invalid-this": [
true,
"check-function-in-method"
],
"no-unbound-method": true,
"prefer-readonly": true,
"radix": false,
"no-misused-new": true,
"no-duplicate-super": true,
"rxjs-no-compat": true,
"rxjs-no-internal": true,
"unnecessary-else": [
true,
{
"allow-else-if": true
}
],
"no-any": [
true,
{
"ignore-rest-args": true
}
],
"variable-name": {
"options": [
"ban-keywords",
"check-format",
"allow-leading-underscore",
"allow-pascal-case"
]
},
"trailing-comma": [
true,
{
"multiline": {
"objects": "ignore",
"arrays": "ignore",
"functions": "never",
"typeLiterals": "ignore"
},
"esSpecCompliant": true
}
]
},
"rulesDirectory": [
"codelyzer",
"node_modules/tslint-origin-ordered-imports-rule/dist",
"node_modules/tslint-rxjs-subject-restrictions-rule/dist",
"node_modules/tslint-consistent-codestyle/rules"
],
"linterOptions": {
"exclude": [
"**/*-routing.module.ts",
"src/polyfills.ts",
"src/test.ts",
"**/*.po.ts"
]
}
}

8135
yarn.lock Normal file

File diff suppressed because it is too large Load Diff