# Commands

Click the following links to install commands with uweb browser. Force exit and re-launch the app, then long press the button with clock icon to popup the command menu.

Configuration file "default.cmds" examples:

Clear data::toybox find /data/data/info.torapp.uweb/app_webview ! -name 'Cookies' -type f -delete

Append query to autocomplete:uweb:cd /data/data/info.torapp.uweb/files;cat default.autoc query.log|toybox sort|toybox uniq -i>a.tmp;mv a.tmp default.autoc;>query.log;echo file:///data/data/info.torapp.uweb/files/default.autoc

Clear cache::toybox rm -rf /data/data/info.torapp.uweb/cache

Clear logcat::logcat -c

logcat.log::logcat -d > logcat.log

copy cookie:/clip:printf '%c'

config in Download::cd /data/data/info.torapp.uweb;toybox rm -rf files;toybox mkdir -p /sdcard/Download/uweb;toybox ln -s /sdcard/Download/uweb files

html5 in Download::cd /data/data/info.torapp.uweb/files;toybox rm -rf app;toybox mkdir -p /sdcard/Download/app;toybox ln -s /sdcard/Download/app

tgz install::toybox tar -xzf %f -C /

Users should change the IP addresses in the following menus accordingly. In all cases, TV side needs to execute "wait for network msg" first. Send message to network (ex. for android TVs):
Send clipboard:clip/uweb:printf 'i:5ji:5b';cat

Send url::printf '%u'|/system/bin/toybox nc 192.168.2.155 1500

Send url(player)::printf 'i:5g%u'|/system/bin/toybox nc 192.168.2.155 1500

Sendurl(bookmark)::printf 'i:51../home5:i:0mc16:%u'|/system/bin/toybox nc 192.168.2.155 1500

Send url(fullscreen)::printf 'i:5f%u'|/system/bin/toybox nc 192.168.2.155 1500

Send url(video)::printf 'i:0mc16:%u'|/system/bin/toybox nc 192.168.2.155 1500

Send url(clipboard):clip:(printf 'i:5b';cat)|/system/bin/toybox nc 192.168.2.155 1500

Need root permissions:

Need termux:
VPN::am start -a android.net.vpn.SETTINGS

wireless::am start -a android.settings.WIRELESS_SETTINGS

cd:termux/*:cd %f;exit 1

vim:termux/*:vim %f

deduplicate history::awk -F'\t' '!s[$2]++' /data/data/info.torapp.uweb/files/history.rec>/sdcard/a.tmp;mv /sdcard/Download/a.tmp /data/data/info.torapp.uweb/files/history.rec

deduplicate bookmarks::awk '!s[$0]++' /data/data/info.torapp.uweb/files/bookmark.html>/sdcard/Download/a.tmp;mv /sdcard/Download/a.tmp /data/data/info.torapp.uweb/files/bookmark.html

deduplicate hosts::toybox tac /data/data/info.torapp.uweb/files/default.hosts|awk -F' ' '!s[$1]++' |toybox tac>/sdcard/Download/a.tmp;mv /sdcard/Download/a.tmp /data/data/info.torapp.uweb/files/default.hosts

deduplicate siteconf::toybox tac /data/data/info.torapp.uweb/files/default.siteconf|awk -F':' '!s[$1]++' |toybox tac>/sdcard/Download/a.tmp;mv /sdcard/Download/a.tmp /data/data/info.torapp.uweb/files/default.siteconf

Clipboard2PC:clip:ssh fengcao@192.168.2.120 'DISPLAY=:0 xsel -i'

ClipboardFromPC:/clip:ssh fengcao@192.168.2.120 'DISPLAY=:0 xsel -o'

Clipboard broadcast:clip:socat - UDP-DATAGRAM:255.255.255.255:1500,broadcast

Clipboard from broadcast:/clip:socat -u udp-recvfrom:1500 SYSTEM:'cat;exit'

Clipboard2QR:clip/uweb:qrencode -o /sdcard/Download/a.png;echo file:///sdcard/Download/a.png

Clipboard2PC needs to modify username, PC needs xsel. ssh needs to be installed inside termux (apt install openssh).
Clipboard broadcast needs socat（apt install socat)。
Clipboard2QR needs libqrencode.

#### More commands (click to install)

mdme: Show local markdown file

texme: Show local tex+markdown file

markdeep: Show local markdown+tex+diagrams file

remark slide: slide show for local markdown file

Code editor, open url in clipboard etc.

#### ".cmds" file format

Each line has the following format:
[Name]:[mimetype]:[command line]

[command line] can have "%c" (cookie), "%s" (address bar text), "%u" (url), "%t" (title).
[mimetype] have the following formats:

- regular mimetype such as "text/html" to indicate the content type of the command output.
- "clip/clip" to indicate "clipboard" as input and the command output is copied to clipboard.
- "/clip": copy the command output to clipboard.
- "clip/text/html" : clipboard as input, and the command output is processed as "text/html".
- "termux/*": command line is executed under termux.
- "/uweb": the command output is processed as links.