mirror of
https://github.com/svemagie/indiekit-endpoint-youtube.git
synced 2026-04-02 15:54:59 +02:00
Adds OAuth 2.0 flow to connect a YouTube account and sync liked videos as "like" posts on the blog. Includes: - OAuth authorize/callback/disconnect flow with token persistence - getLikedVideos() method using videos.list?myRating=like - Background periodic sync + manual sync trigger - Dashboard UI for connection status and sync controls - Public JSON API for querying synced likes Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
54 lines
1.9 KiB
Plaintext
54 lines
1.9 KiB
Plaintext
{% extends "layouts/youtube.njk" %}
|
|
|
|
{% block youtube %}
|
|
<h2>{{ __("youtube.likes.title") }}</h2>
|
|
|
|
{% if error %}
|
|
{{ prose({ text: error.message }) }}
|
|
{% else %}
|
|
|
|
{# OAuth connection status #}
|
|
<div class="youtube-likes-status">
|
|
{% if isConnected %}
|
|
<div class="youtube-likes-connected">
|
|
<span class="youtube-likes-status__badge youtube-likes-status__badge--connected">
|
|
{{ __("youtube.likes.connected") }}
|
|
</span>
|
|
<form method="post" action="{{ mountPath }}/likes/disconnect" style="display:inline;">
|
|
{{ button({ type: "submit", text: __("youtube.likes.disconnect"), classes: "button--secondary" }) }}
|
|
</form>
|
|
</div>
|
|
{% else %}
|
|
<p>{{ __("youtube.likes.description") }}</p>
|
|
{{ button({ href: mountPath + "/likes/connect", text: __("youtube.likes.connect") }) }}
|
|
{% endif %}
|
|
</div>
|
|
|
|
{# Sync controls (only when connected) #}
|
|
{% if isConnected %}
|
|
<div class="youtube-likes-sync" style="margin-block-start: var(--space-l);">
|
|
{% call section({ title: __("youtube.likes.sync") }) %}
|
|
<form method="post" action="{{ mountPath }}/likes/sync">
|
|
{{ button({ type: "submit", text: __("youtube.likes.syncNow") }) }}
|
|
</form>
|
|
|
|
{% if lastSync %}
|
|
<div class="youtube-likes-sync__info" style="margin-block-start: var(--space-s);">
|
|
<p>
|
|
{{ __("youtube.likes.lastSync") }}:
|
|
<time datetime="{{ lastSync.lastSyncAt }}">{{ lastSync.lastSyncAt }}</time>
|
|
</p>
|
|
<p>
|
|
{{ lastSync.synced }} {{ __("youtube.likes.newLikes") }},
|
|
{{ lastSync.skipped }} {{ __("youtube.likes.skippedLikes") }},
|
|
{{ lastSync.total }} {{ __("youtube.likes.totalLikes") }}
|
|
</p>
|
|
</div>
|
|
{% endif %}
|
|
{% endcall %}
|
|
</div>
|
|
{% endif %}
|
|
|
|
{% endif %}
|
|
{% endblock %}
|