fix: Bot 的電腦上網頁上傳圖片送不出去;看畫面時可以跟自己的電腦複製貼上
Threads 加相片在 Bot 的電腦上一直「點不到」:Chromium 開的 GTK 檔案視窗高 822、螢幕只有 800,又沒有 GNOME 的設定服務,「取消」「開啟」放在視窗最下面、被螢幕和工作列蓋住,圖片選 得到卻永遠送不出去(完整的 Linux 桌面按鈕在頂端,所以正常)。現在 GTK 的對話框把按鈕放在 頂端的標題列,檔案視窗預設比螢幕小。在同一版映像實測:點上傳 → 進 Pictures → 選圖 → Open, 頁面收到 1 個檔案。 借鏡 LazyBoy2 的 box:跑 vncconfig,看畫面時剪貼簿跟使用者的電腦同步(共用螢幕和每個 Bot 自己的螢幕都是);websockify 每 30 秒送心跳,中間的代理不會切掉只在看的連線。 Bot 的電腦升到第 11 版(設定 › 電腦「更新 Bot 的電腦」)。功能地圖:網頁上傳檔案用 browser 的 upload。 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
ec7a9ba77d
commit
cf05b4edf5
|
|
@ -40,6 +40,6 @@ RUN chmod +x /usr/local/bin/anybot-box-start /usr/local/bin/anybot-a11y /usr/loc
|
||||||
# without it — no numbers at all, only a picture to guess at. GTK 3 apps ignore it.
|
# without it — no numbers at all, only a picture to guess at. GTK 3 apps ignore it.
|
||||||
ENV DISPLAY=:1 SCREEN_SIZE=1280x800x24 GTK_MODULES=gail:atk-bridge GTK_A11Y=atspi GNOME_ACCESSIBILITY=1 NO_AT_BRIDGE=0
|
ENV DISPLAY=:1 SCREEN_SIZE=1280x800x24 GTK_MODULES=gail:atk-bridge GTK_A11Y=atspi GNOME_ACCESSIBILITY=1 NO_AT_BRIDGE=0
|
||||||
EXPOSE 6080
|
EXPOSE 6080
|
||||||
LABEL anybot.box.version="10"
|
LABEL anybot.box.version="11"
|
||||||
ENTRYPOINT ["/usr/bin/tini", "--"]
|
ENTRYPOINT ["/usr/bin/tini", "--"]
|
||||||
CMD ["/usr/local/bin/anybot-box-start"]
|
CMD ["/usr/local/bin/anybot-box-start"]
|
||||||
|
|
|
||||||
|
|
@ -107,6 +107,8 @@ up() {
|
||||||
done
|
done
|
||||||
as_bot "DISPLAY=:$disp xrdb -nocpp -merge /home/bot/.Xresources" 2>/dev/null
|
as_bot "DISPLAY=:$disp xrdb -nocpp -merge /home/bot/.Xresources" 2>/dev/null
|
||||||
as_bot "DISPLAY=:$disp DBUS_SESSION_BUS_ADDRESS=$bus setsid fluxbox >/dev/null 2>&1 & echo \$!" 8>&- >> "$d/pids"
|
as_bot "DISPLAY=:$disp DBUS_SESSION_BUS_ADDRESS=$bus setsid fluxbox >/dev/null 2>&1 & echo \$!" 8>&- >> "$d/pids"
|
||||||
|
# Copy and paste with the person's computer (as on the shared screen: start.sh).
|
||||||
|
as_bot "DISPLAY=:$disp setsid vncconfig -nowin >/dev/null 2>&1 & echo \$!" 8>&- >> "$d/pids"
|
||||||
xsetroot -display ":$disp" -solid '#2b2f36'
|
xsetroot -display ":$disp" -solid '#2b2f36'
|
||||||
{
|
{
|
||||||
echo "DISPLAY=:$disp"
|
echo "DISPLAY=:$disp"
|
||||||
|
|
|
||||||
17
box/start.sh
17
box/start.sh
|
|
@ -5,6 +5,13 @@ mkdir -p /home/bot/.fluxbox /home/bot/Desktop && cp -n /etc/anybot/fluxbox-init
|
||||||
cp -n /etc/anybot/overlay /home/bot/.fluxbox/overlay 2>/dev/null
|
cp -n /etc/anybot/overlay /home/bot/.fluxbox/overlay 2>/dev/null
|
||||||
cp -n /etc/anybot/Xresources /home/bot/.Xresources 2>/dev/null
|
cp -n /etc/anybot/Xresources /home/bot/.Xresources 2>/dev/null
|
||||||
cp /etc/anybot/menu /home/bot/.fluxbox/menu 2>/dev/null
|
cp /etc/anybot/menu /home/bot/.fluxbox/menu 2>/dev/null
|
||||||
|
# GTK's dialogs (a web page's 上傳檔案 in Chromium, e.g. Threads' 加入相片) with 取消 and 開啟 in a
|
||||||
|
# bar at the top, as on GNOME. Without GNOME's settings service GTK put them at the bottom of a
|
||||||
|
# file window taller than the screen, under the taskbar: a picture could be found but never sent.
|
||||||
|
GTKINI=/home/bot/.config/gtk-3.0/settings.ini
|
||||||
|
mkdir -p "${GTKINI%/*}"
|
||||||
|
grep -q '^\[Settings\]' "$GTKINI" 2>/dev/null || printf '[Settings]\n' >> "$GTKINI"
|
||||||
|
grep -q '^gtk-dialogs-use-header' "$GTKINI" || sed -i '/^\[Settings\]/a gtk-dialogs-use-header=true' "$GTKINI"
|
||||||
chown -R bot:bot /home/bot
|
chown -R bot:bot /home/bot
|
||||||
rm -f /tmp/.X1-lock /tmp/.X11-unix/X1
|
rm -f /tmp/.X1-lock /tmp/.X11-unix/X1
|
||||||
# One TigerVNC server is the screen and the VNC server (was Xvfb + x11vnc, which polls the
|
# One TigerVNC server is the screen and the VNC server (was Xvfb + x11vnc, which polls the
|
||||||
|
|
@ -39,15 +46,23 @@ for c in /usr/libexec/at-spi2-registryd /usr/lib/at-spi2-core/at-spi2-registryd;
|
||||||
[ -x "$c" ] && { su bot -c "DISPLAY=:1 DBUS_SESSION_BUS_ADDRESS=$DBUS_SESSION_BUS_ADDRESS $c >/tmp/atspi-registry.log 2>&1 &"; break; }
|
[ -x "$c" ] && { su bot -c "DISPLAY=:1 DBUS_SESSION_BUS_ADDRESS=$DBUS_SESSION_BUS_ADDRESS $c >/tmp/atspi-registry.log 2>&1 &"; break; }
|
||||||
done
|
done
|
||||||
su bot -c "DBUS_SESSION_BUS_ADDRESS=$DBUS_SESSION_BUS_ADDRESS gsettings set org.gnome.desktop.interface toolkit-accessibility true" 2>/dev/null || true
|
su bot -c "DBUS_SESSION_BUS_ADDRESS=$DBUS_SESSION_BUS_ADDRESS gsettings set org.gnome.desktop.interface toolkit-accessibility true" 2>/dev/null || true
|
||||||
|
# The file window opens smaller than the screen, whatever size it was left at.
|
||||||
|
SW="${GEOM%x*}"; SH="${GEOM#*x}"
|
||||||
|
su bot -c "DBUS_SESSION_BUS_ADDRESS=$DBUS_SESSION_BUS_ADDRESS gsettings set org.gtk.Settings.FileChooser window-size '($((SW * 7 / 10)), $((SH * 3 / 4)))'" 2>/dev/null || true
|
||||||
su bot -c "DISPLAY=:1 DBUS_SESSION_BUS_ADDRESS=$DBUS_SESSION_BUS_ADDRESS xrdb -nocpp -merge /home/bot/.Xresources"
|
su bot -c "DISPLAY=:1 DBUS_SESSION_BUS_ADDRESS=$DBUS_SESSION_BUS_ADDRESS xrdb -nocpp -merge /home/bot/.Xresources"
|
||||||
su bot -c "DISPLAY=:1 DBUS_SESSION_BUS_ADDRESS=$DBUS_SESSION_BUS_ADDRESS fluxbox >/tmp/fluxbox.log 2>&1 &"
|
su bot -c "DISPLAY=:1 DBUS_SESSION_BUS_ADDRESS=$DBUS_SESSION_BUS_ADDRESS fluxbox >/tmp/fluxbox.log 2>&1 &"
|
||||||
|
# Copy and paste between the person's computer and this one: Xvnc hands the viewer's clipboard to
|
||||||
|
# the X selections (and back) only while vncconfig runs (after LazyBoy2's box).
|
||||||
|
su bot -c "DISPLAY=:1 vncconfig -nowin >/tmp/vncconfig.log 2>&1 &"
|
||||||
(sleep 1.5; xsetroot -display :1 -solid '#2b2f36') &
|
(sleep 1.5; xsetroot -display :1 -solid '#2b2f36') &
|
||||||
xsetroot -display :1 -solid '#2b2f36'
|
xsetroot -display :1 -solid '#2b2f36'
|
||||||
# One web viewer for every screen: the shared one is "main"; anybot-screen adds each bot's own
|
# One web viewer for every screen: the shared one is "main"; anybot-screen adds each bot's own
|
||||||
# (每個 Bot 一個螢幕). A viewer picks one with ?path=websockify%3Ftoken%3D<key>.
|
# (每個 Bot 一個螢幕). A viewer picks one with ?path=websockify%3Ftoken%3D<key>.
|
||||||
rm -rf /tmp/anybot-screens; mkdir -p /tmp/anybot-screens && chmod 1777 /tmp/anybot-screens
|
rm -rf /tmp/anybot-screens; mkdir -p /tmp/anybot-screens && chmod 1777 /tmp/anybot-screens
|
||||||
echo "main: localhost:5900" > /tmp/anybot-vnc-tokens && chown bot:bot /tmp/anybot-vnc-tokens
|
echo "main: localhost:5900" > /tmp/anybot-vnc-tokens && chown bot:bot /tmp/anybot-vnc-tokens
|
||||||
websockify --web /usr/share/novnc --token-plugin TokenFile --token-source /tmp/anybot-vnc-tokens 6080 >/tmp/novnc.log 2>&1 &
|
# (A ping every 30 s: a proxy on the way — Tailscale serve, Caddy — doesn't drop a viewer that is
|
||||||
|
# only watching a still screen.)
|
||||||
|
websockify --heartbeat=30 --web /usr/share/novnc --token-plugin TokenFile --token-source /tmp/anybot-vnc-tokens 6080 >/tmp/novnc.log 2>&1 &
|
||||||
WEBSOCKIFY_PID=$!
|
WEBSOCKIFY_PID=$!
|
||||||
# Say ready only once the viewer's port listens: the app opens noVNC on this flag, and a too
|
# Say ready only once the viewer's port listens: the app opens noVNC on this flag, and a too
|
||||||
# early file meant the first viewer load 404'd.
|
# early file meant the first viewer load 404'd.
|
||||||
|
|
|
||||||
|
|
@ -36,3 +36,4 @@ Bot 用 AnyBot 自己的瀏覽器上網、登入網站、點按、打字、送
|
||||||
- 雲端中繼資料位址永遠打不開;本機或內部網路的網址要使用者允許(直接操作模式除外)。
|
- 雲端中繼資料位址永遠打不開;本機或內部網路的網址要使用者允許(直接操作模式除外)。
|
||||||
- 發布關卡、已送帳本、送出後確認只管 AnyBot 自己的瀏覽器;用螢幕操作送出的,只能從步驟推算。頁面看不出回哪一篇時,只擋 24 小時內同一頁一模一樣的內容。
|
- 發布關卡、已送帳本、送出後確認只管 AnyBot 自己的瀏覽器;用螢幕操作送出的,只能從步驟推算。頁面看不出回哪一篇時,只擋 24 小時內同一頁一模一樣的內容。
|
||||||
- 送出後頁面上沒看到(例如從動態牆送出),結果寫「還沒確認」:不要因此再送一次,回原貼文看。
|
- 送出後頁面上沒看到(例如從動態牆送出),結果寫「還沒確認」:不要因此再送一次,回原貼文看。
|
||||||
|
- 網頁要上傳檔案(Threads、IG 加相片、表單附件):用 `upload` 直接放進頁面的檔案欄位。用螢幕去點「加入相片」會跳出 Bot 電腦的檔案視窗(「取消」「Open」在最上面),還要在裡面找檔案、按 Open。
|
||||||
|
|
|
||||||
|
|
@ -32,6 +32,8 @@
|
||||||
- Bot 不能自己換電腦:工具指定了別台,但使用者最近三則訊息沒提到那台,這一步會被移回使用者選的那台,結果裡會說。真的要別台先問使用者。
|
- Bot 不能自己換電腦:工具指定了別台,但使用者最近三則訊息沒提到那台,這一步會被移回使用者選的那台,結果裡會說。真的要別台先問使用者。
|
||||||
- 使用者選的那台沒開機、或那台的 AnyBot 沒開沒登入,就不在清單上:Bot 先待在自己的電腦,`list_computers` 會寫那台「現在沒有連線」。
|
- 使用者選的那台沒開機、或那台的 AnyBot 沒開沒登入,就不在清單上:Bot 先待在自己的電腦,`list_computers` 會寫那台「現在沒有連線」。
|
||||||
- 在 Bot 自己的電腦上做事不用問,但它看不到使用者的檔案;檔案工具只碰得到自己的資料夾(大家共用同一台)。
|
- 在 Bot 自己的電腦上做事不用問,但它看不到使用者的檔案;檔案工具只碰得到自己的資料夾(大家共用同一台)。
|
||||||
|
- Bot 的電腦是精簡的 Linux 桌面(Debian + fluxbox):檔案視窗的「取消」「Open」在視窗最上面(第 11 版以前在最下面、被螢幕切掉,網頁上傳圖片選得到檔案卻送不出去——設定 › 電腦「更新 Bot 的電腦」換新版)。看畫面時可以跟自己的電腦互相複製貼上。
|
||||||
|
- 從帳號看 Bot 電腦的畫面,只要開著就不會斷;之前靜止畫面一分鐘、或看超過十分鐘會被帳號伺服器切掉,要更新帳號伺服器(make update-server)。
|
||||||
- 「在這台電腦上執行」設成永不允許(或被管理員鎖住)時,這台的檔案也不能傳出去、打開或發佈。
|
- 「在這台電腦上執行」設成永不允許(或被管理員鎖住)時,這台的檔案也不能傳出去、打開或發佈。
|
||||||
- SSH 電腦上的檔案不能直接傳到聊天、打開給使用者看或發佈網站,要先複製到 Bot 自己的電腦。
|
- SSH 電腦上的檔案不能直接傳到聊天、打開給使用者看或發佈網站,要先複製到 Bot 自己的電腦。
|
||||||
- 帳號裡的其他電腦:看畫面、操作畫面各自要使用者允許(可以一律允許);改檔案和指令照 SSH 電腦的規則問。
|
- 帳號裡的其他電腦:看畫面、操作畫面各自要使用者允許(可以一律允許);改檔案和指令照 SSH 電腦的規則問。
|
||||||
|
|
|
||||||
|
|
@ -3423,7 +3423,7 @@ mod tests {
|
||||||
use chrono::TimeZone;
|
use chrono::TimeZone;
|
||||||
let at = chrono::Utc.with_ymd_and_hms(2026, 11, 6, 19, 0, 0).unwrap().with_timezone(&chrono_tz::Asia::Taipei);
|
let at = chrono::Utc.with_ymd_and_hms(2026, 11, 6, 19, 0, 0).unwrap().with_timezone(&chrono_tz::Asia::Taipei);
|
||||||
assert!(in_schedule_window("03:00", at.time()));
|
assert!(in_schedule_window("03:00", at.time()));
|
||||||
assert_eq!(wanted_version(), "10");
|
assert_eq!(wanted_version(), "11");
|
||||||
// Every file the Dockerfile copies is one this app carries (build_image writes them).
|
// Every file the Dockerfile copies is one this app carries (build_image writes them).
|
||||||
let carried = ["start.sh", "fluxbox-init", "overlay", "Xresources", "menu", "a11y", "browser", "screen"];
|
let carried = ["start.sh", "fluxbox-init", "overlay", "Xresources", "menu", "a11y", "browser", "screen"];
|
||||||
for l in DOCKERFILE.lines().filter_map(|l| l.trim().strip_prefix("COPY ")) {
|
for l in DOCKERFILE.lines().filter_map(|l| l.trim().strip_prefix("COPY ")) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue