├── _config.yml ├── tsconfig.json ├── src ├── withexpress.ts ├── index.html ├── helper │ ├── getRandomToken.ts │ ├── repositoryFetch.ts │ ├── getData.ts │ ├── basicFetch.ts │ └── template.ts └── api │ └── index.ts ├── scripts └── createDynamicIndexHtml.js ├── package.json ├── README.md ├── .gitignore └── LICENSE /_config.yml: -------------------------------------------------------------------------------- 1 | theme: jekyll-theme-minimal -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "es6", 4 | "module": "commonjs", 5 | "outDir": "./dist", 6 | "rootDir": "./src", 7 | "strict": true, 8 | "moduleResolution": "node", 9 | "esModuleInterop": true 10 | }, 11 | "exclude": ["./node_modules"] 12 | } 13 | -------------------------------------------------------------------------------- /src/withexpress.ts: -------------------------------------------------------------------------------- 1 | import express from "express"; 2 | const app = express(); 3 | import readmeStats from "./api/index"; 4 | 5 | app.use("/api", readmeStats); 6 | 7 | const port: number = Number(process.env.PORT) || 3000; 8 | 9 | app.listen(port, () => { 10 | console.log(`Running on http://localhost:${port}`); 11 | }); 12 | -------------------------------------------------------------------------------- /src/index.html: -------------------------------------------------------------------------------- 1 | 2 | Readme Stats for Github 3 | 4 | 5 | 6 | 7 | 11 | 12 | 13 | 14 | 15 | Redirecting to main website... 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /src/helper/getRandomToken.ts: -------------------------------------------------------------------------------- 1 | require("dotenv").config(); 2 | 3 | function getRandomToken(bearerHeader: boolean): string { 4 | let getEnvs: any = process.env; 5 | let getGhEnv: any = Object.keys(getEnvs).filter((key) => 6 | key.startsWith("GH_") 7 | ); 8 | getGhEnv = getGhEnv.map((key: string) => getEnvs[key]); 9 | let getRandomEnv: string = 10 | getGhEnv[Math.floor(Math.random() * getGhEnv.length)]; 11 | 12 | if (bearerHeader) { 13 | return `Bearer ${getRandomEnv}`; 14 | } 15 | return getRandomEnv; 16 | } 17 | 18 | export default getRandomToken; 19 | -------------------------------------------------------------------------------- /scripts/createDynamicIndexHtml.js: -------------------------------------------------------------------------------- 1 | // const fs = require("fs"); 2 | // const Markdoc = require("@markdoc/markdoc"); 3 | // const readmeMd = fs.readFileSync("./README.md", "utf8"); 4 | 5 | // const ast = Markdoc.parse(readmeMd); 6 | // const content = Markdoc.transform(ast); 7 | // const markdownhtml = Markdoc.renderers.html(content); 8 | 9 | // const html = ` 10 | // 11 | // 12 | // 13 | // 14 | // 15 | // Readme Stats Github 16 | // 22 | // 23 | // 24 | //
${markdownhtml}
25 | // 26 | // 27 | // `; 28 | 29 | // fs.writeFileSync("./src/index.html", html); 30 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "readme-stats-github", 3 | "version": "1.1.0", 4 | "description": "Generate your GitHub's Stats in SVG", 5 | "main": "src/api/withexpress.ts", 6 | "dependencies": { 7 | "axios": "^0.21.0", 8 | "dotenv": "^16.0.1", 9 | "express": "^4.18.1", 10 | "millify": "^4.0.0", 11 | "node-base64-image": "^2.0.1" 12 | }, 13 | "scripts": { 14 | "dev": "nodemon ./src/withexpress.ts", 15 | "build": "tsc", 16 | "start": "node ./dist/withexpress.js" 17 | }, 18 | "author": "Tuhin Kanti Pal", 19 | "license": "Apache-2.0", 20 | "repository": { 21 | "type": "git", 22 | "url": "git+https://github.com/tuhinpal/readme-stats-github.git" 23 | }, 24 | "keywords": [ 25 | "github-readme-stats", 26 | "github-stats" 27 | ], 28 | "bugs": { 29 | "url": "https://github.com/tuhinpal/readme-stats-github/issues" 30 | }, 31 | "homepage": "https://github.com/tuhinpal/readme-stats-github#readme", 32 | "devDependencies": { 33 | "@markdoc/markdoc": "^0.1.3", 34 | "@types/express": "^4.17.13", 35 | "@types/node": "^18.0.3", 36 | "nodemon": "^2.0.19", 37 | "ts-node": "^10.8.2", 38 | "typescript": "^4.7.4" 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /src/api/index.ts: -------------------------------------------------------------------------------- 1 | import getData from "../helper/getData"; 2 | import template from "../helper/template"; 3 | 4 | export type UiConfig = { 5 | text_color: string; 6 | icon_color: string; 7 | border_color: string; 8 | card_color: string; 9 | }; 10 | 11 | export default async function readmeStats(req: any, res: any): Promise { 12 | try { 13 | let username = req.query.username; 14 | 15 | let uiConfig: UiConfig = { 16 | text_color: req.query.tc || "000", 17 | icon_color: req.query.ic || "FF0000", 18 | border_color: req.query.bc || "7e7979", 19 | card_color: req.query.cc || "fff", 20 | }; 21 | 22 | if (!username) throw new Error("Username is required"); 23 | 24 | var fetchStats = await getData(username); 25 | res.setHeader("Cache-Control", "s-maxage=1800, stale-while-revalidate"); 26 | 27 | if (req.query.format === "json") { 28 | res.json(fetchStats); 29 | } else { 30 | res.setHeader("Content-Type", "image/svg+xml"); 31 | let svg = template(fetchStats, uiConfig); 32 | res.send(svg); 33 | } 34 | } catch (error: any) { 35 | res.setHeader("Cache-Control", "s-maxage=3600, stale-while-revalidate"); 36 | res.status(500).send(error.message); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/helper/repositoryFetch.ts: -------------------------------------------------------------------------------- 1 | import axios from "axios"; 2 | import getRandomToken from "./getRandomToken"; 3 | 4 | type RepositoryData = { 5 | stars: number; 6 | forks: number; 7 | openedIssues: number; 8 | }; 9 | 10 | export default async function repositoryFetch( 11 | username: string, 12 | totalpage: number 13 | ): Promise { 14 | let stars = 0; 15 | let forks = 0; 16 | let openedIssues = 0; 17 | 18 | await Promise.all( 19 | Array.from( 20 | { length: totalpage }, 21 | async (_, i) => await getPerPageReposData(username, i + 1) 22 | ) 23 | ).then((data: any) => { 24 | data.forEach((repo: any) => { 25 | stars += repo.stars; 26 | forks += repo.forks; 27 | openedIssues += repo.openedIssues; 28 | }); 29 | }); 30 | 31 | return { 32 | stars, 33 | forks, 34 | openedIssues, 35 | }; 36 | } 37 | 38 | async function getPerPageReposData( 39 | username: string, 40 | pageno: number 41 | ): Promise { 42 | let data = await axios({ 43 | method: "get", 44 | url: `https://api.github.com/users/${username}/repos?page=${pageno}&per_page=100`, 45 | headers: { 46 | "User-Agent": "tuhinpal/readme-stats-github", 47 | Authorization: getRandomToken(true), 48 | }, 49 | }); 50 | 51 | let stars = 0; 52 | let forks = 0; 53 | let openedIssues = 0; 54 | 55 | data.data.forEach((repo: any) => { 56 | stars += repo.stargazers_count; 57 | forks += repo.forks_count; 58 | openedIssues += repo.open_issues; 59 | }); 60 | 61 | return { 62 | stars, 63 | forks, 64 | openedIssues, 65 | }; 66 | } 67 | -------------------------------------------------------------------------------- /src/helper/getData.ts: -------------------------------------------------------------------------------- 1 | import millify from "millify"; 2 | import basicFetch from "./basicFetch"; 3 | import repositoryFetch from "./repositoryFetch"; 4 | const base64ImageFetcher = require("node-base64-image"); 5 | 6 | export type GetData = { 7 | username: string; 8 | name: string; 9 | pic: string | Buffer; 10 | public_repos: string | number; 11 | followers: string | number; 12 | following: string | number; 13 | total_stars: string | number; 14 | total_forks: string | number; 15 | total_issues: string | number; 16 | total_closed_issues: string | number; 17 | total_contributions: string | number; 18 | }; 19 | 20 | async function getData(username: string): Promise { 21 | let user = await basicFetch(username); 22 | let totalRepoPages = Math.ceil(user.repositories.totalCount / 100); 23 | let userRepositories = await repositoryFetch(username, totalRepoPages); 24 | 25 | if (!user.name) user.name = user.login; 26 | 27 | let output = { 28 | username: user.login, 29 | name: user.name, 30 | pic: await base64ImageFetcher.encode(`${user.avatarUrl}&s=200`, { 31 | string: true, 32 | }), 33 | public_repos: millify(user.repositories.totalCount), 34 | followers: millify(user.followers.totalCount), 35 | following: millify(user.following.totalCount), 36 | total_stars: millify(userRepositories.stars), 37 | total_forks: millify(userRepositories.forks), 38 | total_issues: millify( 39 | user.openedIssues.totalCount + user.closedIssues.totalCount 40 | ), 41 | total_closed_issues: millify(user.closedIssues.totalCount), 42 | total_contributions: millify( 43 | user.contributionsCollection.restrictedContributionsCount + 44 | user.contributionsCollection.totalCommitContributions 45 | ), 46 | }; 47 | 48 | return output; 49 | } 50 | 51 | export default getData; 52 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Readme Stats for Github 📈 2 | 3 | 👀 Update: Whole project is rewritten with Typescript in 30 minutes on GitHub Codespaces. 💪 4 | 5 | ## Features 🪶 6 | 7 | - Totally accurate result 8 | - Refresh result in 1800 seconds 9 | - Support customization 10 | 11 | ## API 🚀 12 | 13 | 1. Cool and Simple 😃 14 | 15 | ``` 16 | https://github-stats-alpha.vercel.app/api?username={your-github-username} 17 | ``` 18 | 19 | [![Example](https://github-stats-alpha.vercel.app/api?username=tuhinpal "Example")](https://github-stats-alpha.vercel.app/api?username=tuhinpal "Example") 20 | 21 | 2. With Customization 😎 22 | 23 | ``` 24 | https://github-stats-alpha.vercel.app/api?username={your-github-username}&cc=000&tc=fff&ic=fff&bc=000 25 | 26 | Where cc = Card Color 27 | tc = Text Color 28 | ic = Icon Color 29 | bc = Border Color 30 | ``` 31 | 32 | [![Example](https://github-stats-alpha.vercel.app/api?username=tuhinpal&cc=000&tc=fff&ic=fff&bc=000 "Example")](https://github-stats-alpha.vercel.app/api?username=tuhinpal&cc=000&tc=fff&ic=fff&bc=000 "Example") 33 | 34 | ## Deploy your own 🦉 35 | 36 | - Fork this Repo 37 | - Go to [▲ Vercel](https://vercel.com) 38 | - Connect with your Forked Repo 39 | - Add your github token in Env Variables. Any variable starts with `GH_TOKEN` will be used randomly. 40 | - Change root directory to `src` 41 | - Deploy to fly high! 42 | 43 | ## Credits 🙏 44 | 45 | - Idea from [github-readme-stats](https://github.com/anuraghazra/github-readme-stats "github-readme-stats") by [Anurag Hazra](https://github.com/anuraghazra "Anurag Hazra") 46 | 47 | ## Contribution 💬 48 | 49 | Contributors are welcome. Please open an issue or pull request if you have any suggestions. 50 | 51 | ## License & Copyright 📝 52 | 53 | - This Project is [Apache-2.0](https://github.com/tuhinpal/readme-stats-github/blob/main/LICENSE) Licensed 54 | - Copyright 2021 by [Tuhin Kanti Pal](https://github.com/tuhinpal) 55 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Logs 2 | logs 3 | *.log 4 | npm-debug.log* 5 | yarn-debug.log* 6 | yarn-error.log* 7 | lerna-debug.log* 8 | 9 | # Diagnostic reports (https://nodejs.org/api/report.html) 10 | report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json 11 | 12 | # Runtime data 13 | pids 14 | *.pid 15 | *.seed 16 | *.pid.lock 17 | 18 | # Directory for instrumented libs generated by jscoverage/JSCover 19 | lib-cov 20 | 21 | # Coverage directory used by tools like istanbul 22 | coverage 23 | *.lcov 24 | 25 | # nyc test coverage 26 | .nyc_output 27 | 28 | # Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files) 29 | .grunt 30 | 31 | # Bower dependency directory (https://bower.io/) 32 | bower_components 33 | 34 | # node-waf configuration 35 | .lock-wscript 36 | 37 | # Compiled binary addons (https://nodejs.org/api/addons.html) 38 | build/Release 39 | 40 | # Dependency directories 41 | node_modules/ 42 | jspm_packages/ 43 | 44 | # TypeScript v1 declaration files 45 | typings/ 46 | 47 | # TypeScript cache 48 | *.tsbuildinfo 49 | 50 | # Optional npm cache directory 51 | .npm 52 | 53 | # Optional eslint cache 54 | .eslintcache 55 | 56 | # Microbundle cache 57 | .rpt2_cache/ 58 | .rts2_cache_cjs/ 59 | .rts2_cache_es/ 60 | .rts2_cache_umd/ 61 | 62 | # Optional REPL history 63 | .node_repl_history 64 | 65 | # Output of 'npm pack' 66 | *.tgz 67 | 68 | # Yarn Integrity file 69 | .yarn-integrity 70 | 71 | # dotenv environment variables file 72 | .env 73 | .env.test 74 | 75 | # parcel-bundler cache (https://parceljs.org/) 76 | .cache 77 | 78 | # Next.js build output 79 | .next 80 | 81 | # Nuxt.js build / generate output 82 | .nuxt 83 | dist 84 | 85 | # Gatsby files 86 | .cache/ 87 | # Comment in the public line in if your project uses Gatsby and *not* Next.js 88 | # https://nextjs.org/blog/next-9-1#public-directory-support 89 | # public 90 | 91 | # vuepress build output 92 | .vuepress/dist 93 | 94 | # Serverless directories 95 | .serverless/ 96 | 97 | # FuseBox cache 98 | .fusebox/ 99 | 100 | # DynamoDB Local files 101 | .dynamodb/ 102 | 103 | # TernJS port file 104 | .tern-port 105 | 106 | public 107 | public/* 108 | .vercel -------------------------------------------------------------------------------- /src/helper/basicFetch.ts: -------------------------------------------------------------------------------- 1 | import axios from "axios"; 2 | import getRandomToken from "./getRandomToken"; 3 | 4 | export interface User { 5 | name: string; 6 | login: string; 7 | avatarUrl: string; 8 | repositories: Repositories; 9 | followers: Followers; 10 | following: Following; 11 | contributionsCollection: ContributionsCollection; 12 | openedIssues: OpenedIssues; 13 | closedIssues: ClosedIssues; 14 | } 15 | 16 | export interface Repositories { 17 | totalCount: number; 18 | } 19 | 20 | export interface Followers { 21 | totalCount: number; 22 | } 23 | 24 | export interface Following { 25 | totalCount: number; 26 | } 27 | 28 | export interface ContributionsCollection { 29 | totalCommitContributions: number; 30 | restrictedContributionsCount: number; 31 | } 32 | 33 | export interface OpenedIssues { 34 | totalCount: number; 35 | } 36 | 37 | export interface ClosedIssues { 38 | totalCount: number; 39 | } 40 | 41 | export default async function basicFetch(username: string): Promise { 42 | let data = await axios({ 43 | method: "post", 44 | url: "https://api.github.com/graphql", 45 | headers: { 46 | "User-Agent": "tuhinpal/readme-stats-github", 47 | Authorization: getRandomToken(true), 48 | }, 49 | data: { 50 | query: `query userInfo($username: String!) { 51 | user(login: $username) { 52 | name 53 | login 54 | avatarUrl 55 | repositories(ownerAffiliations: OWNER, privacy: PUBLIC) { 56 | totalCount 57 | } 58 | followers { 59 | totalCount 60 | } 61 | following { 62 | totalCount 63 | } 64 | contributionsCollection { 65 | totalCommitContributions 66 | restrictedContributionsCount 67 | } 68 | openedIssues: issues(states: OPEN) { 69 | totalCount 70 | } 71 | closedIssues: issues(states: CLOSED) { 72 | totalCount 73 | } 74 | } 75 | }`, 76 | variables: { 77 | username, 78 | }, 79 | }, 80 | }); 81 | 82 | if (data.data.errors?.length > 0) 83 | throw new Error(data.data.errors[0].message); 84 | 85 | return data.data.data.user; 86 | } 87 | -------------------------------------------------------------------------------- /src/helper/template.ts: -------------------------------------------------------------------------------- 1 | import type { GetData } from "./getData"; 2 | import type { UiConfig } from "../api/index"; 3 | 4 | export default function template(data: GetData, uiConfig: UiConfig): string { 5 | var card = ` 6 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 76 | 77 | 78 | 79 | 80 | ${data.name} 81 | 82 | 84 | 85 | 86 | Followers: 87 | ${data.followers} 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 98 | 99 | 100 | Total Repo: 101 | ${data.public_repos} 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 111 | 112 | 113 | Star's Count: 114 | ${data.total_stars} 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 124 | 125 | 126 | Fork's Count: 127 | ${data.total_forks} 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 137 | 138 | 139 | Contributions: 140 | ${data.total_contributions} 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 151 | 152 | 153 | Total Issues: 154 | ${data.total_issues} 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 164 | 165 | 166 | Closed Issues: 167 | ${data.total_closed_issues} 168 | 169 | 170 | 171 | 172 | 173 | `; 174 | 175 | return card; 176 | } 177 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "[]" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright [yyyy] [name of copyright owner] 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | --------------------------------------------------------------------------------