查看“MediaWiki扩展Math渲染失败”的源代码
←
MediaWiki扩展Math渲染失败
跳到导航
跳到搜索
因为以下原因,您没有权限编辑本页:
您所请求的操作仅限于该用户组的用户使用:
用户
您可以查看和复制此页面的源代码。
万恶的墙! 需要墙外代理才能调用 Wiki 提供的 Restbase 和 Mathoid 服务,LocalSettings.php 中的<syntaxhighlight lang="properties"> // Set MathML as default rendering option $wgDefaultUserOptions['math'] = 'mathml'; $wgMathFullRestbaseURL = 'https://wikimedia.org/api/rest_'; $wgMathMathMLUrl = 'https://mathoid-beta.wmflabs.org'; </syntaxhighlight>修改 Math 扩展中的接口调用:MathRestbaseInterface.php 修改函数 getCheckRequest:<syntaxhighlight lang="php"> /** * @return array * @throws MWException */ public function getCheckRequest() { $request = [ 'method' => 'POST', 'body' => [ 'type' => $this->type, 'q' => $this->tex ], 'proxy' => '172.17.0.1:10808', 'url' => $this->getUrl( "media/math/check/{$this->type}" ) ]; return $request; } </syntaxhighlight>修改函数 getContentRequest:<syntaxhighlight lang="php"> /** * @return string */ public function getMathoidStyle() { return $this->mathoidStyle; } /** * @param string $type * @return array * @throws MWException */ private function getContentRequest( $type ) { $this->calculateHash(); $request = [ 'method' => 'GET', 'proxy' => '172.17.0.1:10808', 'url' => $this->getUrl( "media/math/render/$type/{$this->hash}" ) ]; if ( $this->purge ) { $request['headers'] = [ 'Cache-Control' => 'no-cache' ]; $this->purge = false; } return $request; } </syntaxhighlight>其中的 proxy 声明就是新增的代码
返回至
MediaWiki扩展Math渲染失败
。
导航菜单
个人工具
登录
名字空间
页面
讨论
变种
视图
阅读
查看源代码
查看历史
更多
搜索
导航
首页
Spring Boot 2 零基础入门
Spring Cloud
Spring Boot
设计模式之禅
VUE
Vuex
Maven
算法
技能树
Wireshark
IntelliJ IDEA
ElasticSearch
VirtualBox
软考
正则表达式
程序员精讲
软件设计师精讲
初级程序员 历年真题
C
SQL
Java
FFmpeg
Redis
Kafka
MySQL
Spring
Docker
JMeter
Apache
Linux
Windows
Git
ZooKeeper
设计模式
Python
MyBatis
软件
数学
PHP
IntelliJ IDEA
CS基础知识
网络
项目
未分类
MediaWiki
镜像
问题
健身
国债
英语
烹饪
常见术语
MediaWiki帮助
工具
链入页面
相关更改
特殊页面
页面信息