feat(app/web): bypass metrics.api.github.overuse with OAuth (#1171)
This commit is contained in:
98
source/app/web/statics/oauth/index.html
Normal file
98
source/app/web/statics/oauth/index.html
Normal file
@@ -0,0 +1,98 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Metrics</title>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<meta name="description" content="An image generator with 20+ metrics about your GitHub account such as activity, community, repositories, coding habits, website performances, music played, starred topics, etc. that you can put on your profile or elsewhere !">
|
||||
<meta name="author" content="lowlighter">
|
||||
<meta property="og:image" content="/.opengraph.png">
|
||||
<link rel="icon" href="/.favicon.png">
|
||||
<link rel="stylesheet" href="/.css/style.vars.css?v=3.27">
|
||||
<link rel="stylesheet" href="/.css/style.css?v=3.27">
|
||||
<link rel="stylesheet" href="/insights/.statics/style.css?v=3.27">
|
||||
</head>
|
||||
<body>
|
||||
<!-- Vue app -->
|
||||
<main :class="[palette]">
|
||||
<template>
|
||||
|
||||
<header :class="{beta}">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.013 8.013 0 0016 8c0-4.42-3.58-8-8-8z"></path></svg>
|
||||
<a href="/">Metrics Insights {{ version }}</a>
|
||||
</header>
|
||||
|
||||
<section class="container center">
|
||||
<div class="badges-oauth">
|
||||
<div class="badge-oauth">
|
||||
<img width="50" height="50" src="https://avatars.githubusercontent.com/oa/1961997?s=100&u=04310528dae43e631c6b4609aa352cc535d65aac&v=4" alt="">
|
||||
</div>
|
||||
<div class="border"></div>
|
||||
<div style="border-radius: 50%; width:32px; height:32px; background-color: var(--color-label-success-text)">
|
||||
<svg height="16" width="16" viewBox="0 0 16 16" version="1.1" style="margin: 8px">
|
||||
<path fill="#fff" fill-rule="evenodd" d="M13.78 4.22a.75.75 0 010 1.06l-7.25 7.25a.75.75 0 01-1.06 0L2.22 9.28a.75.75 0 011.06-1.06L6 10.94l6.72-6.72a.75.75 0 011.06 0z"></path>
|
||||
</svg>
|
||||
</div>
|
||||
<div class="border"></div>
|
||||
<div class="badge-oauth">
|
||||
<svg height="100%" width="100%" viewBox="0 0 16 16" version="1.1">
|
||||
<path fill="var(--color-text-primary)" fill-rule="evenodd" d="M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.013 8.013 0 0016 8c0-4.42-3.58-8-8-8z"></path>
|
||||
</svg>
|
||||
</div>
|
||||
</div>
|
||||
<p>
|
||||
Signing in with your GitHub account lets you use this web instance with your own API requests quota.
|
||||
</p>
|
||||
<template v-if="extras.length">
|
||||
The following extra features permissions will be granted when logged with your GitHub account:
|
||||
<ul>
|
||||
<li v-for="extra in extras"><code>{{ extra }}</code></li>
|
||||
</ul>
|
||||
</template>
|
||||
</section>
|
||||
|
||||
<template>
|
||||
<section class="container center oauth">
|
||||
<template v-if="!requests.login">
|
||||
<a class="oauth-github" :href="`/.oauth/authenticate?${params}`">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16"><path fill="currentColor" fill-rule="evenodd" d="M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.013 8.013 0 0016 8c0-4.42-3.58-8-8-8z"></path></svg>
|
||||
Sign in with GitHub
|
||||
</a>
|
||||
<div class="oauth-scopes">
|
||||
<label v-for="scope in ['read:org', 'read:user', 'read:packages']">
|
||||
<input type="checkbox" :value="scope" v-model="scopes"> <code>{{ scope }}</code>
|
||||
</label>
|
||||
</div>
|
||||
<small>
|
||||
While no scope is required, you can chose to grant additional scopes which may be required by some plugins options.
|
||||
For security reasons, <a href="https://github.com/lowlighter/metrics">metrics</a> will only ask for <b>read-only access</b> to your account.
|
||||
</small>
|
||||
</template>
|
||||
<template v-else>
|
||||
<a class="oauth-github disabled" href="#">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16"><path fill="currentColor" fill-rule="evenodd" d="M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.013 8.013 0 0016 8c0-4.42-3.58-8-8-8z"></path></svg>
|
||||
Signed in as {{ requests.login }}
|
||||
</a>
|
||||
<a :href="`/.oauth/revoke/${session}`">
|
||||
<button class="oauth-revoke">Revoke authorization</button>
|
||||
</a>
|
||||
</template>
|
||||
</section>
|
||||
</template>
|
||||
|
||||
<footer>
|
||||
<a href="https://github.com/lowlighter/metrics">Repository</a>
|
||||
<a href="https://github.com/lowlighter/metrics/blob/master/LICENSE">License</a>
|
||||
<a href="https://github.com/marketplace/actions/metrics-embed">GitHub Action</a>
|
||||
<span v-if="hosted">Hosted with ❤️ by <a :href="hosted.link">{{ hosted.by }}</a></span>
|
||||
</footer>
|
||||
|
||||
</template>
|
||||
</main>
|
||||
|
||||
<!-- Scripts -->
|
||||
<script src="/.js/axios.min.js"></script>
|
||||
<script src="/.js/vue.min.js"></script>
|
||||
<script src="/.oauth/script.js?v=3.27"></script>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user