diff --git a/service/api/comments.go b/service/api/comments.go
index b7f502f..aade789 100644
--- a/service/api/comments.go
+++ b/service/api/comments.go
@@ -89,14 +89,14 @@ func (rt *_router) PostComment(w http.ResponseWriter, r *http.Request, ps httpro
}
// check if the comment is valid (should not contain newlines and at be between 5 and 255 characters)
- stat, err := regexp.Match(`^[*]{5, 255}$`, []byte(request_body.Comment))
+ stat, err := regexp.Match(`^(.*)*`, []byte(request_body.Comment))
if err != nil {
helpers.SendInternalError(err, "Error matching regex", w, rt.baseLogger)
return
}
- if !stat {
+ if !stat || len(request_body.Comment) < 5 || len(request_body.Comment) > 255 {
helpers.SendBadRequest(w, "Invalid comment", rt.baseLogger)
return
}
diff --git a/service/database/db-comments.go b/service/database/db-comments.go
index 9e4ff0c..3708732 100644
--- a/service/database/db-comments.go
+++ b/service/database/db-comments.go
@@ -103,6 +103,7 @@ func (db *appdbimpl) GetComments(uid string, photo_id int64, requesting_uid stri
AND "bans"."ban" = ?
)
AND "u"."uid" = "c"."user"
+ ORDER BY "c"."date" DESC
LIMIT ?
OFFSET ?`, photo_id, requesting_uid, limit, start_index)
diff --git a/webui/src/App.vue b/webui/src/App.vue
index 39dfa1f..f46c62f 100644
--- a/webui/src/App.vue
+++ b/webui/src/App.vue
@@ -1,13 +1,28 @@
+
@@ -69,7 +84,7 @@ export default {
-
+
diff --git a/webui/src/components/Modal.vue b/webui/src/components/Modal.vue
new file mode 100644
index 0000000..b53788b
--- /dev/null
+++ b/webui/src/components/Modal.vue
@@ -0,0 +1,27 @@
+
+
+
+
+
+
+
+
+
+
{{ title }}
+
+
+
+ {{ message }}
+
+
+
+
+
+
\ No newline at end of file
diff --git a/webui/src/components/PostCard.vue b/webui/src/components/PostCard.vue
index 3c1db9a..6e23e4d 100644
--- a/webui/src/components/PostCard.vue
+++ b/webui/src/components/PostCard.vue
@@ -1,18 +1,53 @@
-
-
@@ -97,6 +117,12 @@ export default {
+
+
+
+
+
+
@@ -116,6 +142,21 @@ export default {
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/webui/src/main.js b/webui/src/main.js
index f16448f..1dfbdb0 100644
--- a/webui/src/main.js
+++ b/webui/src/main.js
@@ -6,6 +6,7 @@ import ErrorMsg from './components/ErrorMsg.vue'
import LoadingSpinner from './components/LoadingSpinner.vue'
import PostCard from './components/PostCard.vue'
import UserCard from './components/UserCard.vue'
+import Modal from './components/Modal.vue'
import 'bootstrap-icons/font/bootstrap-icons.css'
import './assets/dashboard.css'
@@ -18,5 +19,6 @@ app.component("ErrorMsg", ErrorMsg);
app.component("LoadingSpinner", LoadingSpinner);
app.component("PostCard", PostCard);
app.component("UserCard", UserCard);
+app.component("Modal", Modal);
app.use(router)
app.mount('#app')
\ No newline at end of file
diff --git a/webui/src/services/authentication.js b/webui/src/services/authentication.js
new file mode 100644
index 0000000..d650de8
--- /dev/null
+++ b/webui/src/services/authentication.js
@@ -0,0 +1,4 @@
+export default function getCurrentSession() {
+ if (localStorage.getItem('token') == null) return sessionStorage.getItem('token');
+ return localStorage.getItem('token');
+}
\ No newline at end of file
diff --git a/webui/src/services/axios.js b/webui/src/services/axios.js
index afab388..c51d6af 100644
--- a/webui/src/services/axios.js
+++ b/webui/src/services/axios.js
@@ -1,4 +1,5 @@
import axios from "axios";
+import getCurrentSession from "./authentication";
const instance = axios.create({
baseURL: __API_URL__,
@@ -13,7 +14,7 @@ const instance = axios.create({
//});
const updateToken = () => {
- instance.defaults.headers.common['Authorization'] = 'Bearer ' + sessionStorage.getItem('token');
+ instance.defaults.headers.common['Authorization'] = 'Bearer ' + getCurrentSession();
}
export {
diff --git a/webui/src/views/HomeView.vue b/webui/src/views/HomeView.vue
index e760bbe..ae4859b 100644
--- a/webui/src/views/HomeView.vue
+++ b/webui/src/views/HomeView.vue
@@ -1,4 +1,5 @@