-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathindex.html
More file actions
278 lines (244 loc) · 7.92 KB
/
Copy pathindex.html
File metadata and controls
278 lines (244 loc) · 7.92 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
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
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Giga-Header - C to Header-Only Converter</title>
<style>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
font-family: 'Courier New', monospace;
background: #000;
color: #fff;
min-height: 100vh;
border: 8px solid #ff0;
}
.container {
max-width: 1200px;
margin: 0 auto;
padding: 40px;
}
h1 {
font-size: 4rem;
font-weight: 900;
text-transform: uppercase;
letter-spacing: -2px;
background: #ff0;
color: #000;
padding: 20px;
border: 4px solid #0ff;
margin-bottom: 40px;
transform: rotate(-1deg);
}
.subtitle {
font-size: 1.5rem;
background: #0ff;
color: #000;
padding: 15px;
border: 4px solid #f0f;
margin-bottom: 40px;
font-weight: bold;
transform: rotate(1deg);
}
.input-section {
background: #f0f;
border: 4px solid #0f0;
padding: 30px;
margin-bottom: 30px;
}
label {
display: block;
font-size: 1.2rem;
font-weight: bold;
margin-bottom: 15px;
color: #000;
}
input[type="url"] {
width: 100%;
padding: 20px;
font-size: 1.2rem;
font-family: 'Courier New', monospace;
border: 4px solid #000;
background: #fff;
color: #000;
margin-bottom: 20px;
}
button {
background: #0f0;
color: #000;
border: 4px solid #ff0;
padding: 20px 40px;
font-size: 1.3rem;
font-weight: bold;
cursor: pointer;
text-transform: uppercase;
transition: all 0.1s;
}
button:hover {
background: #ff0;
color: #000;
transform: translate(-4px, -4px);
box-shadow: 8px 8px 0 #000;
}
button:active {
transform: translate(0, 0);
box-shadow: none;
}
.result-section {
background: #0f0;
border: 4px solid #f0f;
padding: 30px;
margin-top: 30px;
display: none;
}
.result-section h2 {
font-size: 2rem;
color: #000;
margin-bottom: 20px;
background: #ff0;
padding: 15px;
border: 4px solid #000;
}
.status {
font-size: 1.3rem;
font-weight: bold;
padding: 15px;
margin-bottom: 20px;
border: 4px solid #000;
}
.status.success {
background: #0f0;
color: #000;
}
.status.error {
background: #f00;
color: #fff;
}
.download-btn {
background: #0ff;
color: #000;
border: 4px solid #f0f;
padding: 15px 30px;
font-size: 1.1rem;
text-decoration: none;
display: inline-block;
margin-top: 15px;
font-weight: bold;
}
.download-btn:hover {
background: #f0f;
color: #000;
transform: translate(-4px, -4px);
box-shadow: 8px 8px 0 #000;
}
.loading {
display: none;
background: #ff0;
color: #000;
padding: 20px;
border: 4px solid #0ff;
font-size: 1.2rem;
font-weight: bold;
margin: 20px 0;
}
.loading.active {
display: block;
}
@keyframes blink {
0%, 50% { opacity: 1; }
51%, 100% { opacity: 0; }
}
.loading::after {
content: '...';
animation: blink 1s infinite;
}
</style>
</head>
<body>
<div class="container">
<h1>Giga-Header</h1>
<div class="subtitle">Convert C Projects to Header-Only Files</div>
<div class="input-section">
<label for="gitUrl">Enter Git Repository URL:</label>
<input type="url" id="gitUrl" placeholder="https://github.com/user/repo.git" />
<button onclick="convertProject()">Convert Project</button>
</div>
<div class="loading" id="loading">
Processing repository
</div>
<div class="result-section" id="resultSection">
<h2>Conversion Result</h2>
<div class="status" id="status"></div>
<div id="resultContent"></div>
</div>
</div>
<script>
function isValidGithubUrl(url) {
return /^https:\/\/github\.com\/[a-zA-Z0-9](?:[a-zA-Z0-9\-]*[a-zA-Z0-9])?\/[a-zA-Z0-9._\-]+(\.git)?\/?$/.test(url);
}
async function convertProject() {
const gitUrl = document.getElementById('gitUrl').value.trim();
const loading = document.getElementById('loading');
const resultSection = document.getElementById('resultSection');
const status = document.getElementById('status');
const resultContent = document.getElementById('resultContent');
if (!gitUrl) {
alert('Please enter a Git repository URL');
return;
}
if (!isValidGithubUrl(gitUrl)) {
resultSection.style.display = 'block';
status.className = 'status error';
status.textContent = '✗ Invalid GitHub URL. Expected: https://github.com/<owner>/<repo>';
resultContent.innerHTML = '';
return;
}
loading.classList.add('active');
resultSection.style.display = 'none';
try {
const response = await fetch('/convert', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({ git_url: gitUrl })
});
const result = await response.json();
loading.classList.remove('active');
resultSection.style.display = 'block';
if (result.success) {
status.className = 'status success';
status.textContent = '✓ Successfully converted to header-only file!';
resultContent.innerHTML = `
<p>Repository: ${result.repository}</p>
<p>C files found: ${result.c_files_count}</p>
<p>Header files found: ${result.header_files_count}</p>
<a href="/download/${result.filename}" class="download-btn" download>
Download ${result.filename}
</a>
`;
} else {
status.className = 'status error';
status.textContent = '✗ ' + result.error;
resultContent.innerHTML = '';
}
} catch (error) {
loading.classList.remove('active');
resultSection.style.display = 'block';
status.className = 'status error';
status.textContent = '✗ Server error: ' + error.message;
resultContent.innerHTML = '';
}
}
document.getElementById('gitUrl').addEventListener('keypress', function(e) {
if (e.key === 'Enter') {
convertProject();
}
});
</script>
</body>
</html>