shebaoting/flarum-repost
Composer 安装命令:
composer require shebaoting/flarum-repost
包简介
A Flarum extension that redirects to the original URL if specified when posting.
关键字:
README 文档
README
Repost is a Flarum 2.x extension for publishing link-based discussions. If a new discussion starts with an HTTP or HTTPS URL, the extension stores that URL as the discussion's original source and turns the discussion list title into an external link. The local discussion page remains available, so community members can still reply, moderate, and discuss the linked content inside Flarum.
Features
- Detects URLs at the beginning of new discussion content.
- Stores the detected URL on the discussion as
originalUrl. - Shows the source domain in the discussion list metadata.
- Opens the original source URL when users click the discussion title/list main area.
- Keeps the reply/comment count linked to the local Flarum discussion page.
- Displays a notice on the discussion page to show that the topic is a reposted source.
- Adds an admin permission for controlling who can extract and save original URLs.
- Supports existing 1.x data stored in the
discussions.original_urlcolumn. - Ships English and Chinese translation files.
Requirements
- Flarum
^2.0.0-beta - PHP
^8.3
This extension is intended for Flarum 2.x. Use the v0.x series for old Flarum 1.x installations.
Installation
Install the extension with Composer:
composer require shebaoting/flarum-repost:"^2.0"
php flarum migrate
php flarum cache:clear
If you are using a local path repository during development, require the same 2.x constraint from your Flarum app:
composer require shebaoting/flarum-repost:"^2.0" -W
php flarum migrate
php flarum cache:clear
Updating
composer update shebaoting/flarum-repost -W php flarum migrate php flarum cache:clear
If your forum still requires the old package name, switch the Composer requirement first:
composer remove shebaoting/repost --no-update
composer require shebaoting/flarum-repost:"^2.0" -W
After clearing the cache, refresh the forum page in the browser so Flarum regenerates the combined frontend assets.
Configuration
Go to Admin > Permissions and configure the Repost permission:
- Extract original URL: users with this permission can create discussions whose first line starts with a URL and have that URL saved as the discussion's original source.
Users without this permission can still create normal discussions, but the extension will not save an originalUrl value for them.
Usage
Create a discussion whose content starts with a full URL:
https://example.com/article
This is a short note about why this article is worth discussing.
When the discussion is published:
- The URL is stored as the discussion's original source.
- The discussion list shows the source domain, for example
example.com. - Clicking the discussion title opens the original source in a new tab.
- Clicking the reply/comment icon or number opens the local Flarum discussion page.
- Replies, moderation actions, tags, subscriptions, and other Flarum discussion features continue to work on the local page.
Behavior Details
Only URLs that appear at the very beginning of the discussion content are extracted. The URL must start with http:// or https://.
The extension does not fetch, scrape, or copy the remote page. It only stores the source URL and adjusts the discussion list link behavior.
The local discussion URL remains the canonical place for comments. This is useful for RSS imports, news sharing, bookmarks, link roundups, and communities where users want to discuss external content without duplicating the full article.
Data And Migration Notes
Repost stores the original source URL in the discussions.original_url column.
For Flarum 1.x upgrades, existing values in this column are preserved. The migration is idempotent and will not recreate the column if it already exists.
Development
Install JavaScript dependencies and build the frontend assets:
cd js
corepack yarn install
corepack yarn build
Useful checks:
composer validate --no-check-publish find . -path './vendor' -prune -o -name '*.php' -print0 | xargs -0 -n1 php -l
Troubleshooting
If the discussion list still links every part of a reposted discussion to the external source, clear Flarum's cache and refresh the forum:
php flarum cache:clear
If the original URL is not saved, check that the actor has the Extract original URL permission and that the discussion content begins directly with an http:// or https:// URL.
Links
License
This extension is open-sourced software licensed under the MIT license.
统计信息
- 总下载量: 0
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2026-06-26