Преглед на файлове

ttrss:20.08-67f02e2aa add zhparser

John преди 5 години
родител
ревизия
9fff18c0df

+ 1 - 1
.github/workflows/tt-rss-plugins-Tags-buildx.yml

@@ -6,7 +6,7 @@ on:
     - '.github/workflows/tt-rss-plugins-Tags-buildx.yml'
 
 env:
-  TTRSS_VER: 20.07-376fe6271
+  TTRSS_VER: 20.08-67f02e2aa
 
 jobs:
   buildx:

+ 23 - 15
tt-rss-plugins/Dockerfile

@@ -1,7 +1,7 @@
-FROM cthulhoo/ttrss-fpm-pgsql-static:20.07-376fe6271  as ttrss-src
+FROM cthulhoo/ttrss-fpm-pgsql-static:20.08-67f02e2aa  as ttrss-src
 FROM postgres:12.0-alpine
 
-ARG  S6_VER=2.0.0.1
+ARG  S6_VER=2.1.0.0
 
 ENV  POSTGRES_DB=
 ENV  POSTGRES_USER=
@@ -11,39 +11,47 @@ COPY  root  /
 COPY --from=ttrss-src  /src/tt-rss  /usr/local/tt-rss
 
 # install php tt-rss caddy git [npm nodejs]-mercury-parser-api
-RUN apk add --no-cache bash shadow git npm  nodejs  ca-certificates caddy  php7-pcntl php7-cli php7-curl php7-ldap php7-mcrypt php7-mysqli php7-mysqlnd php7-pdo_mysql php7-mbstring php7-json php7-gd php7-pgsql php7-xml php7-opcache php7-posix php7-apcu php7-fpm  php7-pdo  php7-fileinfo  php7-iconv php7-dom php7-intl  php7-pdo_pgsql php7-session  \
-&&  rm -rf /var/cache/apk/*   \
+RUN apk add --no-cache bash shadow git npm  nodejs  ca-certificates caddy  php7-pcntl php7-cli php7-curl php7-ldap php7-mcrypt php7-mysqli php7-mysqlnd php7-pdo_mysql php7-mbstring php7-json php7-gd php7-pgsql php7-xml php7-opcache php7-posix php7-apcu php7-fpm  php7-pdo  php7-fileinfo  php7-iconv php7-dom php7-intl  php7-pdo_pgsql php7-session build-base  \
 # install s6-overlay
 &&  if [ "$(uname -m)" = "x86_64" ];then s6_arch=amd64;elif [ "$(uname -m)" = "aarch64" ];then s6_arch=aarch64;elif [ "$(uname -m)" = "armv7l" ];then s6_arch=arm; fi  \
 &&  wget --no-check-certificate https://github.com/just-containers/s6-overlay/releases/download/v${S6_VER}/s6-overlay-${s6_arch}.tar.gz  \
 &&  tar -xvzf s6-overlay-${s6_arch}.tar.gz  \
-&&  rm s6-overlay-${s6_arch}.tar.gz   \
+# install mercury-parser-api
+&& npm install git+https://github.com/HenryQW/mercury-parser-api.git    \
+# install zhparser
+&&  wget http://www.xunsearch.com/scws/down/scws-1.2.3.tar.bz2   \
+&&  tar -xf scws-1.2.3.tar.bz2   \
+&&  cd scws-1.2.3   \
+&&  ./configure   \
+&&  make install   \
+&&  git clone https://github.com/amutu/zhparser.git   \
+&&  cd zhparser   \
+&&  make install   \
+#create ttrss user
+&&  useradd -u 1000 -U -d /config -s /bin/false ttrss   \
+&&  usermod -G users ttrss   \
+# install  plugins
 &&  mkdir -p  /usr/local/tt-rss/defaults \
 &&  mv /usr/local/tt-rss/cache /usr/local/tt-rss/defaults/cache \
 &&  mv /usr/local/tt-rss/feed-icons /usr/local/tt-rss/defaults/feed-icons \
 &&  mv /usr/local/tt-rss/lock /usr/local/tt-rss/defaults/lock \
 &&  mv /usr/local/tt-rss/plugins.local /usr/local/tt-rss/defaults/plugins.local \
 &&  mv /usr/local/tt-rss/themes.local /usr/local/tt-rss/defaults/themes.local \
-#create ttrss user
-&&  groupmod -g 1000 users \
-&&  useradd -u 1001 -U  -s /bin/bash  ttrss  \
-&&  usermod -G users ttrss   \
-# install mercury-parser-api
-&& npm install git+https://github.com/HenryQW/mercury-parser-api.git    \
-# install  plugins
 # install mercury_fulltext
 &&  git clone https://github.com/HenryQW/mercury_fulltext.git /usr/local/tt-rss/defaults/plugins.local/mercury_fulltext     \
 # install feediron
 &&  git clone https://github.com/feediron/ttrss_plugin-feediron.git  /usr/local/tt-rss/defaults/plugins.local/feediron      \
 # install fever
 &&  git clone https://github.com/DigitalDJ/tinytinyrss-fever-plugin /usr/local/tt-rss/defaults/plugins.local/fever     \
-# install api_feedreader
-&&  mkdir -p /usr/local/tt-rss/defaults/plugins.local/api_feedreader    \
-&&  wget -P /usr/local/tt-rss/defaults/plugins.local/api_feedreader https://raw.githubusercontent.com/jangernert/FeedReader/master/data/tt-rss-feedreader-plugin/api_feedreader/init.php  \
 # install themes
 # install tt-rss-feedly-theme
 &&  git clone  https://github.com/levito/tt-rss-feedly-theme.git /usr/local/tt-rss/defaults/themes.local/tt-rss-feedly-theme     \
 &&  cp -r /usr/local/tt-rss/defaults/themes.local/tt-rss-feedly-theme/feedly* /usr/local/tt-rss/defaults/themes.local     \
+#clean
+&&  apk del build-base  \
+&&  rm -rf /var/cache/apk/*   \
+&&  rm /s6-overlay-${s6_arch}.tar.gz   \
+&&  rm -rf /scws*   \
 &&  rm -rf /usr/local/tt-rss/defaults/themes.local/tt-rss-feedly-theme
 
 VOLUME  /config

+ 19 - 9
tt-rss-plugins/README.md

@@ -8,20 +8,19 @@
 [https://github.com/HenryQW/mercury_fulltext](https://github.com/HenryQW/mercury_fulltext "https://github.com/HenryQW/mercury_fulltext")  
 [https://github.com/feediron/ttrss_plugin-feediron](https://github.com/feediron/ttrss_plugin-feediron "https://github.com/feediron/ttrss_plugin-feediron")     
 [https://github.com/DigitalDJ/tinytinyrss-fever-plugin](https://github.com/DigitalDJ/tinytinyrss-fever-plugin "https://github.com/DigitalDJ/tinytinyrss-fever-plugin")      
-[https://github.com/jangernert/FeedReader](https://github.com/jangernert/FeedReader "https://github.com/jangernert/FeedReader")       
 [https://github.com/levito/tt-rss-feedly-theme](https://github.com/levito/tt-rss-feedly-theme "https://github.com/levito/tt-rss-feedly-theme")
 
 ### 版本:
 
 |名称|版本|说明|
 |:-|:-|:-|
-|ttrss|plugins-20.07-376fe6271|amd64;arm64v8;arm32v7,集成postgres数据库(PostgreSQL-12.0),mercury-parser-api及一些常用插件|
+|ttrss|plugins-20.08-67f02e2aa|amd64;arm64v8;arm32v7,集成postgres数据库(PostgreSQL-12.0),mercury-parser-api及一些常用插件|
 |ttrss|plugins-19.8|amd64,集成postgres数据库(PostgreSQL-12beta4),mercury-parser-api及一些常用插件|
 |ttrss|19.8|amd64,需自建数据库|
 
 #### 版本升级注意:
 
-* plugins-19.8升级到plugins-20.07需重新导入导出数据库(旧数据库不兼容),移除配置文件夹themes.local(feedly旧主题不兼容)
+* plugins-19.8升级到plugins-20.08需重新导入导出数据库(旧数据库不兼容),移除配置文件夹themes.local(feedly旧主题不兼容)
 
 ### Postgres数据库导入导出
 
@@ -41,8 +40,8 @@
 
 |标题|命令|举例|
 |:-|:-|:-|
-|导出|pg_dump -U PostgreSQL用户名 -f /var/lib/postgresql/data/db.sql PostgreSQL数据库名称| pg_dump -U ttrss -f /var/lib/postgresql/data/db.sql ttrss|
-|导入|psql -d PostgreSQL用户名 -f /var/lib/postgresql/data/db.sql PostgreSQL数据库名称|psql -d ttrss -f /var/lib/postgresql/data/db.sql ttrss|
+|导出|pg_dump -U PostgreSQL用户名 -f /var/lib/postgresql/data/db.sql -d PostgreSQL数据库名称| pg_dump -U ttrss -f /var/lib/postgresql/data/db.sql -d ttrss|
+|导入|psql -d PostgreSQL数据库名称 -f /var/lib/postgresql/data/db.sql -U PostgreSQL用户名|psql -d ttrss -f /var/lib/postgresql/data/db.sql -U ttrss|
 
 ### docker命令行设置:
 
@@ -141,9 +140,20 @@
   1. 偏好设置启用插件
   2. 信息源栏 Mercury Fulltext settings 填入 [ip:本地端口2](ip:本地端口2)
 
-* api_feedreader:
-  1. 启用插件需修改config.php文件添加 api_feedreader;
-  define('PLUGINS', 'auth_internal, note, api_feedreader');
+### 中文搜索设置:
+
+* zhparser(用于简体中文全文搜索):
+
+  1. 偏好设置-信息源-默认语言-Chinese_simplified
+
+#### 注意:
+
+* 升级安装需手动添加zhparser扩展:
+
+|标题|命令|举例|
+|:-|:-|:-|
+|添加zhparser扩展|psql -U PostgreSQL用户名 -d  PostgreSQL数据库名称 -a -f  /docker-entrypoint-initdb.d/install_extension.sql| psql -U ttrss -d  ttrss -a -f  /docker-entrypoint-initdb.d/install_extension.sql|
+|更新旧数据库(可选)|psql -U PostgreSQL用户名 -d  PostgreSQL数据库名称 -c "update ttrss_entries set tsvector_combined = to_tsvector( 'chinese_simplified' , content)"| psql -U ttrss -d  ttrss -c "update ttrss_entries set tsvector_combined = to_tsvector( 'chinese_simplified' , content)"|
 
 ### 常见问题:
 
@@ -156,7 +166,7 @@
 |平台|软件|
 |:-|:-|
 |android|feedme (免费)|
-|linux|FeedReader (免费)|
+|linux|NewsFlash (免费)|
 |mac os x|Reeder 4|
 
 

+ 6 - 0
tt-rss-plugins/root/docker-entrypoint-initdb.d/install_extension.sql

@@ -0,0 +1,6 @@
+-- Install zhparser
+
+CREATE EXTENSION zhparser;
+CREATE TEXT SEARCH CONFIGURATION chinese_simplified (PARSER = zhparser);
+ALTER TEXT SEARCH CONFIGURATION chinese_simplified ADD MAPPING FOR n,v,a,i,e,l WITH simple;
+ALTER ROLE ALL SET zhparser.multi_short=on;

+ 23 - 32
tt-rss-plugins/root/etc/cont-init.d/tt-rss.sh

@@ -1,17 +1,17 @@
 #! /usr/bin/with-contenv bash
 
 #检查自定义config位置文件
-if [ ! -e "/config/config.php" ] ;  then 
-if [  -L "/usr/local/tt-rss/config.php" ] ;  then 
+if [ ! -e "/config/config.php" ] ;  then
+if [  -L "/usr/local/tt-rss/config.php" ] ;  then
 rm  /usr/local/tt-rss/config.php
 fi
-if [  -e "/usr/local/tt-rss/config.php" ] ;  then 
+if [  -e "/usr/local/tt-rss/config.php" ] ;  then
 mv  /usr/local/tt-rss/config.php  /config/config.php
 ln -s /config/config.php /usr/local/tt-rss/
 fi
 fi
-if  [  -e "/config/config.php" ] ;  then 
-if [ -e "/usr/local/tt-rss/config.php" ] && [ ! -L "/usr/local/tt-rss/config.php" ] ;  then 
+if  [  -e "/config/config.php" ] ;  then
+if [ -e "/usr/local/tt-rss/config.php" ] && [ ! -L "/usr/local/tt-rss/config.php" ] ;  then
 mv  /config/config.php /config/config.php.bak
 mv  /usr/local/tt-rss/config.php  /config/config.php
 fi
@@ -19,87 +19,78 @@ ln -s /config/config.php /usr/local/tt-rss/
 fi
 
 #检查cache文件夹位置
-if [  ! -d "/config/cache" ] ;  then 
+if [  ! -d "/config/cache" ] ;  then
 cp -rf /usr/local/tt-rss/defaults/cache  /config/
 ln -s /config/cache  /usr/local/tt-rss/
 fi
-if [  ! -L "/usr/local/tt-rss/cache" ] ;  then 
+if [  ! -L "/usr/local/tt-rss/cache" ] ;  then
 ln -s /config/cache  /usr/local/tt-rss/
 fi
 
 #检查feed-icons文件夹位置
-if [  ! -d "/config/feed-icons" ] ;  then 
+if [  ! -d "/config/feed-icons" ] ;  then
 cp -rf /usr/local/tt-rss/defaults/feed-icons  /config/
 ln -s /config/feed-icons  /usr/local/tt-rss/
 fi
-if [  ! -L "/usr/local/tt-rss/feed-icons" ] ;  then 
+if [  ! -L "/usr/local/tt-rss/feed-icons" ] ;  then
 ln -s /config/feed-icons  /usr/local/tt-rss/
 fi
 
 #检查lock文件夹位置
-if [  ! -d "/config/lock" ] ;  then 
+if [  ! -d "/config/lock" ] ;  then
 cp -rf /usr/local/tt-rss/defaults/lock  /config/
 ln -s /config/lock  /usr/local/tt-rss/
 fi
-if [  ! -L "/usr/local/tt-rss/lock" ] ;  then 
+if [  ! -L "/usr/local/tt-rss/lock" ] ;  then
 ln -s /config/lock  /usr/local/tt-rss/
 fi
 
 #检查plugins.local文件夹位置
-if [  ! -d "/config/plugins.local" ] ;  then 
+if [  ! -d "/config/plugins.local" ] ;  then
 cp -rf /usr/local/tt-rss/defaults/plugins.local  /config/
 ln -s /config/plugins.local  /usr/local/tt-rss/
 fi
-if [  ! -L "/usr/local/tt-rss/plugins.local" ] ;  then 
+if [  ! -L "/usr/local/tt-rss/plugins.local" ] ;  then
 ln -s /config/plugins.local  /usr/local/tt-rss/
 fi
-#检查api_feedreader plugins
-if [  ! -d "/config/plugins.local/api_feedreader" ] ;  then 
-cp -rf /usr/local/tt-rss/defaults/plugins.local/api_feedreader  /config/plugins.local/
-fi
 #检查feediron plugins
-if [  ! -d "/config/plugins.local/feediron" ] ;  then 
+if [  ! -d "/config/plugins.local/feediron" ] ;  then
 cp -rf /usr/local/tt-rss/defaults/plugins.local/feediron  /config/plugins.local/
 fi
 #检查fever plugins
-if [  ! -d "/config/plugins.local/fever" ] ;  then 
+if [  ! -d "/config/plugins.local/fever" ] ;  then
 cp -rf /usr/local/tt-rss/defaults/plugins.local/fever  /config/plugins.local/
 fi
 #检查mercury_fulltext plugins
-if [  ! -d "/config/plugins.local/mercury_fulltext" ] ;  then 
+if [  ! -d "/config/plugins.local/mercury_fulltext" ] ;  then
 cp -rf /usr/local/tt-rss/defaults/plugins.local/mercury_fulltext  /config/plugins.local/
 fi
 
 #检查themes.local文件夹位置
-if [  ! -d "/config/themes.local" ] ;  then 
+if [  ! -d "/config/themes.local" ] ;  then
 cp -rf /usr/local/tt-rss/defaults/themes.local  /config/
 ln -s /config/themes.local  /usr/local/tt-rss/
 fi
-if [  ! -L "/usr/local/tt-rss/themes.local" ] ;  then 
+if [  ! -L "/usr/local/tt-rss/themes.local" ] ;  then
 ln -s /config/themes.local  /usr/local/tt-rss/
 fi
 #检查feedly themes
-if [  ! -d "/config/themes.local/feedly" ] ;  then 
+if [  ! -d "/config/themes.local/feedly" ] ;  then
 cp -rf /usr/local/tt-rss/defaults/themes.local/feedly*  /config/themes.local/
 fi
 
 
 #检查php log文件位置
-if [  ! -e "/config/php/log/error.log" ] ;  then 
+if [  ! -e "/config/php/log/error.log" ] ;  then
 mkdir -p /config/php/log/
 touch /config/php/log/error.log
 fi
 rm /var/log/php7/error.log
 ln -s /config/php/log/error.log  /var/log/php7/error.log
 
-#更改用户
-#PUID=${PUID:-1001}
-#PGID=${PGID:-1001}
-#groupmod -o -g "$PGID" ttrss
-#usermod -o -u "$PUID" ttrss
 
 #更改文件夹权限
-chmod -R 777 /config/
-chmod -R 777 /usr/local/tt-rss/
-chmod -R 777 /var/log/
+chown -R ttrss:ttrss /config/
+chown -R ttrss:ttrss /usr/local/tt-rss/
+chown -R ttrss:ttrss /var/log/php7/
 chown -R postgres:postgres /var/lib/postgresql/data