-
-

-
-
+ try {
+ json.page.forEach(image => {
+ $('#typexImages').append(`
+
+
+
+

+
+
`);
- });
+ });
} catch (e) {
- console.error(e)
+ document.getElementById('emptyImages').innerHTML = `
+
+
+
+
+
You have no imaages
+
Use the API to start uploading!
+
+ `;
+ document.getElementById('typexImagePagination').innerHTML = '';
}
}
document.getElementById('updateImages').addEventListener('click', async () => {
redoImageGrid('0', 'normal');
+ document.getElementById('emptyImages').innerHTML = '';
document.getElementById('typexImagePagination').innerHTML = '';
const resp = await fetch('/api/images/user/pages', {
@@ -119,40 +107,38 @@ document.getElementById('updateImages').addEventListener('click', async () => {
});
const json = await resp.json();
try {
-$('#typexImagePagination').append(`
+ $('#typexImagePagination').append(`
First
`);
-$('#typexImagePagination').append(`
+ $('#typexImagePagination').append(`
- «
- Previous
+ Prev
`);
-$('#typexImagePagination').append(`
+ $('#typexImagePagination').append(`
- `)
- TypeX.pagedNumbers = json.pagedNums;
- json.pagedNums.forEach(p => {
- $('#typexImagePaginationDropdown').append(`
-
+ TypeX.pagedNumbers = json.pagedNums;
+ json.pagedNums.forEach(p => {
+ $('#typexImagePaginationDropdown').append(`
+
`)
- });
-$('#typexImagePagination').append(`
+ });
+ $('#typexImagePagination').append(`
-
- »
- Next
+
+ Next
`);
-$('#typexImagePagination').append(`
+ $('#typexImagePagination').append(`
-
+
Last
`);
@@ -179,7 +165,7 @@ document.getElementById('updateStatistics').addEventListener('click', async () =
const c = json.table.images[i];
$('#statsLeaderboardImages').append(`
- | ${i+1} |
+ ${i + 1} |
${c.username} |
${c.count} |
@@ -189,7 +175,7 @@ document.getElementById('updateStatistics').addEventListener('click', async () =
const c = json.table.views[i];
$('#statsLeaderboardImageViews').append(`
- | ${i+1} |
+ ${i + 1} |
${c.username} |
${c.count} |
@@ -215,7 +201,7 @@ document.getElementById('updateShortens').addEventListener('click', async () =>
for (const shorten of json) {
$('#shortensTableShortens').append(`
- | ${shorten.id} |
+ ${shorten.id} |
${shorten.origin} |
${shorten.url} |
@@ -227,7 +213,6 @@ document.getElementById('updateShortens').addEventListener('click', async () =>
});
-
const deleteImage = (id, url) => {
Swal.fire({
title: 'Are you sure?',
@@ -360,13 +345,13 @@ async function shortURL(token, url) {
})
});
try {
- let te = await res.text();
- Swal.fire(
- 'URL Shortened!',
- `Shorten:
${te}`,
- 'success'
- );
- return;
+ let te = await res.text();
+ Swal.fire(
+ 'URL Shortened!',
+ `Shorten:
${te}`,
+ 'success'
+ );
+ return;
} catch (e) {
if (e.message.startsWith('Unexpected token < in JSON at position')) {
let te = await res.text();
@@ -446,7 +431,7 @@ async function createUser() {
const username = document.getElementById('username').value;
const password = document.getElementById('password').value;
if (whitespace(username)) return showAlert('error', 'Please input a username.')
- const res = await fetch('/api/user', {
+ const res = await fetch('/api/users', {
method: 'POST',
headers: {
'Content-Type': 'application/json'
@@ -461,7 +446,6 @@ async function createUser() {
const json = await res.json();
if (json.error || json.code) return showAlert('error', json.error)
else {
- $('#modal').modal('toggle');
showAlert('success', `Created user ${json.username} (${json.id})`)
return window.location.href = '/'
}
@@ -470,7 +454,7 @@ async function createUser() {
}
}
-document.getElementById('createUser').addEventListener('click', async () => {
+document.getElementById('addUser').addEventListener('click', async () => {
if (document.getElementById('administrator').checked) {
Swal.fire({
title: 'Are you sure?',
diff --git a/src/controllers/APIController.ts b/src/controllers/APIController.ts
old mode 100644
new mode 100755
diff --git a/src/controllers/IndexController.ts b/src/controllers/IndexController.ts
old mode 100644
new mode 100755
diff --git a/src/core/Console.ts b/src/core/Console.ts
old mode 100644
new mode 100755
diff --git a/src/entities/Image.ts b/src/entities/Image.ts
old mode 100644
new mode 100755
diff --git a/src/entities/Note.ts b/src/entities/Note.ts
old mode 100644
new mode 100755
diff --git a/src/entities/Shorten.ts b/src/entities/Shorten.ts
old mode 100644
new mode 100755
diff --git a/src/entities/User.ts b/src/entities/User.ts
old mode 100644
new mode 100755
diff --git a/src/index.ts b/src/index.ts
old mode 100644
new mode 100755
diff --git a/src/interval.ts b/src/interval.ts
old mode 100644
new mode 100755
diff --git a/src/middleware/cookies.ts b/src/middleware/cookies.ts
old mode 100644
new mode 100755
diff --git a/src/middleware/cookiesForAPI.ts b/src/middleware/cookiesForAPI.ts
old mode 100644
new mode 100755
diff --git a/src/server.ts b/src/server.ts
old mode 100644
new mode 100755
diff --git a/src/structures/ConsoleFormatter.ts b/src/structures/ConsoleFormatter.ts
old mode 100644
new mode 100755
diff --git a/src/structures/DiscordWebhook.ts b/src/structures/DiscordWebhook.ts
old mode 100644
new mode 100755
diff --git a/src/structures/ImageUtil.ts b/src/structures/ImageUtil.ts
old mode 100644
new mode 100755
diff --git a/src/structures/ShortenUtil.ts b/src/structures/ShortenUtil.ts
old mode 100644
new mode 100755
diff --git a/src/util.ts b/src/util.ts
old mode 100644
new mode 100755
diff --git a/tsconfig.json b/tsconfig.json
old mode 100644
new mode 100755
diff --git a/uploaders/UPLOADERS.md b/uploaders/UPLOADERS.md
deleted file mode 100644
index f6e7f641..00000000
--- a/uploaders/UPLOADERS.md
+++ /dev/null
@@ -1,12 +0,0 @@
-# TypeX Uploaders
-These uploaders are made with ShareX in mind, but can be adapted to other uploaders.
-Please make a Pull Request with other uploader configurations with the scheme of
-`uploader_type.json`.
-
-## Images
-Images are sent to the `/api/upload/` endpoint with Multipart Form-Data. The payload key is `file`.
-
----
-
-## URLs
-URLs are sent to the `/api/shorten/` endpoint with raw data. The payload key is `url`.
\ No newline at end of file
diff --git a/uploaders/sharex_images.json b/uploaders/sharex_images.json
old mode 100644
new mode 100755
diff --git a/uploaders/sharex_urls.json b/uploaders/sharex_urls.json
old mode 100644
new mode 100755
diff --git a/views/404.ejs b/views/404.ejs
old mode 100644
new mode 100755
diff --git a/views/error.ejs b/views/error.ejs
old mode 100644
new mode 100755
diff --git a/views/index.ejs b/views/index.ejs
old mode 100644
new mode 100755
index f8d6bca8..089bcbd3
--- a/views/index.ejs
+++ b/views/index.ejs
@@ -8,250 +8,249 @@
-
-
-
- -
- Home
-
- -
- Statistics
-
- -
- URL
- Shortener
-
- -
- Your
- Images
-
- <% if (user.administrator) { %>
- -
-
- Users
-
- <% } %>
-
-
-
-
- Welcome back, <%= user.username %>!
- <%if(user.administrator){%>Admin
- <%}else{%>User
- <%}%>
-
-
You have <%= images.length %> images saved.
-
API Token
-
-
-
Update your Profile
-