Enable font-awesome with fedwiki

This commit is contained in:
Bob Mottram 2018-01-05 18:38:00 +00:00
parent 2805ec45a7
commit 2cc5b6987e
1 changed files with 19 additions and 2 deletions

View File

@ -54,8 +54,15 @@ fedwiki_variables=(FEDWIKI_DOMAIN_NAME
MY_EMAIL_ADDRESS) MY_EMAIL_ADDRESS)
function fedwiki_remove_bad_links { function fedwiki_remove_bad_links {
if [ -f /usr/local/lib/node_modules/wiki/node_modules/wiki-security-friends/client/security.js ]; then if [[ $ONION_ONLY == 'no' ]]; then
sed -i 's|maxcdn.bootstrapcdn.com|localhost|g' /usr/local/lib/node_modules/wiki/node_modules/wiki-security-friends/client/security.js sed -i "s|link[href='https://maxcdn.bootstrapcdn.com.*|link[href='https://${FEDWIKI_DOMAIN_NAME}/fonts-font-awesome/css/font-awesome.min.css']\").length) {|g" /usr/local/lib/node_modules/wiki/node_modules/wiki-security-friends/client/security.js
sed -i "s|\$('<link rel=\"stylesheet\" href=\"https://maxcdn.bootstrapcdn.com.*|\$('<link rel=\"stylesheet\" href=\"https://${FEDWIKI_DOMAIN_NAME}/fonts-font-awesome/css/font-awesome.min.css\">').appendTo(\"head\");|g" /usr/local/lib/node_modules/wiki/node_modules/wiki-security-friends/client/security.js
else
FEDWIKI_ONION_HOSTNAME=$(cat /var/lib/tor/hidden_service_fedwiki/hostname)
sed -i "s|link[href='https://maxcdn.bootstrapcdn.com.*|link[href='http://${FEDWIKI_ONION_HOSTNAME}/fonts-font-awesome/css/font-awesome.min.css']\").length) {|g" /usr/local/lib/node_modules/wiki/node_modules/wiki-security-friends/client/security.js
sed -i "s|\$('<link rel=\"stylesheet\" href=\"https://maxcdn.bootstrapcdn.com.*|\$('<link rel=\"stylesheet\" href=\"http://${FEDWIKI_ONION_HOSTNAME}/fonts-font-awesome/css/font-awesome.min.css\">').appendTo(\"head\");|g" /usr/local/lib/node_modules/wiki/node_modules/wiki-security-friends/client/security.js
fi fi
if [ -f /usr/local/lib/node_modules/wiki/node_modules/localforage/docs/theme/style.css ]; then if [ -f /usr/local/lib/node_modules/wiki/node_modules/localforage/docs/theme/style.css ]; then
@ -333,6 +340,10 @@ function fedwiki_setup_web {
echo ' add_header X-Content-Type-Options nosniff;' >> $fedwiki_nginx_file echo ' add_header X-Content-Type-Options nosniff;' >> $fedwiki_nginx_file
echo ' add_header Strict-Transport-Security max-age=15768000;' >> $fedwiki_nginx_file echo ' add_header Strict-Transport-Security max-age=15768000;' >> $fedwiki_nginx_file
echo '' >> $fedwiki_nginx_file echo '' >> $fedwiki_nginx_file
echo ' location /fonts-font-awesome/ {' >> $fedwiki_nginx_file
echo ' alias /usr/share/fonts-font-awesome/;' >> $fedwiki_nginx_file
echo ' }' >> $fedwiki_nginx_file
echo '' >> $fedwiki_nginx_file
echo ' location / {' >> $fedwiki_nginx_file echo ' location / {' >> $fedwiki_nginx_file
echo " proxy_pass http://localhost:${FEDWIKI_PORT};" >> $fedwiki_nginx_file echo " proxy_pass http://localhost:${FEDWIKI_PORT};" >> $fedwiki_nginx_file
echo ' proxy_set_header X-Real-IP $remote_addr;' >> $fedwiki_nginx_file echo ' proxy_set_header X-Real-IP $remote_addr;' >> $fedwiki_nginx_file
@ -354,6 +365,10 @@ function fedwiki_setup_web {
echo ' add_header X-Frame-Options DENY;' >> $fedwiki_nginx_file echo ' add_header X-Frame-Options DENY;' >> $fedwiki_nginx_file
echo ' add_header X-Content-Type-Options nosniff;' >> $fedwiki_nginx_file echo ' add_header X-Content-Type-Options nosniff;' >> $fedwiki_nginx_file
echo '' >> $fedwiki_nginx_file echo '' >> $fedwiki_nginx_file
echo ' location /fonts-font-awesome/ {' >> $fedwiki_nginx_file
echo ' alias /usr/share/fonts-font-awesome/;' >> $fedwiki_nginx_file
echo ' }' >> $fedwiki_nginx_file
echo '' >> $fedwiki_nginx_file
echo ' location / {' >> $fedwiki_nginx_file echo ' location / {' >> $fedwiki_nginx_file
echo " proxy_pass http://localhost:${FEDWIKI_PORT};" >> $fedwiki_nginx_file echo " proxy_pass http://localhost:${FEDWIKI_PORT};" >> $fedwiki_nginx_file
echo ' proxy_set_header X-Real-IP $remote_addr;' >> $fedwiki_nginx_file echo ' proxy_set_header X-Real-IP $remote_addr;' >> $fedwiki_nginx_file
@ -401,6 +416,8 @@ function install_fedwiki {
function_check install_nodejs function_check install_nodejs
install_nodejs fedwiki install_nodejs fedwiki
apt-get -yq install fonts-font-awesome
npm install -g wiki@$FEDWIKI_VERSION npm install -g wiki@$FEDWIKI_VERSION
if [ ! "$?" = "0" ]; then if [ ! "$?" = "0" ]; then
echo $'Failed to install fedwiki' echo $'Failed to install fedwiki'