深大路由器IPv6穿透

所需:

  • 一台小米Mini
  • PandoraBox固件(2017.01编译版
  • SZU校园网

路由器接入校园网后,自动获取到了2001开头的IPv6地址。打开SSH开始以下操作。

opkg update && opkg install kmod-ipt-nat6

uci set network.globals.ula_prefix="$(uci get network.globals.ula_prefix | sed 's/^./d/')"

uci commit network

uci set dhcp.lan.ra_default='1'

uci commit dhcp

修改/etc/sysctl.conf

net.ipv6.conf.default.forwarding=2

net.ipv6.conf.all.forwarding=2

net.ipv6.conf.default.accept_ra=2

net.ipv6.conf.all.accept_ra=2

修改/etc/firewall.user

ip6tables -t nat -I POSTROUTING -s $(uci get network.globals.ula_prefix) -j MASQUERADE

reboot.参考:https://www.shintaku.cc/posts/nat6/

解决wordpress新用户注册/重置密码邮件链接失效

新注册:/wp-includes/pluggable.php

$message .= '<' . network_site_url("wp-login.php?action=rp&key=$key&login=" . rawurlencode($user->user_login), 'login') . ">\r\n\r\n";

重置密码:wp-login.php

$message .= '<' . network_site_url("wp-login.php?action=rp&key=$key&login=" . rawurlencode($user_login), 'login') . ">\r\n";

Wordpress小工具 近期评论 改写

wp-includes/widgets/class-wp-widget-recent-comments.php,116-118行左右

$output .= sprintf( _x( '%1$s : %2$s', 'widgets' ),
'<span class="comment-author-link">' . get_comment_author( $comment ) . '</span>',
'<a href="' . esc_url( get_comment_link( $comment ) ) . '">' . mb_strimwidth(strip_tags($comment->comment_content),0,60, '…') . '</a>'