-
Notifications
You must be signed in to change notification settings - Fork 7
/
index.html
144 lines (128 loc) · 5.75 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
<!-- The web portal for the Tachiyomi to Paperback backup converter, probably run this on a Heroku instance, or somewhere cheap. -->
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Tachiyomi to Paperback Converter</title>
<!-- Jquery from CDN -->
<script src="https://code.jquery.com/jquery-3.5.1.min.js"></script>
<!-- Semantic-ui from CDN -->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/semantic-ui@2.4.2/dist/semantic.min.css">
<script src="https://cdn.jsdelivr.net/npm/semantic-ui@2.4.2/dist/semantic.min.js"></script>
</head>
<body>
<!-- Header with links to other Paperback locations -->
<div class="ui fixed inverted menu">
<div class="ui container">
<a href="https://discord.gg/Gn2njN8D3f" class="item">
Discord
</a>
<a href="https://www.patreon.com/FaizanDurrani" class="item">
Patreon
</a>
<a href="https://www.reddit.com/r/Paperback/" class="item">
Reddit
</a>
</div>
</div>
<br><br><br>
<!-- Main container with the instruction text, and the upload form -->
<div class="ui main center aligned container">
<h1 class="ui header">Tachiyomi to Paperback - Backup Converter</h1>
<!-- Grid containing the instruction and compatibility list-->
<div class="ui grid">
<div class="ten wide column">
<div class="ui segment">
<h1 class="ui header">
Provide a Tachiyomi .gz Backup
</h1>
<p>Recently Tachiyomi updated their backup formatting from .json to a .gz extension using Protocol Buffers. This tool will only work
on the new version of backups. Legacy backups are unsupported.
</p>
<form class = "ui form" id="form" name="form">
<div class="ui input">
<input type="file" id="fileUploadButton" name="fileUploadButton" placeholder="Upload .proto.gz">
</div>
</form>
<div id="warning"></div>
</div>
</div>
<div class="six wide column">
<div class="ui segment">
<h1 class="ui header">
Supported Sources
</h1>
<p>Because Tachiyomi and Paperback both work with community-created sources, the backup conversion process can only use
sources which both Paperback and Tachiyomi share.
</p>
<p>
Below is a list of Tachiyomi sources which this tool is able to handle.
</p>
<!-- Add sources which this backup tool can use to this list below -->
<div class="ui segment">
<div class="ui bulleted list">
<div class="item">Manganelo</div>
<div class="item">Mangadex</div>
<div class="item">MangaLife</div>
<div class="item">Mangasee</div>
<div class="item">MangaReader</div>
<div class="item">Guya</div>
</div>
</div>
Additional source functionality will be added in the near future
</div>
</div>
</div>
</div>
</body>
<footer>
<script>
const remoteEndpoint = "https://convert.stormcloud.host" // Where do we send these files for conversion?
$(document).ready(function() {
$("#fileUploadButton").change(function() {
// When the user registers a file, attempt to perform a conversion
// First, read the file contents
var file = $("#fileUploadButton").prop('files')[0]
// Ensure that this is a gzip file, if not, alert the user
// if(file.type != "application/x-gzip") {
// $("#warning").text("Please make sure that your backup file ends in .proto.gz")
// return
// }
var form = new FormData()
form.append("backupFile", file, file.name)
// Send this in for processing
var settings = {
"url": remoteEndpoint,
"method": "POST",
"timeout": 0,
"mimeType": "multipart/form-data",
"contentType": false,
"processData": false,
"data": form
};
console.log(settings)
$.ajax(settings).done(function (response) {
console.log(response);
let data = JSON.parse(response)
// Generate a filename and queue a download operation'
let title = new Date().toDateString() + "-PaperbackConversion.json"
downloadData(title, data.paperbackBackup)
})
.fail(function(xhr, status, error) {
$("#warning").text(`Error: ${xhr.responseText}`)
});
})
})
// Tell the browser to start a download operation on a given set of text
function downloadData(filename, text) {
var element = document.createElement('a')
element.setAttribute('href', 'data:application/json;charset=utf-8,' + encodeURIComponent(JSON.stringify(text)))
element.setAttribute('download', filename)
element.style.display = 'none'
document.body.appendChild(element)
element.click()
document.body.removeChild(element)
}
</script>
</footer>
</html>