-
-
Save francescom/b8ff752da868f9df7e6485a7470a9c84 to your computer and use it in GitHub Desktop.
this installs the browser-based editor Codiad
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#installs the browser-based editor Codiad | |
DEST=~/codiad | |
ADDR_OUT=0.0.0.0:9876 | |
pkg install -y php readline git | |
if [ ! -e $DEST ] | |
then | |
git clone --depth 1 https://github.com/francescom/Codiad $DEST | |
fi | |
cat > $DEST/config.php << XXXXX | |
<?php | |
/* | |
* Copyright (c) Codiad & Kent Safranski (codiad.com), distributed | |
* as-is and without warranty under the MIT License. See | |
* [root]/license.txt for more. This information must remain intact. | |
*/ | |
////////////////////////////////////////////////////////////////// | |
// CONFIG | |
////////////////////////////////////////////////////////////////// | |
// PATH TO CODIAD | |
define("BASE_PATH", "$DEST"); | |
// BASE URL TO CODIAD (without trailing slash) | |
define("BASE_URL", "$ADDR_OUT"); | |
// THEME : default, modern or clear (look at /themes) | |
define("THEME", "default"); | |
// ABSOLUTE PATH | |
define("WHITEPATHS", BASE_PATH . ",/"); | |
// SESSIONS (e.g. 7200) | |
\$cookie_lifetime = "0"; | |
// TIMEZONE | |
date_default_timezone_set("Asia/Damascus"); | |
// External Authentification | |
define("AUTH_PATH", "$DEST/noauth.php"); | |
////////////////////////////////////////////////////////////////// | |
// ** DO NOT EDIT CONFIG BELOW ** | |
////////////////////////////////////////////////////////////////// | |
// PATHS | |
define("COMPONENTS", BASE_PATH . "/components"); | |
define("PLUGINS", BASE_PATH . "/plugins"); | |
define("THEMES", BASE_PATH . "/themes"); | |
define("DATA", BASE_PATH . "/data"); | |
define("WORKSPACE", BASE_PATH . "/workspace"); | |
// URLS | |
define("WSURL", BASE_URL . "/workspace"); | |
// Marketplace | |
//define("MARKETURL", "http://market.codiad.com/json"); | |
// Update Check | |
//define("UPDATEURL", "http://update.codiad.com/?v={VER}&o={OS}&p={PHP}&w={WEB}&a={ACT}"); | |
//define("ARCHIVEURL", "https://github.com/Codiad/Codiad/archive/master.zip"); | |
//define("COMMITURL", "https://api.github.com/repos/Codiad/Codiad/commits"); | |
XXXXX | |
cat > $DEST/data/users.php << XXXXX | |
<?php | |
/*|[{"username":"termux","password":"6558b496fb21c09603c5b28c998481ae075228ad","project":"\/data\/data\/com.termux\/files\/home\/"}]|*/ | |
?> | |
XXXXX | |
cat > $DEST/data/projects.php << XXXXX | |
<?php | |
/*|[{"name":"termux_home","path":"\/data\/data\/com.termux\/files\/home\/"}]|*/ | |
?> | |
XXXXX | |
cat > $DEST/noauth.php << XXXXX | |
<?php | |
\$_SESSION['user'] = 'termux'; | |
?> | |
XXXXX | |
cat > $PREFIX/bin/codiad << XXXXX | |
cd $DEST | |
if [ "$1" = "--public" ] ; then | |
ADDR=127.0.0.1:9876 | |
else | |
ADDR=0.0.0.0:9876 | |
fi | |
php -S $ADDR & | |
if [ "$1" = "--public" ] ; then | |
echo "Open a browser and connect to your mobile, on port 9876" | |
else | |
xdg-open http://$ADDR | |
fi | |
wait | |
XXXXX | |
chmod +x $PREFIX/bin/codiad | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment