admin avatar

从入门到放弃,类似于4chan的专业开源画板程序-vichan,附上安装和配置教程。

🕦 by admin





https://www.vpslala.com/t/854

这篇文章介绍了另外一款开源的类似于4chan的画板程序-tinyib

但是相对来讲,tinyib的功能不是那么强大,tinyib只是一个4chan功能的基本实现

而这款类似于4chan的专业实用强大的开源画板程序-vichan,则是专业级的。

vichan 是一个免费的轻量级、快速、高度可配置和用户友好的图像板软件包。它是用 PHP 编写的,几乎没有依赖项。 从官方公告来看,vichan 应该是已经完全停止开发了,除了安全性漏洞的修复外。官方不建议使用vichan ,但是同时也表示不排除将来会推到vichan进行重构。

vichan的安装要求

  1. PHP >= 5.4(我们仍然尽量保持与 php 5.3 的兼容性)明确支持 PHP 7.0。PHP 7.2 也可以工作,但可能会导致尚未报告的错误。
  2. MySQL/MariaDB 服务器
  3. mbstring
  4. PHP GD
  5. PHP PDO
  6. 类 Unix 操作系统,最好是 FreeBSD 或 Linux
  7. PHP composer

我们试图确保 vichan 与所有主要的 Web 服务器兼容。vichan 不包含 Apache.htaccess文件,也不需要它

推荐的数据库和缓存

  1. MySQL/MariaDB 服务器 >= 5.5.3

  2. ImageMagick(首选命令行 ImageMagick 或 GraphicsMagick)。

  3. APC(替代 PHP 缓存)XCacheMemcached

  4. 测试使用了memcached和redis两种缓存服务器,感觉使用redis缓存服务器响应最快。

  5. 安装

    1. 下载 vichan 并将其解压缩到您的 Web 目录或获取最新的开发版本:

      git clone git://github.com/vichan-devel/vichan.git

    2. composer install在目录中运行

    3. 在您的网络浏览器中导航install.php并按照提示进行操作。

    4. 现在应该安装 vichan。mod.php使用默认的用户名和密码组合登录:admin / password

    请记住更改管理员帐户密码。

后台管理地址是doumain.com/mod.php

//这里安装脚本有点问题,建议直接先导入install.sql数据到数据库,

然后直接修改网站根目录下的inc/instance-config.php文件数据库名称,用户名和密码

下面就开始配置vichan了,vichan的根配置文件是inc/config.php文件,通常不建议去修改它

而是使用inc/instance-config.php文件来配置vichan的功能。

vichan非常强大,你可以使用inc/instance-config.php实现不同板块的功能,

比如创建了/demo/分类和/twodemo/分类,那么修改inc/instance-config.php文件复制到两个分类下

即可实现/demo/分类和/twodemo/分类下的不同权限和功能的实现。

下面是折腾了两天测试和使用后没有问题vichan的inc/instance-config.php文件配置代码

iShot_2022-05-27_10.36.19.png

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
<?php

/*
 *  Instance Configuration
 *  ----------------------
 *  Edit this file and not config.php for imageboard configuration.
 *
 *  You can copy values from config.php (defaults) and paste them here.
 */



// 數據庫配置
$config['db']['type']		= 'mysql';
$config['db']['server']	= '127.0.0.1';
$config['db']['user']		= '数据库用户名';
$config['db']['password']	= '数据库用户名密码';
$config['db']['database']	= '数据库名称';
$config['db']['persistent'] = true; //永久链接
$config['db']['timeout'] = 60;
//全局公告
 $config['global_message'] = 'Don\'t touch porn anyting! Dou\' touch Child Porn!thank you!';

//緩存和排錯,更新
$config['check_updates'] = true;
$config['check_updates_time'] = 43200; // 12小时
$config['debug'] = false;
$config['verbose_errors'] = false;
$config['deprecation_errors'] = false;
$config['debug_explain'] = false;
$config['has_installed'] = '.installed';
$config['syslog'] = true;
$config['fcrdns'] = true;
$config['cache']['enabled'] = 'redis';
$config['cache']['timeout'] = 60 * 1;
$config['cache']['redis'] = array('127.0.0.1', 6379, '', 1);
$config['cache_config'] = false;
$config['lock']['enabled'] = 'redis';
 $config['queue']['enabled'] = 'redis'; // xD
 //Cookie 设置
 $config['cookies']['mod'] = 'mod';
 $config['cookies']['js'] = 'serv';
 $config['cookies']['path'] = '/';
 $config['cookies']['expire'] = 60 * 60 * 24 * 30 * 1;
 $config['cookies']['salt'] = 'oF^A3!DkK!cyjMQfbL%[email protected]!v$n4X72H()';
 $config['cookies']['httponly'] = true;
 $config['secure_trip_salt'] = ')(mCb3&7ZvCNt59SSDJyy4MVgeNP&47Wy\[email protected]%jWv%';
//防止拉圾信息
$config['anti_bump_flood'] = true;
$config['spam']['hidden_inputs_min'] = 4;
$config['spam']['hidden_inputs_max'] = 12;
$config['spam']['hidden_inputs_max_pass'] = 12;
$config['spam']['hidden_inputs_expire'] = 60 * 60 * 3;
$config['spam']['unicode'] = true;
$config['spam']['hidden_input_names'] = array(
		'user',
		'username',
		'login',
		'search',
		'q',
		'url',
		'firstname',
		'lastname',
		'text',
		'message'
	);
	$config['spam']['valid_inputs'] = array(
		'hash',
		'board',
		'thread',
		'mod',
		'name',
		'email',
		'subject',
		'post',
		'body',
		'password',
		'sticky',
		'lock',
		'raw',
		'embed',
		'g-recaptcha-response',
		'captcha_cookie',
		'captcha_text',
		'spoiler',
		'page',
		'file_url',
		'json_response',
		'user_flag',
		'no_country',
		'tag'
	);
	$config['captcha']['enabled'] = false;
	$config['recaptcha'] =true;
	$config['recaptcha_public'] = '自行到谷歌后台创建';
    $config['recaptcha_private'] = '自行到谷歌后台创建';
 //https://www.google.com/recaptcha/admin/create //适用v2版本,v3版本没有测试
    $config['new_thread_capt'] = false; //为ture是会启用系统自带验证码而不是谷歌验证码
    $config['proxy_check'] = true;
    $config['proxy_save'] = true;
   $config['filters'][] = array(
		'condition' => array(
			'flood-match' => array('ip', 'body'), // Match IP address and post body
			'flood-time' => &$config['flood_time_ip'],
			'!body' => '/^$/', // Post body is NOT empty
		),
		'action' => 'reject',
		'message' => &$config['error']['flood']
	);
	$config['filters'][] = array(
	 	'condition' => array(
	 		'flood-match' => array('file'), // Match file hash
	 		'flood-time' => 60 * 2 // 2 minutes minimum
	 	),
	 	'action' => 'reject',
	 	'message' => &$config['error']['flood']
	 );
	$config['filters'][] = array(
	 	'condition' => array(
	 		'name' => '/^关键词$/',
	 		'body' => '/关键词2,\s+(the )?s关键词3$/i',
	 		'OP' => false
	 	),//关键词过滤,如果发布内容包含上门的字符就会被丢弃
	 	'action' => 'ban',
		'add_note' => true,
	 	'expires' => 60 * 60 * 3, // 3 hours
	 	'reason' => 'Go away, spammer.'
	 );
  $config['flood_cache'] = 60 * 60 * 2;

// 发布设置‘
$config['force_body'] = true;
$config['force_body_op'] = true;
 $config['force_image_op'] = false;
 $config['strip_superfluous_returns'] = true;
 $config['strip_combining_chars'] = true;
 $config['max_body'] = 1800;
 $config['body_truncate'] = 15;
 $config['body_truncate_char'] = 2500;
 $config['max_links'] = 20;
 $config['max_cites'] = 30;
 $config['max_cross'] = $config['max_cites'];
  $config['track_cites'] = true;
 $config['max_filename_len'] = 255;
  $config['max_filename_display'] = 30;
 $config['allow_delete'] = true;
  $config['delete_time'] = 10;
  $config['reply_limit'] = 250;
 $config['image_hard_limit'] = 0;
 $config['reply_hard_limit'] = 0;
 $config['robot_enable'] = true;
 $config['robot_strip_repeating'] = true;
 $config['robot_mute'] = true;
 $config['robot_mute_hour'] = 336;
 $config['auto_unicode'] = true;
  $config['markup_urls'] = true;
 $config['allow_upload_by_url'] = false;
  $config['early_404'] = false;
   $config['early_404_page'] = 3;
  $config['early_404_replies'] = 5;
  $config['early_404_staged'] = false;
  $config['field_disable_name'] = true;
  $config['field_disable_email'] = true;
   $config['field_disable_subject'] = false;
   $config['field_disable_reply_subject'] = false;
   $config['field_disable_password'] = true;
 $config['slugify'] = false;
 $config['slug_max_size'] = 80;

 //标记设置
   $config['markup'][] = array("/'''(.+?)'''/", "<strong>\$1</strong>");
	$config['markup'][] = array("/''(.+?)''/", "<em>\$1</em>");
	$config['markup'][] = array("/\*\*(.+?)\*\*/", "<span class=\"spoiler\">\$1</span>");
	$config['markup'][] = array("/^[ |\t]*==(.+?)==[ |\t]*$/m", "<span class=\"heading\">\$1</span>");
   $config['markup_code'] = false;
 $config['markup_repair_tidy_bare'] = true;
  $config['always_regenerate_markup'] = false;
//  图像设置
 $config['max_images'] = 1;
  $config['multiimage_method'] = 'split';
 	$config['thumb_width'] = 255;
	$config['thumb_height'] = 255;
	$config['thumb_op_width'] = 255;
	$config['thumb_op_height'] = 255;
 $config['thumb_ext'] = 'png';
 $config['thumb_keep_animation_frames'] = 1;
 $config['thumb_method'] = 'convert';
  $config['convert_args'] = '-size %dx%d %s -thumbnail %dx%d -auto-orient +profile "*" %s';
 $config['convert_auto_orient'] = false;
 $config['convert_manual_orient'] = false;
 $config['ie_mime_type_detection'] = '/<(?:body|head|html|img|plaintext|pre|script|table|title|a href|channel|scriptlet)/i';
  $config['allowed_ext'][] = 'jpg';
  $config['allowed_ext'][] = 'jpeg';
  $config['allowed_ext'][] = 'bmp';
  $config['allowed_ext'][] = 'gif';
  $config['allowed_ext'][] = 'png';
  $config['allowed_ext'][] = 'webp';
 $config['file_thumb'] = 'static/%s';
$config['spoiler_image'] = 'static/spoiler.png';
$config['image_deleted'] = 'static/deleted.png';
 $config['minimum_copy_resize'] = false;
 $config['max_filesize'] = 1 * 1024 * 1024; // 1MB
 $config['max_width'] = 4096;
 $config['max_height'] = $config['max_width'];
 $config['image_reject_repost'] = true;
 $config['image_reject_repost_in_thread'] =true;
 $config['show_filename'] =false;
 $config['gnu_md5'] = true;

 //显示设置
 $config['mod']['shadow_name'] = false;
  $config['anonymous'] = '匿名';
 $config['threads_per_page'] = 10;
 $config['max_pages'] = 10;
 $config['threads_preview'] = 5;
  $config['threads_preview_sticky'] = 1;
  $config['board_abbreviation'] = '/%s/';
  $config['report_limit'] = 3;
  $config['allow_subtitle_html'] = false;
  $config['locale'] = 'zh_TW';
  $config['timezone'] = 'Asia/Macau';
  $config['post_date'] = '%y/%m/%d / %H:%M:%S';
  $config['ban_date'] = '%A %e %B, %Y';
   $config['button_newtopic'] = _('新話題');
  $config['button_reply'] = _('新回覆');
  $config['thread_subject_in_title'] = false;
  //$config['footer'][] = _('所有本頁上的商標、著作權、留言、圖片、軟體分別為當事人所擁有並負責.');
//添加页脚声明
  $config['genpassword_chars'] = 'jX4TctfVswFprFRtAfNGEWni57Lsz$hv$s9%[email protected]&5esxmfd$mBgPfm()_+';
  // available stylesheets (or create your own).
	$config['stylesheets']['Yotsuba B'] = ''; // Default; there is no additional/custom stylesheet for this.
	$config['stylesheets']['Yotsuba'] = 'yotsuba.css';
	 $config['stylesheets']['Futaba'] = 'futaba.css';
   $config['stylesheets']['Dark'] = 'dark.css';
   $config['default_stylesheet'] = array('Yotsuba B', $config['stylesheets']['Yotsuba B']);
    $config['stylesheets_board'] =true;
    $config['font_awesome'] = true;
	$config['font_awesome_css'] = 'stylesheets/font-awesome/css/font-awesome.min.css';
     $config['boards'] = array(
         array('分类14', '分类15'),
         array('分类1', '分类2', '分类3', '分类4', 'g'),
         array('h', 'i', 'j'),
         array('k', array('l', 'm')),
         //array('status' => 'http://status.example.org/')
        );//添加链接到网站头部导航
    $config['boardlist_wrap_bracket'] = false;
    $config['page_nav_top'] = true;
   $config['catalog_link'] = 'catalog.html';
   $config['minify_html'] = true;

    //视频嵌入,通过修改和自定义支持任何网站,比如P站。
$config['enable_embedding'] =  true;
$config['embedding'] = array(
		array(
			'/^https?:\/\/(\w+\.)?youtube\.com\/watch\?v=([a-zA-Z0-9\-_]{10,11})(&.+)?$/i',
			'<iframe style="float: left; margin: 10px 20px;" width="%%tb_width%%" height="%%tb_height%%" frameborder="0" id="ytplayer" src="https://www.youtube.com/embed/$2"></iframe>'
		),
		array(
			'/^https?:\/\/(\w+\.)?vimeo\.com\/(\d{2,10})(\?.+)?$/i',
			'<iframe style="float: left; margin: 10px 20px;" width="%%tb_width%%" height="%%tb_height%%" frameborder="0" src="https://player.vimeo.com/video/$2"></iframe>'
		),
		array(
			'/^https?:\/\/(\w+\.)?dailymotion\.com\/video\/([a-zA-Z0-9]{2,10})(_.+)?$/i',
			'<iframe style="float: left; margin: 10px 20px;" width="%%tb_width%%" height="%%tb_height%%" frameborder="0" src="https://www.dailymotion.com/embed/video/$2" allowfullscreen></iframe>'
		),
		array(
			'/^https?:\/\/(\w+\.)?metacafe\.com\/watch\/(\d+)\/([a-zA-Z0-9_\-.]+)\/(\?[^\'"<>]+)?$/i',
			'<iframe style="float: left; margin: 10px 20px;" width="%%tb_width%%" height="%%tb_height%%" frameborder="0"  src="https://www.metacafe.com/embed/$2/$3/" allowfullscreen></iframe>'
		),
		array(
                        '/^https?:\/\/(\w+\.)?vocaroo\.com\/([a-zA-Z0-9]{2,12})$/i',
                        '<iframe style="float: left; margin: 10px 20px;" width="300" height="60" frameborder="0" src="https://vocaroo.com/embed/$2"></iframe>'
		)
	);

	// Embedding width and height.
	$config['embed_width'] = 300;
	$config['embed_height'] = 246;
    //靜態文件
    $config['file_index'] = 'index.html';
	$config['file_page'] = '%d.html'; // NB: page is both an index page and a thread
	$config['file_page50'] = '%d+50.html';
	$config['file_page_slug'] = '%d-%s.html';
	$config['file_page50_slug'] = '%d-%s+50.html';
	$config['file_mod'] = 'mod.php';
	$config['file_post'] = 'post.php';
	$config['file_script'] = 'main.js';

	// Board directory, followed by a forward-slash (/).
	$config['board_path'] = '%s/';
	// Misc directories.
	$config['dir']['img'] = 'src/';
	$config['dir']['thumb'] = 'thumb/';
	$config['dir']['res'] = 'res/';
	$config['dir']['template'] = getcwd() . '/templates';
	// Location of Tinyboard "themes".
	$config['dir']['themes'] = getcwd() . '/templates/themes';
	// Same as above, but a URI (accessable by web interface).
	$config['dir']['themes_uri'] = 'templates/themes';
	// Home directory. Used by themes.
	//$config['dir']['home'] = '';

	// "## Admin" makes everything red and bold, including the name and tripcode:
	$config['custom_capcode']['Admin'] = array(
		'<span class="capcode" style="color:red;font-weight:bold"> ## %s</span>',
		'color:red;font-weight:bold', // Change name style; optional
		'color:red;font-weight:bold' // Change tripcode style; optional
	);
	$config['mod']['dns_lookup'] = true;
	// Number of posts to display on the reports page.
	$config['mod']['recent_reports'] = 10;
	// Number of actions to show per page in the moderation log.
	$config['mod']['modlog_page'] = 350;
	// Number of bans to show per page in the ban list.
	$config['mod']['banlist_page'] = 350;
	// Number of news entries to display per page.
	$config['mod']['news_page'] = 40;
	// Number of results to display per page.
	$config['mod']['search_page'] = 200;
	// Number of entries to show per page in the moderator noticeboard.
	$config['mod']['noticeboard_page'] = 50;
	// Number of entries to summarize and display on the dashboard.
	$config['mod']['noticeboard_dashboard'] = 5;
	 $config['mod']['rebuild_timelimit'] = 120;
	$config['mod']['raw_html_default'] = false;
	$config['mod']['dismiss_reports_on_lock'] = true;
	$config['mod']['config_editor_php'] = false;

	//公共页面
	$config['search'] = array();
    $config['search']['enable'] = false;
    $config['board_search'] = false;
    $config['search']['queries_per_minutes'] = Array(15, 2);
    $config['search']['queries_per_minutes_all'] = Array(20, 2);
    $config['search']['search_limit'] = 10;
    $config['public_logs'] = 1;
    $config['api']['enabled'] = false;
    $config['meta_keywords'] = '生活,成人,健康,音樂,電影,軟體,程序,工具,娛樂';
    $config['purge_timeout'] = 3;
    $config['gzip_static'] = true;
    $config['board_regex'] = '[0-9a-zA-Z$_\x{0080}-\x{FFFF}]{1,58}';
    $config['youtube_js_html'] = '<div class="video-container" data-video="$2">'.
	 	'<a href="https://youtu.be/$2" target="_blank" class="file">'.
	 	'<img style="width:360px;height:270px;" src="//img.youtube.com/vi/$2/0.jpg" class="post-image"/>'.
	 	'</a></div>';
    $config['password_crypt'] = '$6$rounds=25000$';
    $config['password_crypt_version'] = 1;

   ?>

iShot_2022-05-27_10.37.40.png

为什么说4chan从入门到放弃?事实上一直都想搭建一个干净的交流平台

找到志同道合,或者可以让人干净分享生活,工作点滴的平台

经过两天的思考,最终决定还是放弃了,想想有再牛逼技术的程序员都放弃构建自己的交流平台

一是非常耗费自己的时间,而来就是你真的无法去管理网络的复杂性和可控性

所以更不可能去搭建一个匿名的网络平台了,

官方代码仓库

https://github.com/vichan-devel/vichan

有兴趣可以看看。





💘 相关文章

写一条评论

Based on Golang + fastHTTP + sdb | go1.18.3 Processed in 4ms