shebaoting/repost 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

shebaoting/repost

Composer 安装命令:

composer require shebaoting/repost

包简介

A Flarum extension that redirects to the original URL if specified when posting.

关键字:

README 文档

README

License Latest Stable Version Total Downloads

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_url column.
  • 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:

  1. The URL is stored as the discussion's original source.
  2. The discussion list shows the source domain, for example example.com.
  3. Clicking the discussion title opens the original source in a new tab.
  4. Clicking the reply/comment icon or number opens the local Flarum discussion page.
  5. 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.

shebaoting/repost 适用场景与选型建议

shebaoting/repost 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 728 次下载、GitHub Stars 达 0, 最近一次更新时间为 2024 年 08 月 30 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「flarum」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 shebaoting/repost 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 shebaoting/repost 我们能提供哪些服务?
定制开发 / 二次开发

基于 shebaoting/repost 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 728
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 18
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2024-08-30