-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathheader.html
More file actions
executable file
·116 lines (107 loc) · 6.21 KB
/
Copy pathheader.html
File metadata and controls
executable file
·116 lines (107 loc) · 6.21 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- 참고: https://jekyllrb.com/docs/liquid/filters/ -->
<title>{% if page.title %}{{ page.title }} - {{ site.title }}{% else %}{{ site.title }}{% endif %}</title>
<meta name="description" content="{{ page.summary }}">
<meta name="google-site-verification" content="mxO6AzmPlTTRgNKX9FZU6ai3e-83VpiyCLux3OCBl4Q" />
<link rel="stylesheet" href="{{ "/css/main.css" | prepend: site.baseurl }}">
<link rel="canonical" href="{{ page.url | replace:'index.html','' | prepend: site.baseurl | prepend: site.url }}">
<link rel="alternate" type="application/rss+xml" title="{{ site.title }}" href="{{ "/feed.xml" | prepend: site.baseurl | prepend: site.url }}" />
<meta property="og:type" content="website">
<meta property="og:title" content="{{ page.title }}">
<meta property="og:description" content="{{ page.summary }}">
<meta property="og:image" content="{{ site.url }}/resource/codingmatemoon.png">
<meta property="og:url" content="{{ site.url }}{{ page.url }}">
<meta name="twitter:card" content="summary" />
<meta name="twitter:site" content="@{{ site.twitter_username }}" />
<meta name="twitter:url" content="{{ site.url }}{{ page.url }}" />
<meta name="twitter:title" content="{{ page.title }}" />
<meta name="twitter:description" content="{{ page.summary }}" />
<link rel="apple-touch-icon" sizes="57x57" href="/resource/icon/apple-icon-57x57.png">
<link rel="apple-touch-icon" sizes="60x60" href="/resource/icon/apple-icon-60x60.png">
<link rel="apple-touch-icon" sizes="72x72" href="/resource/icon/apple-icon-72x72.png">
<link rel="apple-touch-icon" sizes="76x76" href="/resource/icon/apple-icon-76x76.png">
<link rel="apple-touch-icon" sizes="114x114" href="/resource/icon/apple-icon-114x114.png">
<link rel="apple-touch-icon" sizes="120x120" href="/resource/icon/apple-icon-120x120.png">
<link rel="apple-touch-icon" sizes="144x144" href="/resource/icon/apple-icon-144x144.png">
<link rel="apple-touch-icon" sizes="152x152" href="/resource/icon/apple-icon-152x152.png">
<link rel="apple-touch-icon" sizes="180x180" href="/resource/icon/apple-icon-180x180.png">
<link rel="icon" type="image/png" sizes="192x192" href="/resource/icon/android-icon-192x192.png">
<link rel="icon" type="image/png" sizes="32x32" href="/resource/icon/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="96x96" href="/resource/icon/favicon-96x96.png">
<link rel="icon" type="image/png" sizes="16x16" href="/resource/icon/favicon-16x16.png">
<link rel="manifest" href="/resource/icon/manifest.json">
<meta name="msapplication-TileColor" content="#ffffff">
<meta name="msapplication-TileImage" content="/resource/icon/ms-icon-144x144.png">
<meta name="theme-color" content="#ffffff">
{% if site.google_analytics.ua and site.google_analytics.encrypted_ua %}
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id={{ site.google_analytics.ua }}"></script>
<script>
// https://gist.github.com/chrisveness/43bcda93af9f646d083fad678071b90a
async function aesGcmDecrypt(ciphertext, password) {
const pwUtf8 = new TextEncoder().encode(password);
const pwHash = await crypto.subtle.digest('SHA-256', pwUtf8);
const iv = ciphertext.slice(0,24).match(/.{2}/g).map(byte => parseInt(byte, 16));
const alg = { name: 'AES-GCM', iv: new Uint8Array(iv) };
const key = await crypto.subtle.importKey('raw', pwHash, alg, false, ['decrypt']);
const ctStr = atob(ciphertext.slice(24));
const ctUint8 = new Uint8Array(ctStr.match(/[\s\S]/g).map(ch => ch.charCodeAt(0)));
const plainBuffer = await crypto.subtle.decrypt(alg, key, ctUint8);
const plaintext = new TextDecoder().decode(plainBuffer);
return plaintext;
}
async function aesGcmEncrypt(plaintext, password) {
const pwUtf8 = new TextEncoder().encode(password);
const pwHash = await crypto.subtle.digest('SHA-256', pwUtf8);
const iv = crypto.getRandomValues(new Uint8Array(12));
const alg = { name: 'AES-GCM', iv: iv };
const key = await crypto.subtle.importKey('raw', pwHash, alg, false, ['encrypt']);
const ptUint8 = new TextEncoder().encode(plaintext);
const ctBuffer = await crypto.subtle.encrypt(alg, key, ptUint8);
const ctArray = Array.from(new Uint8Array(ctBuffer));
const ctStr = ctArray.map(byte => String.fromCharCode(byte)).join('');
const ctBase64 = btoa(ctStr);
const ivHex = Array.from(iv).map(b => ('00' + b.toString(16)).slice(-2)).join('');
return ivHex+ctBase64;
}
aesGcmDecrypt('{{ site.google_analytics.encrypted_ua }}', '{{ site.url }}')
.then(function(ua) {
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', ua);
console.log('The gtag config has been finished.');
})
.catch(function(error) {
console.log(error);
console.log('The gtag id is invalid.');
});
</script>
{% endif %}
{% if site.google_adsense.client and page.adsense == true %}
<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<script>
(adsbygoogle = window.adsbygoogle || []).push({
google_ad_client: "{{ site.google_adsense.client }}",
enable_page_level_ads: true
});
</script>
{% endif %}
</head>
<header class="header">
<div>
<a class="site-title" href="{{ site.baseurl }}/">{{ site.title }}</a>
</div>
<div>
<a class="site-title-right" href="/about/">me</a>
</div>
<div>
<a id="random-button" class="site-title-right">random</a>
</div>
<div>
<a class="site-title-right" href="/wiki/root-index/">index</a>
</div>
</header>
<script async src="/js/shortcut.js"></script>