-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathindex.html
160 lines (143 loc) · 5.76 KB
/
index.html
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
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
<html>
<head>
<title>Pocket to kindle</title>
<meta charset="UTF-8">
<style>
.hidden {
visibility: hidden;
}
.wrapper {
font-family: Tahoma;
max-width: 50em;
margin: 0 auto;
}
.footer {
text-align: center;
margin-top: 1em;
}
.footer a {
color: grey;
}
.input-container {
padding: 1em 1em 1em 0;
max-width: 20em;
}
input {
width: 100%;
}
button {
padding: 0.5em 2em;
}
li {
margin-bottom: 0.8em;
}
</style>
</head>
<body>
<div class="wrapper">
<h1>
Pocket to kindle
</h1>
<div>
Pocket to kindle sends your pocket articles to your kindle!
</div>
<h2>Register</h2>
<ol>
<li>
First,
<button id="authorize-pocket-button">Authorize Pocket</button> <span id="authorize-checkmark" class="hidden">✅</span>
</li>
<li>
Next go to
<a href="https://www.amazon.com/hz/mycd/myx#/home/settings/payment">Kindle email allowed senders</a> under "Personal Document Settings" and <b>add "kindle@mail.p2k.sejka.pl"</b> as approved
email.
</li>
<li>
You might also want to disable "Personal Document Archiving", otherwise it will preserve articles sent to you in your library after you delete them from kindle.
</li>
<li>
Finally, find your kindle email in "Your Devices" tab and share it below:
<br />
<div class="input-container">
<input id="email-input" type="email">
</div>
<button id="submit-button" disabled>Submit</button>
</li>
<li>
That's it! If everything went fine you should receive an welcoming email on your kindle. Next time you add something to your
pocket it should arrive within 15 minutes on your kindle. Enjoy!
</li>
</ol>
<div>
<h2>
Privacy
</h2>
We do not store or log anything you read. Only things stored about the user are:
<ul>
<li>Pocket username</li>
<li>Kindle email</li>
<li>Last internal processing date (usually updates every 15 minutes)</li>
<li>Internal user token (for archive/star functionalities at the end of every article)</li>
<li>Pocket developer api access code</li>
</ul>
as you can see <a href="https://github.com/sejka/PocketToKindle/blob/master/Core/User.cs">here in the source code</a>.<br />
<div>
That's why it might be problematic to debug any parsing/email sending issues with particular articles. I encourage to use Report link at the end of every article if there's something wrong or filing an issue in <a href="https://github.com/sejka/PocketToKindle/issues">github repo</a>.
</div>
<div>
However, our email provider - Mailgun, logs email titles. Email titles are equal to your pocket article titles so that kindle device can view article title properly. I'd like to switch to more private solution but I'm afraid I'll need help with setting it up.
</div>
</div>
<div class="footer">
<a href="https://github.com/sejka/pockettokindle">Source code</a>
<a href="https://twitter.com/karolsejka">Karol Sejka</a>
</div>
</div>
<script type="text/javascript">
var authorizeButton = document.getElementById('authorize-pocket-button');
var authorizeCheckMark = document.getElementById('authorize-checkmark');
var submitButton = document.getElementById('submit-button');
submitButton.onclick = register;
authorizeButton.onclick = authroizeOnPocket;
if (getCookie("pocketkey")) {
submitButton.disabled = false;
authorizeButton.disabled = true;
authorizeCheckMark.classList.remove('hidden');
}
function register() {
submitButton.disabled = true;
var xhReq = new XMLHttpRequest();
xhReq.open("POST",
"https://pocket-to-kindle.azurewebsites.net/api/Register",
false);
xhReq.setRequestHeader("Content-Type", "application/json");
var kindleEmail = document.getElementById('email-input').value.trim();
var requestCode = getCookie("pocketkey");
var data = JSON.stringify({
"kindleEmail": kindleEmail,
"requestCode": requestCode
});
xhReq.send(data);
var serverResponse = xhReq.responseText;
alert(serverResponse);
eraseCookie('pocketkey');
}
async function authroizeOnPocket() {
authorizeButton.disabled = true;
url = "https://pocket-to-kindle.azurewebsites.net/api/GetRegistrationInfo";
let response = await fetch(url);
response = await response.json();
document.cookie = `pocketkey=${response.RequestCode}`;
window.location.href = response.RegistrationLink;
}
function eraseCookie(name) {
document.cookie = name + '=; Max-Age=0'
}
function getCookie(name) {
var value = "; " + document.cookie;
var parts = value.split("; " + name + "=");
if (parts.length == 2) return parts.pop().split(";").shift();
};
</script>
</body>
</html>