Files
StarPunk/templates/admin/new.html
Phil Skentelbery dd822a35b5 feat: v1.2.0-rc.1 - IndieWeb Features Release Candidate
Complete implementation of v1.2.0 "IndieWeb Features" release.

## Phase 1: Custom Slugs
- Optional custom slug field in note creation form
- Auto-sanitization (lowercase, hyphens only)
- Uniqueness validation with auto-numbering
- Read-only after creation to preserve permalinks
- Matches Micropub mp-slug behavior

## Phase 2: Author Discovery + Microformats2
- Automatic h-card discovery from IndieAuth identity URL
- 24-hour caching with graceful fallback
- Never blocks login (per ADR-061)
- Complete h-entry, h-card, h-feed markup
- All required Microformats2 properties
- rel-me links for identity verification
- Passes IndieWeb validation

## Phase 3: Media Upload
- Upload up to 4 images per note (JPEG, PNG, GIF, WebP)
- Automatic optimization with Pillow
  - Auto-resize to 2048px
  - EXIF orientation correction
  - 95% quality compression
- Social media-style layout (media top, text below)
- Optional captions for accessibility
- Integration with all feed formats (RSS, ATOM, JSON Feed)
- Date-organized storage with UUID filenames
- Immutable caching (1 year)

## Database Changes
- migrations/006_add_author_profile.sql - Author discovery cache
- migrations/007_add_media_support.sql - Media storage

## New Modules
- starpunk/author_discovery.py - h-card discovery and caching
- starpunk/media.py - Image upload, validation, optimization

## Documentation
- 4 new ADRs (056, 057, 058, 061)
- Complete design specifications
- Developer Q&A with 40+ questions answered
- 3 implementation reports
- 3 architect reviews (all approved)

## Testing
- 56 new tests for v1.2.0 features
- 842 total tests in suite
- All v1.2.0 feature tests passing

## Dependencies
- Added: mf2py (Microformats2 parser)
- Added: Pillow (image processing)

Version: 1.2.0-rc.1

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-28 15:02:20 -07:00

153 lines
4.1 KiB
HTML

{% extends "admin/base.html" %}
{% block title %}New Note - StarPunk Admin{% endblock %}
{% block admin_content %}
<div class="note-editor">
<h2>Create New Note</h2>
<form action="{{ url_for('admin.create_note_submit') }}" method="POST" enctype="multipart/form-data" class="note-form">
<div class="form-group">
<label for="content">Content (Markdown)</label>
<textarea
id="content"
name="content"
rows="20"
placeholder="Write your note in markdown..."
required
autofocus
></textarea>
<small>Use Markdown syntax for formatting</small>
</div>
<div class="form-group">
<label for="custom_slug">Custom Slug (optional)</label>
<input type="text"
id="custom_slug"
name="custom_slug"
pattern="[a-z0-9-]+"
placeholder="leave-blank-for-auto-generation"
class="form-control">
<small class="form-text text-muted">
Lowercase letters, numbers, and hyphens only.
Leave blank to auto-generate from content.
</small>
</div>
<div class="form-group">
<label for="media_files">Images (optional, max 4)</label>
<input type="file"
name="media_files"
id="media_files"
accept="image/jpeg,image/png,image/gif,image/webp"
multiple
class="form-control">
<small class="form-text text-muted">
JPEG, PNG, GIF, WebP only. Max 10MB per file, 4 images total.
Images will appear at the top of your note.
</small>
</div>
<!-- Preview area (filled via JavaScript after file selection) -->
<div id="media-preview" class="media-preview" style="display: none;"></div>
<div class="form-group form-checkbox">
<input type="checkbox" id="published" name="published" checked>
<label for="published">Publish immediately</label>
</div>
<div class="form-actions">
<button type="submit" class="button button-primary">Create Note</button>
<a href="{{ url_for('admin.dashboard') }}" class="button button-secondary">Cancel</a>
</div>
</form>
</div>
{% endblock %}
{% block head %}
{{ super() }}
<script src="https://cdn.jsdelivr.net/npm/marked/marked.min.js"></script>
<script src="{{ url_for('static', filename='js/preview.js') }}"></script>
<style>
.media-preview {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
gap: 1rem;
margin: 1rem 0;
padding: 1rem;
background: #f5f5f5;
border-radius: 4px;
}
.media-preview-item {
border: 1px solid #ddd;
padding: 0.5rem;
border-radius: 4px;
background: white;
}
.media-preview-item img {
width: 100%;
height: auto;
display: block;
margin-bottom: 0.5rem;
border-radius: 2px;
}
.caption-input {
width: 100%;
padding: 0.5rem;
border: 1px solid #ddd;
border-radius: 4px;
font-size: 0.9rem;
}
</style>
<script>
// Media upload preview and caption handling
// Per Q3: Show preview after selection
// Per Q7: Allow caption input per image
document.addEventListener('DOMContentLoaded', function() {
const fileInput = document.getElementById('media_files');
const preview = document.getElementById('media-preview');
fileInput.addEventListener('change', function(e) {
const files = Array.from(e.target.files);
if (files.length === 0) {
preview.style.display = 'none';
preview.innerHTML = '';
return;
}
if (files.length > 4) {
alert('Maximum 4 images allowed');
e.target.value = '';
return;
}
preview.innerHTML = '';
preview.style.display = 'grid';
files.forEach((file, index) => {
const reader = new FileReader();
reader.onload = function(event) {
const div = document.createElement('div');
div.className = 'media-preview-item';
div.innerHTML = `
<img src="${event.target.result}" alt="Preview ${index + 1}">
<input type="text"
name="captions[]"
placeholder="Caption (optional)"
class="caption-input">
`;
preview.appendChild(div);
};
reader.readAsDataURL(file);
});
});
});
</script>
{% endblock %}