From cadca437d2c550cd6fb9cd9c1156f9f89771f4e8 Mon Sep 17 00:00:00 2001 From: Cris70 Date: Thu, 27 Apr 2017 10:26:35 +0200 Subject: [PATCH 1/3] Corrected a few errors Corrected an error in the italian command line (double '&&'). Modified path in the 'Reinstall' command line to make it work correctly. Signed-off-by: cristiano --- url2webapp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/url2webapp b/url2webapp index ad65042..ca38ba7 100755 --- a/url2webapp +++ b/url2webapp @@ -13,7 +13,7 @@ LNAME=`kdialog --title "Launcher" --inputbox " Define the launcher name (i.e. My App): "`|| exit 0; temp_NAME=`kdialog --title "App ID" --inputbox " -Define an app ID (i.e. reverse URL like com.domain.subdomain), +Define an app ID (i.e. reverse URL like com.domain.subdomain), so icon themes can identify it and ship a custom icon: " ` || exit 0; NAME=`echo "$temp_NAME" | tr ' ' '_'`; @@ -41,11 +41,11 @@ Actions=in-browser;reinstall;uninstall; [Desktop Action reinstall] Name=Reinstall -Exec=kdialog --title Reinstall --warningyesno 'Are you sure?' && nativefier-freedesktop ~/.webapps/$NAME/$NAME.webapp +Exec=kdialog --title Reinstall --warningyesno 'Are you sure?' && nativefier-freedesktop ~/.webapps/installers/$NAME.webapp Icon=view-refresh Name[it]=Reinstalla -Exec[it]=kdialog --title Reinstalla --warningyesno 'Sei sicuro?' && && nativefier-freedesktop ~/.webapps/$NAME/$NAME.webapp +Exec[it]=kdialog --title Reinstalla --warningyesno 'Sei sicuro?' && nativefier-freedesktop ~/.webapps/installers/$NAME.webapp [Desktop Action uninstall] @@ -75,7 +75,7 @@ for i in *.css do mv -f "$i" "`echo $i | tr ' ' '_'`" done; - + for i in *.js do mv -f "$i" "`echo $i | tr ' ' '_'`" From 8c80e2e8a5b03302be13f5c8448e00a64bf46950 Mon Sep 17 00:00:00 2001 From: Cris70 Date: Fri, 28 Apr 2017 13:38:05 +0200 Subject: [PATCH 2/3] Flash support added - corrected a few bugs with relative paths - added support for flash --- nativefier-freedesktop | 65 ++++++++++++++++++++++++++++++++++++------ 1 file changed, 56 insertions(+), 9 deletions(-) diff --git a/nativefier-freedesktop b/nativefier-freedesktop index b730647..31cb728 100755 --- a/nativefier-freedesktop +++ b/nativefier-freedesktop @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/bash if [[ $# -eq 0 ]] ; then webapp=`kdialog --getopenfilename ~ .webapp`; @@ -8,20 +8,41 @@ if [[ $# -eq 0 ]] ; then exit 0; fi else - webapp="$1"; + if [[ "$1" == "--help" ]] ; then + echo " + Usage: nativefier-freedesktop [options] [] + + Options: + + --help shows this helps message + + + : a .webapp file used as a guide to create the application; + if not specified, a file dialog will popup to ask for a + .webapp file; + use the url2webapp script to create a .webapp file from + an url +" + exit 0; + else + webapp="$1"; + fi fi # make temp folder: mkdir .nf_temp; +# resolve absolute path if relative, otherwise cp on line 219 will fail +webapp=`readlink -f "$webapp"`; + # copy the .webapp into it: -cp "$webapp" .nf_temp/"$webapp" +cp "$webapp" ".nf_temp/${webapp##*/}" # move to it: cd .nf_temp; # extract .webapp: -tar -zxvf "$webapp"; +tar -zxvf "${webapp##*/}"; # check if "name" file exists: if [ -f name ]; then @@ -32,6 +53,11 @@ else # (useful for self-hosted apps with custom domain) # as convention use reverse URL, i.e. org.kde.webapp: name=`kdialog --inputbox "Name, i.e. org.kde.webapp:" | tr ' ' '_'` + if [ -z $name ]; then + echo "File name is empty" + rm -rf .nf_temp; + exit 0; + fi fi # read launcher name: @@ -51,6 +77,28 @@ else fi +# support flash?: +flash=1; +kdialog --title "Install Web App" --yesno "Does $lname need flash support?" || flash=0; +if [ "$flash" -eq 1 ]; then + fp=`locate libpepflashplayer.so`; + case "$?" in + 1) + echo 'No flash plugin available' + flash=0 + ;; + 127) + echo 'locate command not installed' + flash=0 + ;; + esac +fi +if [ "$flash" -eq "1" ]; then + fcmd="--flash --flash-path $fp"; +else + fcmd=''; +fi + # copy the icon and the launcher to respective paths: cp "$name".png ~/.local/share/icons/"$name".png; @@ -91,12 +139,12 @@ if [ "$cssn" -gt "1" ]; then rm -rf .tempfile style=`kdialog --radiolist "Select a theme:" $kd_arg 0 None off` - + if [ "$style" -eq 0 ]; then touch nostyle.css style=nostyle.css fi - + #for i in *.css #do # declare style_$k=`echo "${i%.*}" | tr ' ' '_'`; @@ -147,11 +195,10 @@ kdialog --msgbox "The installation has begun and may take a few minutes.\nYou wi # check if the PNG icon file exists: if [ -f "$name".png ]; then # exec nativefier using the icon and injecting style.css and script.js - nativefier -n "$name" -i "$name".png --inject "$style" --inject "$script" "$url" ~/.webapps/; + nativefier -n "$name" -i "$name".png $fcmd --inject "$style" --inject "$script" "$url" ~/.webapps/; else # exec nativefier without icon and injecting style.css and script.js - nativefier -n "$name" --inject "$style" --inject "$script" "$url" ~/.webapps/; - + nativefier -n "$name" $fcmd --inject "$style" --inject "$script" "$url" ~/.webapps/; fi From 5c6011912a5834379bcb1eb4b3ca598d92967f27 Mon Sep 17 00:00:00 2001 From: Cristiano Guadagnino Date: Sat, 29 Apr 2017 12:55:22 +0200 Subject: [PATCH 3/3] Fixed an issue with Flash - fixed an issue with locating the Flash library when more then one copy is present in the system --- nativefier-freedesktop | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nativefier-freedesktop b/nativefier-freedesktop index 31cb728..b3919db 100755 --- a/nativefier-freedesktop +++ b/nativefier-freedesktop @@ -81,7 +81,7 @@ fi flash=1; kdialog --title "Install Web App" --yesno "Does $lname need flash support?" || flash=0; if [ "$flash" -eq 1 ]; then - fp=`locate libpepflashplayer.so`; + fp=`locate -e -L -l 1 -b '\libpepflashplayer.so'`; case "$?" in 1) echo 'No flash plugin available'