Skip to content

Commit

Permalink
image improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
iiPythonx committed Nov 25, 2024
1 parent 5cc97db commit b61478a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion nightwatch/web/css/main.css
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ input:hover {
padding-bottom: 5px;
}
.message-content > img {
max-width: 300px;
max-width: 640px;
}
.timestamp {
margin-left: auto;
Expand Down
3 changes: 2 additions & 1 deletion nightwatch/web/js/nightwatch.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,8 @@ const NOTIFICATION_SFX = new Audio("/audio/notification.mp3");
// Construct text/attachment
let attachment = message.message, classlist = "message-content";
if (attachment.toLowerCase().match(/^https:\/\/[\w\d./-]+.(?:avifs?|a?png|jpe?g|jfif|webp|ico|gif|svg)(?:\?.+)?$/)) {
attachment = `<img src = "http${connection.protocol}://${address}/api/fwd/${btoa(attachment.slice(8))}">`;
const url = `http${connection.protocol}://${address}/api/fwd/${btoa(attachment.slice(8))}`;
attachment = `<a href = "${url}" target = "_blank"><img src = "${url}"></a>`;
classlist += " has-image";
} else {

Expand Down

0 comments on commit b61478a

Please sign in to comment.