restore image loading
This commit is contained in:
@@ -16,6 +16,13 @@ public class FediMedium implements Serializable {
|
||||
private String mediumUrl;
|
||||
private String mediumImage;
|
||||
|
||||
public FediMedium() {
|
||||
this.mediumType = IMAGE;
|
||||
this.description = "missing alt text";
|
||||
this.mediumUrl = "unknown";
|
||||
this.mediumImage = "unknown";
|
||||
}
|
||||
|
||||
public String getMediumType() {
|
||||
return mediumType;
|
||||
}
|
||||
|
||||
@@ -65,7 +65,8 @@ public class JSONLoader implements Serializable {
|
||||
post.setLikes(jsonStatus.getInt("favourites_count"));
|
||||
post.setPinned(pinned);
|
||||
post.setPostUrl(jsonStatus.getString("url"));
|
||||
if (jsonStatus.getJSONArray("media_attachments").length() == 0) {
|
||||
final JSONArray mediaJsonArray = jsonStatus.getJSONArray("media_attachments");
|
||||
if (mediaJsonArray.length() == 0) {
|
||||
final JSONObject jsonCard = jsonStatus.getJSONObject("card");
|
||||
if (jsonCard != null && jsonCard.getString("image") != null) {
|
||||
final FediMedium medium = new FediMedium();
|
||||
@@ -76,7 +77,17 @@ public class JSONLoader implements Serializable {
|
||||
post.addFediMedium(medium);
|
||||
}
|
||||
} else {
|
||||
|
||||
for (int mediaIdx=0; mediaIdx<mediaJsonArray.length(); mediaIdx++) {
|
||||
final JSONObject mediumJsonObject = mediaJsonArray.getJSONObject(mediaIdx);
|
||||
final FediMedium medium = new FediMedium();
|
||||
medium.setMediumType(FediMedium.IMAGE);
|
||||
if (mediumJsonObject.has("description") && mediumJsonObject.get("description") instanceof String) {
|
||||
medium.setDescription(mediumJsonObject.getString("description"));
|
||||
}
|
||||
medium.setMediumUrl(mediumJsonObject.getString("preview_url"));
|
||||
medium.setMediumImage(mediumJsonObject.getString("url"));
|
||||
post.addFediMedium(medium);
|
||||
}
|
||||
}
|
||||
fedipage.append(post);
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
}
|
||||
|
||||
.container {
|
||||
max-width: 960px;
|
||||
max-width: 800px;
|
||||
margin: 0 auto;
|
||||
background: #282c37;
|
||||
min-height: 100vh;
|
||||
@@ -218,7 +218,7 @@
|
||||
|
||||
.media-item img {
|
||||
width: 100%;
|
||||
height: 360px;
|
||||
height: 240px;
|
||||
object-fit: cover;
|
||||
cursor: pointer;
|
||||
}
|
||||
@@ -288,6 +288,12 @@
|
||||
#foreach( $post in $page.timeline )
|
||||
<div class="post">
|
||||
#set ( $image_class = 'single' )
|
||||
#if ( $post.media.size() > 1)
|
||||
#set ( $image_class = 'double' )
|
||||
#end
|
||||
#if ( $post.media.size() > 2)
|
||||
#set ( $image_class = 'multiple' )
|
||||
#end
|
||||
#set ( $post_date = $dateformatter.format( $post.createdAt ) )
|
||||
#if ( $post.pinned )
|
||||
<div class="boost-indicator">📌 Angeheftet</div>
|
||||
|
||||
@@ -1,365 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="de">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>$page.fediProfile.displayName - $page.fediProfile.username</title>
|
||||
<style>
|
||||
* {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
body {
|
||||
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
|
||||
background: #1a1a1a;
|
||||
color: #ffffff;
|
||||
line-height: 1.6;
|
||||
}
|
||||
|
||||
.container {
|
||||
max-width: 960px;
|
||||
margin: 0 auto;
|
||||
background: #282c37;
|
||||
min-height: 100vh;
|
||||
}
|
||||
|
||||
.header {
|
||||
position: relative;
|
||||
height: 200px;
|
||||
background: linear-gradient(45deg, #6364ff, #563acc);
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.banner {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
object-fit: cover;
|
||||
}
|
||||
|
||||
.profile-section {
|
||||
position: relative;
|
||||
padding: 0 20px 20px;
|
||||
background: #282c37;
|
||||
}
|
||||
|
||||
.profile-avatar {
|
||||
width: 80px;
|
||||
height: 80px;
|
||||
border-radius: 50%;
|
||||
border: 4px solid #282c37;
|
||||
margin-top: -40px;
|
||||
background: #fff;
|
||||
}
|
||||
|
||||
.profile-info {
|
||||
margin-top: 15px;
|
||||
}
|
||||
|
||||
.display-name {
|
||||
font-size: 20px;
|
||||
font-weight: bold;
|
||||
margin-bottom: 5px;
|
||||
}
|
||||
|
||||
.username {
|
||||
color: #9baec8;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
.username a {
|
||||
color: #9baec8;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.bio {
|
||||
margin-bottom: 15px;
|
||||
line-height: 1.5;
|
||||
}
|
||||
|
||||
.stats {
|
||||
display: flex;
|
||||
gap: 20px;
|
||||
font-size: 14px;
|
||||
color: #9baec8;
|
||||
}
|
||||
|
||||
.controls {
|
||||
padding: 20px;
|
||||
background: #313543;
|
||||
border-bottom: 1px solid #393f4f;
|
||||
}
|
||||
|
||||
.checkbox-group {
|
||||
display: flex;
|
||||
gap: 20px;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.checkbox-group label {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
cursor: pointer;
|
||||
color: #9baec8;
|
||||
}
|
||||
|
||||
.checkbox-group input[type="checkbox"] {
|
||||
accent-color: #6364ff;
|
||||
}
|
||||
|
||||
.posts {
|
||||
background: #282c37;
|
||||
}
|
||||
|
||||
.post {
|
||||
border-bottom: 1px solid #393f4f;
|
||||
padding: 15px 20px;
|
||||
}
|
||||
|
||||
.post-header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 10px;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
.post-avatar {
|
||||
width: 40px;
|
||||
height: 40px;
|
||||
border-radius: 50%;
|
||||
}
|
||||
|
||||
.post-user {
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.post-display-name {
|
||||
font-weight: bold;
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
.post-username {
|
||||
color: #9baec8;
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
.post-username a {
|
||||
color: #9baec8;
|
||||
font-size: 13px;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.post-date {
|
||||
color: #9baec8;
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
.post-date a {
|
||||
color: #9baec8;
|
||||
font-size: 13px;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.post-content {
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
.post-content p {
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
.post-content a {
|
||||
color: #6364ff;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.post-content a:hover {
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
.hashtag {
|
||||
color: #00d4aa;
|
||||
}
|
||||
|
||||
.mention {
|
||||
color: #6364ff;
|
||||
}
|
||||
|
||||
.post-media {
|
||||
margin-top: 10px;
|
||||
}
|
||||
|
||||
.media-grid {
|
||||
display: grid;
|
||||
gap: 4px;
|
||||
border-radius: 8px;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.media-grid.single {
|
||||
grid-template-columns: 1fr;
|
||||
}
|
||||
|
||||
.media-grid.double {
|
||||
grid-template-columns: 1fr 1fr;
|
||||
}
|
||||
|
||||
.media-grid.multiple {
|
||||
grid-template-columns: 1fr 1fr;
|
||||
grid-template-rows: 1fr 1fr;
|
||||
}
|
||||
|
||||
.media-item {
|
||||
position: relative;
|
||||
background: #000;
|
||||
}
|
||||
|
||||
.media-item img {
|
||||
width: 100%;
|
||||
height: 360px;
|
||||
object-fit: cover;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.post-stats {
|
||||
display: flex;
|
||||
gap: 15px;
|
||||
margin-top: 10px;
|
||||
color: #9baec8;
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
.boost-indicator {
|
||||
color: #00d4aa;
|
||||
font-size: 13px;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
.loading {
|
||||
text-align: center;
|
||||
padding: 40px;
|
||||
color: #9baec8;
|
||||
}
|
||||
|
||||
.error {
|
||||
text-align: center;
|
||||
padding: 40px;
|
||||
color: #ff5050;
|
||||
}
|
||||
|
||||
.refresh-btn {
|
||||
background: #6364ff;
|
||||
color: white;
|
||||
border: none;
|
||||
padding: 8px 16px;
|
||||
border-radius: 20px;
|
||||
cursor: pointer;
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
.refresh-btn:hover {
|
||||
background: #5a5bef;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="container">
|
||||
<div class="header">
|
||||
<img id="banner" class="banner" alt="Banner" src="$page.fediProfile.headerUrl">
|
||||
</div>
|
||||
|
||||
<div class="profile-section">
|
||||
<img id="avatar" class="profile-avatar" alt="Avatar" src="$page.fediProfile.avatarUrl">
|
||||
<div class="profile-info">
|
||||
<div id="displayName" class="display-name">$page.fediProfile.displayName</div>
|
||||
<div id="username" class="username"><a href="$profile.url">$page.fediProfile.username</a></div>
|
||||
<div id="bio" class="bio">$page.fediProfile.description</div>
|
||||
<div class="stats">
|
||||
<span id="followingCount">$page.fediProfile.following Folgt</span>
|
||||
<span id="followersCount">$page.fediProfile.followers Follower</span>
|
||||
<span id="statusesCount">$page.fediProfile.posts Beiträge</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!--
|
||||
<div class="controls">
|
||||
<div class="checkbox-group">
|
||||
<label>
|
||||
<input type="checkbox" id="includeBoosts">
|
||||
Geteilte Inhalte anzeigen
|
||||
</label>
|
||||
<label>
|
||||
<input type="checkbox" id="includeReplies">
|
||||
Antworten anzeigen
|
||||
</label>
|
||||
<button class="refresh-btn" onclick="loadPosts()">Aktualisieren</button>
|
||||
</div>
|
||||
</div>
|
||||
-->
|
||||
|
||||
<!--
|
||||
<div id="loading" class="loading">Lade Daten...</div>
|
||||
<div id="error" class="error" style="display: none;"></div>
|
||||
-->
|
||||
<div id="posts" class="posts">
|
||||
#foreach( $post in $page.fediTimeline )
|
||||
#set ( $image_class = 'single' )
|
||||
#set ( $post_date = $dateformatter.format( $post.createdAt ) )
|
||||
<div class="post">
|
||||
#if ( $post.pinned )
|
||||
<div class="boost-indicator">📌 Angeheftet</div>
|
||||
#end
|
||||
#if ( $post.boosted )
|
||||
<div class="boost-indicator">🔄 $page.fediProfile.displayName hat geteilt</div>
|
||||
#end
|
||||
<div class="post-header">
|
||||
<img class="post-avatar" src="$post.authorAvatarUrl" alt="Avatar">
|
||||
<div class="post-user">
|
||||
<div class="post-display-name">$post.authorDisplayName</div>
|
||||
<div class="post-username"><a href="#">$post.authorHandle</a></div>
|
||||
</div>
|
||||
<div class="post-date"><a href="$post.postUrl" target="_blank">$post_date</a></div>
|
||||
</div>
|
||||
<div class="post-content">$post.content</div>
|
||||
#if( $post.media_attachments.length > 0 )
|
||||
#if( $post.media_attachments.length > 1 )
|
||||
#set ( $image_class = 'double' )
|
||||
#end
|
||||
#if( $post.media_attachments.length > 2 )
|
||||
#set ( $image_class = 'multiple' )
|
||||
#end
|
||||
<div class="post-media">
|
||||
<div class="media-grid $image_class">
|
||||
#foreach( $media_item in $post.media_attachments )
|
||||
<div class="media-item">
|
||||
<img src="$media_item.preview_url" alt="$media_item.description" onclick="window.open('$media_item.url', '_blank')">
|
||||
</div>
|
||||
#end
|
||||
</div>
|
||||
</div>
|
||||
#else
|
||||
#if( $post.card )
|
||||
<div class="post-media">
|
||||
<div class="media-grid single">
|
||||
<div class="media-item">
|
||||
<img src="$post.card.image" alt="$post.card.description" onclick="window.open('$post.card.url', '_blank')">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
#end
|
||||
#end
|
||||
<div class="post-stats">
|
||||
<span>🔄 $post.boosts</span>
|
||||
<span>⭐ $post.likes</span>
|
||||
<span>💬 $post.comments</span>
|
||||
js </div>
|
||||
</div>
|
||||
#end
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user