-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtempshare.html
125 lines (114 loc) · 3.62 KB
/
tempshare.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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Upload Files</title>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/sweetalert2@11/dist/sweetalert2.min.css">
<style>
body {
font-family: Arial, sans-serif;
margin: 0;
padding: 0;
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
background-color: #f7f7f7;
}
.container {
max-width: 500px;
padding: 20px;
background-color: #fff;
border-radius: 8px;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
}
h1 {
text-align: center;
margin-bottom: 20px;
}
form {
display: flex;
flex-direction: column;
}
label {
font-weight: bold;
}
input[type="text"],
input[type="file"],
button {
margin-bottom: 15px;
padding: 10px;
border: 1px solid #ccc;
border-radius: 4px;
font-size: 16px;
}
button {
background-color: #007bff;
color: #fff;
border: none;
cursor: pointer;
}
button:hover {
background-color: #0056b3;
}
.swal2-popup {
font-size: 16px;
}
</style>
</head>
<body>
<div class="container">
<h1>Temporary Share</h1>
<center>
<a href="https://www.snail-ide.com/guidelines/uploading">Rules</a>
<a href="https://www.snail-ide.com/upload">Permanent Sharing</a>
</center>
<title>Temporary Share</title>
<form id="uploadForm" enctype="multipart/form-data">
<label for="extensionName">Project Name:</label>
<input type="text" id="extensionName" name="extensionName" required><br><br>
<label for="file">Choose a .snail file:</label>
<input type="file" id="file" name="extension" accept=".snail" required><br><br>
<button type="submit">Upload</button>
</form>
</div>
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script>
<script>
document.getElementById('uploadForm').addEventListener('submit', async (event) => {
event.preventDefault();
const form = event.target;
const formData = new FormData(form);
try {
const response = await fetch('https://opensnail.snail-ide.com/api/upload', {
method: 'POST',
body: formData
});
if (response.ok) {
const url = await response.text();
const projectUrl = `https://editor.snail-ide.com/?project_url=${url}`;
Swal.fire({
icon: 'success',
title: 'File Uploaded!',
text: 'Your file has been successfully uploaded. Please note that files uploaded via temporary share are available for 15 minutes only. For permanent storage, use the main uploading system.',
footer: `<a href="${projectUrl}" target="_blank">View Project</a>`
});
} else {
const errorText = await response.text();
throw new Error(errorText);
}
} catch (error) {
console.error('Error:', error);
Swal.fire({
icon: 'error',
title: 'Upload Failed',
text: error.message || 'An error occurred during file upload.'
});
}
});
</script>
</body>
<footer>
<a href="https://info.flagcounter.com/pBnt"><img src="https://s01.flagcounter.com/count2/pBnt/bg_FFFFFF/txt_000000/border_CCCCCC/columns_2/maxflags_10/viewers_0/labels_1/pageviews_1/flags_0/percent_0/" alt="Flag Counter" border="0"></a>
</footer>
</html>