kopia lustrzana https://github.com/OpenDroneMap/WebODM
Plugin utility functions, increased version number
rodzic
60b8a62a0d
commit
cd028274ab
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "WebODM",
|
||||
"version": "0.6.0",
|
||||
"version": "0.6.1",
|
||||
"description": "Open Source Drone Image Processing",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
|
|
|
@ -1 +1,2 @@
|
|||
webpack.config.js
|
||||
disabled
|
||||
|
|
27
start.sh
27
start.sh
|
@ -51,6 +51,9 @@ if [ "$1" = "--setup-devenv" ] || [ "$2" = "--setup-devenv" ]; then
|
|||
webpack --watch &
|
||||
fi
|
||||
|
||||
echo Cleaning up plugins
|
||||
./webodm.sh plugin cleanup
|
||||
|
||||
echo Running migrations
|
||||
python manage.py migrate
|
||||
|
||||
|
@ -74,11 +77,25 @@ cat app/scripts/unlock_all_tasks.py | python manage.py shell
|
|||
|
||||
congrats(){
|
||||
(sleep 5; echo
|
||||
echo -e "\033[92m"
|
||||
echo "Congratulations! └@(・◡・)@┐"
|
||||
echo ==========================
|
||||
echo -e "\033[39m"
|
||||
echo "If there are no errors, WebODM should be up and running!"
|
||||
|
||||
echo "Trying to establish communication..."
|
||||
status=$(curl --max-time 300 -L -s -o /dev/null -w "%{http_code}" "$proto://localhost:8000")
|
||||
|
||||
if [[ "$status" = "200" ]]; then
|
||||
echo -e "\033[92m"
|
||||
echo "Congratulations! └@(・◡・)@┐"
|
||||
echo ==========================
|
||||
echo -e "\033[39m"
|
||||
echo "If there are no errors, WebODM should be up and running!"
|
||||
else
|
||||
echo -e "\033[93m"
|
||||
echo "Something doesn't look right! ¯\_(ツ)_/¯"
|
||||
echo "The server returned a status code of $status when we tried to reach it."
|
||||
echo ==========================
|
||||
echo -e "\033[39m"
|
||||
echo "Check if WebODM is running, maybe we tried to reach it too soon."
|
||||
fi
|
||||
|
||||
echo -e "\033[93m"
|
||||
echo Open a web browser and navigate to $proto://$WO_HOST:$WO_PORT
|
||||
echo -e "\033[39m"
|
||||
|
|
76
webodm.sh
76
webodm.sh
|
@ -98,7 +98,12 @@ usage(){
|
|||
echo " rebuild Rebuild all docker containers and perform cleanups"
|
||||
echo " checkenv Do an environment check and install missing components"
|
||||
echo " test Run the unit test suite (developers only)"
|
||||
echo " resetadminpassword <newpassword> Reset the administrator's password to a new one. WebODM must be running when executing this command."
|
||||
echo " resetadminpassword <new password> Reset the administrator's password to a new one. WebODM must be running when executing this command."
|
||||
echo ""
|
||||
echo " plugin enable <plugin name> Enable a plugin"
|
||||
echo " plugin disable <plugin name> Disable a plugin"
|
||||
echo " plugin list List all available plugins"
|
||||
echo " plugin cleanup Cleanup plugins build directories"
|
||||
echo ""
|
||||
echo "Options:"
|
||||
echo " --port <port> Set the port that WebODM should bind to (default: $DEFAULT_PORT)"
|
||||
|
@ -218,6 +223,7 @@ down(){
|
|||
|
||||
rebuild(){
|
||||
run "docker-compose down --remove-orphans"
|
||||
plugin_cleanup
|
||||
run "rm -fr node_modules/ || sudo rm -fr node_modules/"
|
||||
run "rm -fr nodeodm/external/node-OpenDroneMap || sudo rm -fr nodeodm/external/node-OpenDroneMap"
|
||||
run "docker-compose -f docker-compose.yml -f docker-compose.build.yml build --no-cache"
|
||||
|
@ -225,6 +231,54 @@ rebuild(){
|
|||
echo -e "\033[1mDone!\033[0m You can now start WebODM by running $0 start"
|
||||
}
|
||||
|
||||
plugin_cleanup(){
|
||||
# Delete all node_modules and build directories within plugins' public/ folders
|
||||
find plugins/ -type d \( -name build -o -name node_modules \) -path 'plugins/*/public/*' -exec rm -frv '{}' \; 2>/dev/null
|
||||
}
|
||||
|
||||
plugin_list(){
|
||||
plugins=$(ls plugins/ --hide test)
|
||||
for plugin in $plugins; do
|
||||
if [ -e "plugins/$plugin/disabled" ]; then
|
||||
echo "$plugin [disabled]"
|
||||
else
|
||||
echo "$plugin"
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
plugin_check(){
|
||||
plugin_name="$1"
|
||||
if [ ! -e "plugins/$plugin_name" ]; then
|
||||
echo "Plugin $plugin_name does not exist."
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
plugin_enable(){
|
||||
plugin_name="$1"
|
||||
plugin_check $plugin_name
|
||||
|
||||
if [ -e "plugins/$plugin_name/disabled" ]; then
|
||||
rm "plugins/$plugin_name/disabled"
|
||||
echo "Plugin enabled. Run ./webodm.sh restart to apply the changes."
|
||||
else
|
||||
echo "Plugin already enabled."
|
||||
fi
|
||||
}
|
||||
|
||||
plugin_disable(){
|
||||
plugin_name="$1"
|
||||
plugin_check $plugin_name
|
||||
|
||||
if [ ! -e "plugins/$plugin_name/disabled" ]; then
|
||||
touch "plugins/$plugin_name/disabled"
|
||||
echo "Plugin disabled. Run ./webodm.sh restart to apply the changes."
|
||||
else
|
||||
echo "Plugin already disabled."
|
||||
fi
|
||||
}
|
||||
|
||||
run_tests(){
|
||||
echo -e "\033[1mRunning frontend tests\033[0m"
|
||||
run "npm run test"
|
||||
|
@ -291,6 +345,26 @@ elif [[ $1 = "test" ]]; then
|
|||
run_tests
|
||||
elif [[ $1 = "resetadminpassword" ]]; then
|
||||
resetpassword $2
|
||||
elif [[ $1 = "plugin" ]]; then
|
||||
if [[ $2 = "cleanup" ]]; then
|
||||
plugin_cleanup
|
||||
elif [[ $2 = "list" ]]; then
|
||||
plugin_list
|
||||
elif [[ $2 = "enable" ]]; then
|
||||
if [[ ! -z "$3" ]]; then
|
||||
plugin_enable $3
|
||||
else
|
||||
usage
|
||||
fi
|
||||
elif [[ $2 = "disable" ]]; then
|
||||
if [[ ! -z "$3" ]]; then
|
||||
plugin_disable $3
|
||||
else
|
||||
usage
|
||||
fi
|
||||
else
|
||||
usage
|
||||
fi
|
||||
else
|
||||
usage
|
||||
fi
|
||||
|
|
Ładowanie…
Reference in New Issue