Backend (new apps.follows): - FollowedTag/FollowedPool/FollowedPost models; per-user follows with unseen tracking, plus FollowCloud for the cached blacklist cloud. - Two periodic commands sharing one fetch path: sync_followed_tags and sync_followed_pools fetch each followed tag/pool's newest posts (one e621 search per unique follow), store unseen feed rows, refresh covers and pool metadata; both fall back to anonymous e621 access. - API: /api/follows/tags|pools (follow, unfollow, mark seen), a merged feed with per-follow filtering, and /api/follows/cloud/ which rebuilds the blacklisted-tag cloud in a daemon thread when its 10 min cache is stale (polling returns building/ready). - e621 client now supports anonymous reads; trimmed posts carry preview URLs for covers and feed tiles. Frontend: - /followed page: follow forms, cover cards with unseen badges and Mark seen, merged feed with filter/unseen toggle, and a blacklist cloud panel that polls while building. Followed nav entry added.
54 lines
1.2 KiB
Python
54 lines
1.2 KiB
Python
from rest_framework import serializers
|
|
|
|
from .models import FollowedPool, FollowedTag
|
|
|
|
|
|
class FollowedTagSerializer(serializers.ModelSerializer):
|
|
unseen_count = serializers.IntegerField(read_only=True)
|
|
|
|
class Meta:
|
|
model = FollowedTag
|
|
fields = [
|
|
"id",
|
|
"tag",
|
|
"unseen_count",
|
|
"cover_data",
|
|
"last_synced_at",
|
|
"created_at",
|
|
]
|
|
read_only_fields = [
|
|
"id",
|
|
"tag",
|
|
"unseen_count",
|
|
"cover_data",
|
|
"last_synced_at",
|
|
"created_at",
|
|
]
|
|
|
|
|
|
class FollowedPoolSerializer(serializers.ModelSerializer):
|
|
unseen_count = serializers.IntegerField(read_only=True)
|
|
|
|
class Meta:
|
|
model = FollowedPool
|
|
fields = [
|
|
"id",
|
|
"pool_id",
|
|
"name",
|
|
"post_count",
|
|
"unseen_count",
|
|
"cover_data",
|
|
"last_synced_at",
|
|
"created_at",
|
|
]
|
|
read_only_fields = [
|
|
"id",
|
|
"pool_id",
|
|
"name",
|
|
"post_count",
|
|
"unseen_count",
|
|
"cover_data",
|
|
"last_synced_at",
|
|
"created_at",
|
|
]
|