=== Nostalgie ===
Contributors: dekuderek
Tags: instagram, archive, import, media, gallery
Requires at least: 6.3
Tested up to: 7.1
Requires PHP: 8.0
Stable tag: 1.4.5
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Bring your Instagram data export into WordPress with posts, captions, dates and emoji intact, and every file kept private on your own site.

== Description ==

Nostalgie is not affiliated with, endorsed by, or sponsored by Instagram or Meta.

Instagram will hand you your entire history as a ZIP file, a perfect keepsake
you can't actually look at. Nostalgie unpacks that download onto your own
WordPress site so you can finally use it.

Your posts and carousels are imported with their original dates, captions,
hashtags and emoji, and every media file is stored **privately**: Nostalgie
writes a deny rule over its own uploads folder, so the files are not publicly
addressable. They reach a browser only through a protected endpoint that checks
permission first, and only on the pages you choose to put them on.

**Your export stays the master copy.** Nostalgie reads it and never changes it.
Imports are safe to repeat: duplicates are detected and skipped, and anything
you've organised afterwards is preserved. You can clear everything and rebuild
from your ZIP at any time.

= What it does =

* **Imports posts, carousels and archived posts** from the official Instagram
  data export, either through WP-CLI or a browser importer that batches its work
  so large archives don't time out.
* **Keeps the details right.** Original timestamps (posts are backdated to when
  you posted them), captions with full emoji fidelity, hashtags, and the place
  name you tagged when posting.
* **Protects your media.** Files are denied at the web-server level and served
  only through a permission-checked endpoint with proper range support, so video
  scrubbing and browser caching still work.
* **Displays anywhere.** Drop a photo, video or a whole carousel into any page
  or post with the `[nostalgie]` block or shortcode. Media is addressed by
  stable Instagram ids, so your embeds keep working even after you clear and
  re-import.
* **Pick media by looking at it.** The block opens your imported archive and
  lets you search it by caption, hashtag or tagged place, so you never have to
  know a filename. The Media Library gives your imports their own filter
  (images, videos, carousels, stories, archived) and offers a ready-to-paste
  block for any single file.
* **Says what an import will store, before it runs.** Both the Import button
  and the WP-CLI command show what will land on your server, who will be able
  to see it, and what looking after it means for you.
* **Works with AI assistants.** Nostalgie registers a WordPress ability, so an
  assistant connected to your site can find a post by what you wrote, the
  hashtags you used, or the place you tagged, and hand back the exact block to
  paste in. Read-only, and limited to users who can already edit posts.
* **Generates video cover images** with ffmpeg when your host provides it, and
  degrades gracefully when it doesn't.

= Privacy =

Nostalgie does **not** connect to Instagram, log in to anything, or sync live
data. It reads the export file you downloaded yourself. The free edition makes
no outbound network requests at all, so nothing about your archive leaves your
server.

= Nostalgie Pro =

A paid edition makes your archive searchable. It imports the deeper parts of the
export (stories, comments and direct messages) and adds a gallery app on your own
domain where you can search all of it, put your photos on a map, and browse by
hashtag or by what you posted on this day in earlier years. Every account is
private unless you say otherwise, several accounts can live on one site, and
anything you do choose to make public gets a shareable embed. The free edition
described here is complete in itself: nothing above is disabled or time-limited.

= Not affiliated with Instagram =

Nostalgie is an independent project. It is not affiliated with, endorsed by, or
sponsored by Instagram or Meta Platforms, Inc. "Instagram" is used only to
describe the data-export format this plugin reads.

== Installation ==

1. Upload the plugin to `/wp-content/plugins/nostalgie/`, or install it through
   the WordPress **Plugins** screen.
2. Activate it. Activation creates the database tables and writes the deny rule
   that keeps your imported media private.
3. Request your data export from Instagram (**Settings → Accounts Centre → Your
   information and permissions → Download your information**). Choose **JSON**
   format. Nostalgie cannot read the HTML export.
4. Go to **Nostalgie → Import** in your admin and upload the ZIP, or run
   `wp nostalgie import /path/to/export.zip` if you prefer WP-CLI.
5. Add media to a page with the **Nostalgie Media** block, or the
   `[nostalgie post="..."]` shortcode.

**nginx users:** the automatic deny rule is an Apache `.htaccess` file. On nginx,
add the equivalent `location` block shown on the plugin's Diagnostics screen,
otherwise your imported files stay publicly reachable.

== Frequently Asked Questions ==

= Does this connect to Instagram? =

No. It reads the export ZIP you download from Instagram yourself. It never logs
in, scrapes, or syncs. Your archive is as current as your most recent export.

= Is my imported media private? =

Yes, by default. Nostalgie stores media in its own uploads folder and writes a
web-server rule denying direct access to it. Files are served only through a
permission-checked endpoint, and only for the pages where you've placed them.
Media you have not put on a page is not reachable from the web at all.

= Can I run the import more than once? =

Yes, that's the intended workflow. Already-imported posts are detected and
skipped, so re-running with a newer export only adds what's new. Changes you've
made afterwards are preserved.

= Which export format do I need? =

**JSON**, not HTML. When you request your download from Instagram, choose JSON
as the format. Pick the date range and media quality you want, and Nostalgie
reads whatever the ZIP contains.

= Do I need ffmpeg? =

No. If your host has ffmpeg, Nostalgie extracts a cover frame for each video.
Without it, videos import normally and simply show the standard media icon.

= What does the AI integration actually do? =

It publishes a single read-only lookup that answers "which imported post is
this?" It searches your captions, hashtags and tagged place names, returning
the post's id plus a ready-to-paste block. It sends nothing anywhere and needs no
API key. The assistant is whatever you've connected to your own site. It requires
WordPress 6.9 or newer and is simply absent on older versions.

= Does it work with a page cache? =

Media URLs are time-limited, so a full-page cache can serve an expired one and
the media will fail to load until the cache refreshes. Exclude pages containing
Nostalgie media from full-page caching.

== Screenshots ==

1. Imported photos and videos in the Media Library, filtered to your Nostalgie import (video thumbnails via ffmpeg).
2. Picking and sizing imported media with the Nostalgie Media block, right in the editor.
3. The Accounts screen after an import: post/file counts and per-account media access.

== Changelog ==

= 1.4.5 =
* Fix: media set to a fixed size keeps that size inside a carousel.
* Change: the admin notices and info popovers are written in plain English.

= 1.3.1 =
* Fix: the "ffmpeg is not installed" notice under the thumbnail-fill button sits on its own line.

= 1.3.0 =
* Security: guard plugin files against direct access.
* New: a site-wide setting to disallow embedding your posts on other sites.
* New: video posters are generated in the browser on hosts without ffmpeg installed.
* Fix: the media block carousel's previous and next buttons now move reliably between items.

= 1.1.1 =
* New: the media block's carousel has previous and next buttons for moving between items, and its scrollbar is hidden.
* Fix: creating or updating the database tables no longer logs a database error about a text column's default value.

= 1.1.0 =
* New: search now ranks results by relevance and finds a post by its tagged place name.
* New: limit an import to a range of months, using the date filter in the import options.
* New: the "wp nostalgie set-owner" command assigns an imported account to a WordPress user.
* Change: imported media is now organized into a per-account subfolder.
* Hardening: stronger input sanitizing and output escaping throughout.

= 1.0.2 =
* Fix: in the free edition, the block's carousel toggle is now hidden
  rather than shown disabled.
* Passes the official WordPress Plugin Check tool with no warnings.
