Flarum常用插件extensions

官方插件网址:https://flagrow.io

后面内容可以忽略。。。。。

目前是Flarum 0.1.0-beta8;安装 composer require  xxxxx/ccccc

以下未作标识的一般是官方自带插件,默认开启。(其实是我懒得写,哈哈哈哈哈)

MySQL 自 5.7 开始支持 FULLTEXT 中文搜寻,重建索引即可

修改 mysql.cnf,加入:

[mysqld]
ngram_token_size=2

修改后需要重建 FULLTEXT 索引

ALTER TABLE 数据库前缀_posts DROP INDEX content;
CREATE FULLTEXT INDEX content ON `数据库前缀_posts` (`content`) WITH PARSER ngram;

ALTER TABLE 数据库前缀_discussions DROP INDEX title;
CREATE FULLTEXT INDEX title ON `数据库前缀_discussions` (`title`) WITH PARSER ngram;

 

注意:flarum-ext-chinese-search 基于xunsearch,每次服务器重启,要将xunsearch重启,不然会发帖失败的!巨坑

具体操作:

1.、/etc/rc.local 中添加xunsearch自启动:

chmod +x /www/server/xunsearch/bin/xs-ctl.sh & /www/server/xunsearch/bin/xs-ctl.sh start

2、将/etc/rc.local和/etc/rc.d/rc.loacal加可执行权限

chmod +x /etc/rc.d/rc.local
chmod +x /etc/rc.local

 composer.json文件如下:

"csineneo/lang-simplified-chinese": "v0.1.0-beta.8.25",#中文简体语言包
"datitisev/flarum-ext-dashboard": "^0.1.0@beta",#仪表盘,插件归类到概况下
"flagrow/ads": "^0.2.0@beta",#官方广告插件
"flagrow/bazaar": "^0.3.9",#应用商店
"flagrow/sitemap": "^0.2.0",#sitemap地图
"flagrow/terms": "^0.3.1",#网站使用协议
"flagrow/upload": "^0.7.1",#上传文件
"flarum/approval": "^0.1.0",
"flarum/auth-facebook": "^0.1.0",
"flarum/auth-github": "^0.1.0",
"flarum/auth-twitter": "^0.1.0",
"flarum/bbcode": "^0.1.0",
"flarum/core": "^0.1.0",
"flarum/emoji": "^0.1.0",
"flarum/flags": "^0.1.0",
"flarum/lang-english": "^0.1.0",
"flarum/likes": "^0.1.0",
"flarum/lock": "^0.1.0",
"flarum/markdown": "^0.1.0",#官方MarkDown,开启后发帖方便
"flarum/mentions": "^0.1.0",
"flarum/pusher": "^0.1.0",
"flarum/statistics": "^0.1.0",
"flarum/sticky": "^0.1.0",
"flarum/subscriptions": "^0.1.0",
"flarum/suspend": "^0.1.0",
"flarum/tags": "^0.1.0",
"fof/links": "^0.1.1",#导航栏加链接的
"fof/pages": "^0.2.2",#生成静态页的(潜在网站中)
"fof/recaptcha": "^0.1.0",#谷歌验证(目前只是在注册时有效,但是我试了下 出了bug,所以没用)
"ganuonglachanh/flarum-ext-markdown-editor": "^0.9.0",#Markdown编辑器(个人使用有bug无法发帖。。。用的默认的)
"jjandxa/flarum-ext-chinese-search": "^0.0.8",#中文搜索(需要先安装xunsearch)
"jordanjay29/flarum-ext-summaries": "^0.3.1"#在首页显示帖子的摘要,不过我测试只在PC端显示,移动端不能显示啊。。。不知道怎么设置)
"michaelbelgium/flarum-discussion-views": "^0.1.0@beta",#显示话题讨论的进度等等,仅在Pc端显示
"reflar/uncache": "^0.1.0@beta",#自动清除cache的东西(每安装一个新插件自动清除???不知道懵逼脸,反正没bug,开着吧)
"s9e/flarum-ext-autoimage": "^1.1",#上传的图片文件链接显示成图片
"wiwatsrt/flarum-ext-best-answer": "^0.2.1"#最佳回复!

 

 

我还需要解决的:

①https进论坛出错,只能http进入; config.php  把http://域名 改为 https://域名 注意一定要强制https,不然重启后http进入会出错

我还不知道怎么开启中文用户名(下方有命令)

用户是怎么分组的??? 用户发帖时,点击名片,用户编辑

---------

需要个签名signature插件论坛主线没有签名,所以插件被abandon

用户管理userlist安装失败了(貌似是没有更新,安装了user-directory,可以管理用户,但是不能群发邮件)

---------

⑥把首页默认的最新回复改为->最新发表,得去官方论坛问了

⑦手机端首页怎么显示摘要?(置顶帖自动显示,其他不显示)

-------

⑧CDN加速

⑨左侧广告只在PC端显示

<div class="no-mobile">
<style>
 .no-mobile{display: none;}
 @media (min-width: 960px){
 .no-mobile{display:inline;}
 }
 </style>
<p style="text-align: center; margin-top: 3em; margin-left: -90px;"><img style="max-width: 150px" src="http://y.cn/adv/gzer.jpg" alt="reward"><br>☕️请我喝杯咖啡 ☕️<br>^_^</p>
</div>

一些命令:(转载自https://github.com/Csineneo/flarum-hack/blob/master/hack.sh2019.9.26版本(可能会更新)

#! /bin/bash

GITHUB_ROOT="https://raw.githubusercontent.com/Csineneo/flarum-hack/master"

# 簡繁語言包及 BBCode
composer require csineneo/lang-traditional-chinese
composer require csineneo/lang-simplified-chinese
composer require csineneo/vivaldi-club-bbcode

# 其他
composer require dem13n/nickname-changer
composer require antoinefr/flarum-ext-money
composer require reflar/level-ranks
composer require flagrow/sitemap
composer require fof/upload
composer require fof/split
composer require fof/secure-https


# 用戶端語言識別
wget -qO "vendor/flarum/core/src/Locale/LocaleServiceProvider.php" \
	"$GITHUB_ROOT/flarum/core/src/Locale/LocaleServiceProvider.php"

# 簡繁自動轉換
wget -qO "vendor/flarum/core/src/Api/JsonApiResponse.php" \
	"$GITHUB_ROOT/flarum/core/src/Api/JsonApiResponse.php"

# 允許註冊中文名
sed -i "s#a-z0-9_-#-_a-z0-9\\\x7f-\\\xff#" \
  vendor/flarum/core/src/User/UserValidator.php

# 支援 @ 中文名
sed -i "s#a-z0-9_-#-_a-zA-Z0-9\\\x7f-\\\xff#" \
	vendor/flarum/mentions/src/ConfigureMentions.php

# 取消標題及用戶名最小長度限制
sed -i 's#min:3#min:1#' \
  vendor/flarum/core/src/User/UserValidator.php \
  vendor/flarum/core/src/Discussion/DiscussionValidator.php

# 加大貼文字數
# ALTER TABLE `posts` CHANGE `content` `content` mediumtext COLLATE 'utf8mb4_unicode_ci' NULL COMMENT ' ' AFTER `type`;
sed -i 's#65535#2147483647#' \
  vendor/flarum/core/src/Post/PostValidator.php

# 不限制管理員灌水
sed -i -r "s#(isFlooding = )#\1\$actor->id == '1' ? false : #" \
  vendor/flarum/core/src/Post/Floodgate.php

# 支援 vivaldi:// scheme
sed -i "/Autoemail/i\\\t\\t\$configurator->urlConfig->allowScheme('vivaldi');" \
  vendor/s9e/text-formatter/src/Configurator/Bundles/Fatdown.php
sed -i "/new SchemeList/a\\\t\\t\$this->allowedSchemes[] = 'vivaldi';" \
	vendor/s9e/text-formatter/src/Configurator/UrlConfig.php
sed -i 's#ftp|https#ftp|vivaldi|https#g' \
  vendor/s9e/text-formatter/src/Bundles/Fatdown.php

# 顯示發帖人 UA
# SQL: ALTER TABLE tbl_posts ADD user_agent varchar(255);
sed -i 's#\$ipAddress)#\$ipAddress\, string \$userAgent)#; /->ipAddress/a\\t\t\t\t$this->userAgent = $userAgent;' \
	vendor/flarum/core/src/Discussion/Command/StartDiscussion.php
sed -i -r '/new PostReply/s/(ipAddress)/\1, $userAgent/; /->ipAddress/a\\t\t\t\t$userAgent = $command->userAgent;' \
	vendor/flarum/core/src/Discussion/Command/StartDiscussionHandler.php
sed -i -e '/new StartDiscussion/s/)$/, \$userAgent)/' \
	-e "/ipAddress =/a\\\t\t\t\t\$userAgent = Arr::get(\$request->getServerParams(), 'HTTP_USER_AGENT', '');" \
	vendor/flarum/core/src/Api/Controller/CreateDiscussionController.php
sed -i -r 's#(ipAddress = null)#\1, string $userAgent#; /->ipAddress/a\\t\t\t\t$this->userAgent = $userAgent;' \
	vendor/flarum/core/src/Post/Command/PostReply.php
sed -i -r 's#(ipAddress)$#\1,#; /ipAddress/a\\t\t\t\t\t\t$command->userAgent' \
	vendor/flarum/core/src/Post/Command/PostReplyHandler.php
sed -i -e 's#ipAddress)#ipAddress, $userAgent)#' \
	-e "/ADDR/a\\\t\t\t\t\$userAgent = Arr::get(\$request->getServerParams(), 'HTTP_USER_AGENT', '');" \
	vendor/flarum/core/src/Api/Controller/CreatePostController.php
sed -i -e '/ip_address/a\\t\t\t\t$post->user_agent = $userAgent;' \
	-e 's#ipAddress)#ipAddress, $userAgent)#' \
	vendor/flarum/core/src/Post/CommentPost.php
sed -i "/contentHtml/a\\\t\t\t\t\t\t\$attributes['userAgent'] = \$post->user_agent;" \
	vendor/flarum/core/src/Api/Serializer/BasicPostSerializer.php
sed -i -r 's#(footerItems\(\).toArray\(\)\)\))#\1,m("small",{className:"ua"},e.props.post.data.attributes.userAgent\)#' \
	vendor/flarum/core/js/dist/forum.js

# 透過 Vivaldi PO 文享專屬 banner
#sed -i -r "s#(t.stopPropagation\(\)}}\)\))#\1,/Vivaldi/.test(t.data.attributes.userAgent)?m('img',{className:'viv-icon',src:'https://awk.tw/assets/images/viv-badge.png'}):''#" \
#	vendor/flarum/core/js/dist/forum.js

# URL 美化,移除 slug
sed -i '/discussion->slug/d' \
	vendor/flarum/core/src/Api/Serializer/BasicDiscussionSerializer.php
sed -i -r 's#(discussion->id).*$#\1#' \
  vendor/flarum/core/views/frontend/content/index.blade.php
sed -i '/idWithSlug =/s/\..*$/;/' \
	vendor/flarum/core/src/Forum/Content/Discussion.php
sed -i 's#+(i.trim()?"-"+i:"")##' \
  vendor/flarum/core/js/dist/forum.js

# 改為使用 UID 訪問用戶頁面
sed -i 's#username:e\.username#username:e.id#g' \
  vendor/flarum/core/js/dist/forum.js \
	vendor/flarum/mentions/js/dist/forum.js

# 允許搜尋長度小於三個字符的 ID
sed -i 's#length>=3\&#length>=1\&#' \
  vendor/flarum/core/js/dist/forum.js

# 在用戶卡片及用戶頁面中展示 UID
sed -i -r 's#(UserCard-info"},)#\1Object(T.a)("UID:\\t\\t"+t.id()),#' \
  vendor/flarum/core/js/dist/forum.js

# 新增 UID 至 PostStream
sed -i -r 's#(=i.contentType)#\1(),u["user-id"]=i.user().id#' \
  vendor/flarum/core/js/dist/forum.js

# 以絕對時間顯示
sed -i "s#-2592e6#-864e5#; s#D MMM#LLLL#; s#MMM 'YY#LLLL#" \
  vendor/flarum/core/js/dist/forum.js \
	vendor/flarum/core/js/dist/admin.js
sed -i 's#D MMM#L#g' \
	vendor/flarum/statistics/js/dist/admin.js

# 使用中文數位記法
sed -i 's#t>=1e3#t>=1e4#; s#(t\/1e3)#(t/1e4)#; s#kilo_text#ten_kilo_text#' \
  vendor/flarum/core/js/dist/admin.js \
  vendor/flarum/core/js/dist/forum.js
sed -i '/kilo_text/a\      ten_kilo_text: 0K' \
	vendor/flarum/lang-english/locale/core.yml

# 為頭像增加彩色邊框
sed -i -r 's#"(}\),Object\(Ot)# uid-"+e.id(),style:"border:solid "+e.color()\1#' \
	vendor/flarum/core/js/dist/forum.js

# 首頁節點列表不顯示次節點
sed -i 's#o.splice(0,3).forEach(s),##' \
  vendor/flarum/tags/js/dist/forum.js

# 啟用 Pusher 後不隱藏刷新按鈕
sed -i 's#Object(o.extend)(p.a.prototype,"actionItems",(function(e){e.remove("refresh")})),##' \
  vendor/flarum/pusher/js/dist/forum.js

# 固頂貼不顯示預覽
sed -i "/'includeFirstPost'/d" \
	vendor/flarum/sticky/src/Listener/AddApiAttributes.php
sed -i 's#Object(f.extend)(S.a.prototype,"requestParams",(function(t){t.include.push("firstPost")})),##' \
	vendor/flarum/sticky/js/dist/forum.js

# 更改 font-awesome 加載位置
sed -i 's#\./#https://awk.tw/assets/#' \
	vendor/flarum/core/less/common/common.less

# 更改 reflar/level-ranks 升級經驗算法為 log(n)
sed -i 's#r\/135),s=100\/135\*(r-135\*n)#Math.log(r)),s=Math.log(r).toFixed(4).split(".")[1]/100#' \
	vendor/reflar/level-ranks/js/dist/forum.js

# 確保 antoinefr/flarum-ext-money 與 reflar/level-ranks 的計算方式一致
# n = 5*discussionCount + commentCount
sed -i -r 's#21.*(t.discussionCount)#t.commentCount()+5*\1#' \
	vendor/reflar/level-ranks/js/dist/forum.js
sed -i -r 's#(money\]",)(this.props.user.data.attributes.)money#\1\2discussionCount*5+\2commentCount#g' \
	vendor/antoinefr/flarum-ext-money/js/dist/forum.js

# 使得 tooltip 在滑鼠右側彈出避免遮擋
sed -i -r 's#(placement:")top#\1right#' \
	vendor/flarum/core/js/dist/forum.js

# 更改 flagrow/sitemap 連結格式,移除 slug,使用 UID 訪問用戶頁面
sed -i -e "s# . '-' . \$discussion->slug##; s# . '-' . \$page->slug##; s#username#id#" \
	vendor/flagrow/sitemap/src/SitemapGenerator.php

# 更改 fof/upload 文件大小為二進位前綴
sed -i 's#kB#KiB#; s#MB#MiB#; s#GB#GiB#; s#TB#TiB#; s#PB#PiB#; s#EB#EiB#; s#ZB#ZiB#; s#YB#YiB#' \
	vendor/fof/upload/src/File.php

# 為異常提示增加 MimeType
sed -i -r "s#(this type)#\1 ('.\$upload->getClientMimeType().')#" \
	vendor/fof/upload/src/Commands/UploadHandler.php

# 阻止 amaurycarrade/flarum-ext-syndication 生成 slug
sed -i "s# . '-' . \$discussion->attributes->slug##" \
	vendor/amaurycarrade/flarum-ext-syndication/src/Controller/DiscussionFeedController.php \
	vendor/amaurycarrade/flarum-ext-syndication/src/Controller/DiscussionsActivityFeedController.php

# 阻止 fof/split 生成 slug
sed -i 's#-{\$slug}##' \
	vendor/fof/split/src/Posts/DiscussionSplitPost.php
sed -i 's#-{\$event->discussion->slug}##' \
	vendor/fof/split/src/Listeners/UpdateSplitTitleAfterDiscussionWasRenamed.php

# 阻止 fof/secure-https 代理 HTTPS 內容,並清理原始碼
sed -i -e '/proxyUrl . urlencode/d; /proxyUrl/a\\t\t\t\treturn substr(\$attrValue, 0, 5 ) === "http:" ? \$proxyUrl . urlencode(\$attrValue) : \$attrValue;' \
	vendor/fof/secure-https/src/Listeners/ModifyContentHtml.php
sed -i "s#\$imgurl, -3#strrchr(\$imgurl, '.'), 1#" \
	vendor/fof/secure-https/src/Api/Controllers/GetImageUrlController.php

# 客制 fof/upload 內容展示模板
for f in \
	fof/upload/resources/templates/image.blade.php \
	fof/upload/resources/templates/audio.blade.php \
	fof/upload/resources/templates/video.blade.php \
	fof/upload/resources/templates/text.blade.php \
	fof/upload/src/Templates/AudioTemplate.php \
	fof/upload/src/Templates/VideoTemplate.php \
	fof/upload/src/Templates/TextTemplate.php \
	fof/upload/src/Providers/DownloadProvider.php
do
	wget -qO "vendor/$f" "$GITHUB_ROOT/$f"
done

# 客制頁面模板
wget -qO "vendor/flarum/core/views/frontend/app.blade.php" \
	"$GITHUB_ROOT/flarum/core/views/frontend/app.blade.php"

 

评论 5
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值