上传中...
+
+
📁 File Upload to Telegram
+
Secure, Fast, Permanent Storage
+
+
+
+
📤
+
Drag files here or click to select
+
+ Choose Files
+
+
+
+
+
+ 🈳 No file
+
+
+
+ 📊 Multiple Files
+ 🔒 Secure
+ ⚡ Fast
+
+
+
+
Uploading...
+
+
+
+
+
+
{{template "public/footer" .}}
diff --git a/assets/templates/footer.tmpl b/assets/templates/footer.tmpl
index ed91446..5bb8e97 100644
--- a/assets/templates/footer.tmpl
+++ b/assets/templates/footer.tmpl
@@ -3,7 +3,7 @@
function uploadFile(file) {
var limit = 10 * 1024 * 1024;
if (file.size <= limit) {
- uploadImg(file, 1).then((url) => {
+ uploadImg(file, 1, file.name).then((url) => {
// 处理上传成功的情况
console.log(url);
}).catch((error) => {
@@ -18,7 +18,7 @@
function uploadNextChunk() {
if (start < file.size) {
var chunk = file.slice(start, end);
- return uploadImg(chunk, 0)
+ return uploadImg(chunk, 0, file.name)
.then((url) => {
// 处理上传成功的情况
temp = temp + '\n' + url.replace(/^\/d\//, ''); // 每次改变值都换行
@@ -47,7 +47,7 @@
// 将字符串转换为 Blob 对象
var blob = new Blob([temp], { type: 'text/plain' });
var fileAll = new File([blob], 'fileAll.txt', { type: 'text/plain' });
- return uploadImg(fileAll, 1);
+ return uploadImg(fileAll, 1, file.name);
})
.catch((error) => {
// 处理上传失败的情况
@@ -55,13 +55,14 @@
});
}
}
- function uploadImg(e, ms) {
+ function uploadImg(e, ms, fileName) {
return new Promise((resolve, reject) => {
var o = new FormData();
- o.append("image", e);
+ o.append("file", e);
var isImage = e.type.startsWith('image/');
+ var displayFileName = fileName || e.name || 'Unknown file';
$("#uploadButton").prop("disabled", !0);
- $("#uploadButton").text("上传中");
+ $("#uploadButton").text("Uploading");
$("#loading").show();
var a = window.location.protocol + "//" + window.location.hostname;
"80" !== window.location.port &&
@@ -69,89 +70,124 @@
(a = a + ":" + window.location.port),
$.ajax({
type: "POST",
- url: a + "/api",
+ url: window.location.href.replace(/\/$/, "") + "/api",
data: o,
contentType: !1,
processData: !1,
success: function (e) {
- var link = a + e.message;
+
+ var link = window.location.href.replace(/\/$/, "") + e.message;
+ var proxyUrl = e.proxyUrl
var t;
if (e.code == 1) {
if (ms) {
+ var shortLink = e.shortFileUrl ? window.location.href.replace(/\/$/, "") + e.shortUrl : '';
+ var fileNameToShow = displayFileName;
+
if (isImage) {
- t = $(
- '
💡 请在
+frontend/src/config/giscus.ts中配置你的 GitHub 仓库访问 giscus.app 获取配置参数
+