浏览代码

Ensure that key and base url remain unchanged after updates

Bob Mottram 9 年前
父节点
当前提交
cdf3e2d6ce
共有 1 个文件被更改,包括 7 次插入0 次删除
  1. 7
    0
      src/freedombone

+ 7
- 0
src/freedombone 查看文件

@@ -9170,6 +9170,13 @@ function install_search_engine {
9170 9170
 
9171 9171
     # update to a new commit if needed
9172 9172
     set_repo_commit $SEARCH_ENGINE_PATH/searx "Search engine commit" "$SEARCH_ENGINE_COMMIT" $SEARCH_ENGINE_REPO
9173
+    if grep "Search engine key" $COMPLETION_FILE; then
9174
+        if [ -f ${SEARCH_ENGINE_PATH}/searx/searx/settings.yml ]; then
9175
+            SEARCH_ENGINE_SECRET_KEY=$(cat $COMPLETION_FILE | grep "Search engine key" | awk -F ':' '{print $2}')
9176
+            sed -i "s|secret_key.*|secret_key : \"${SEARCH_ENGINE_SECRET_KEY}\"|g" ${SEARCH_ENGINE_PATH}/searx/searx/settings.yml
9177
+            sed -i "s|base_url.*|base_url : \"http://${SEARCH_ENGINE_ONION_HOSTNAME}\"|g" ${SEARCH_ENGINE_PATH}/searx/searx/settings.yml
9178
+        fi
9179
+    fi
9173 9180
 
9174 9181
     if grep -Fxq "install_search_engine" $COMPLETION_FILE; then
9175 9182
         return