Rust 语言编写的登录界面服务器。包含一个最小网页服务器和内置的登录页面

PJ568 1ca9923476 【修复】优化登录页面布局和代码结构 hace 1 año
.github 0179da2d0f 【文档】更新项目文档并添加适配指南 hace 1 año
doc 1ca9923476 【修复】优化登录页面布局和代码结构 hace 1 año
src 1ca9923476 【修复】优化登录页面布局和代码结构 hace 1 año
.gitignore 4459c92b9d 【文档】添加贡献指南并更新项目文档 hace 1 año
CONTRIBUTING.md ef46a3b664 【新增】重新设计登录页面并添加新功能 hace 1 año
Cargo.lock 1ca9923476 【修复】优化登录页面布局和代码结构 hace 1 año
Cargo.toml 1ca9923476 【修复】优化登录页面布局和代码结构 hace 1 año
LICENSE.md ba09d56f5a 【初始】初始化 pageos-greet 项目 hace 1 año
README.en.md ef4c0aa7ed 【文档】更新文档 hace 1 año
README.md ef4c0aa7ed 【文档】更新文档 hace 1 año

README.en.md

pageos-greet

简体中文 | English

A login interface server written in Rust. Includes a minimal web server and built-in login page.

This project is a subproject of pageos.

Core principles:

  • Minimal implementation by leveraging existing software as much as possible.

Usage

This project depends on greetd, and may require additional components like a desktop environment (e.g. cage) and browser (e.g. Firefox) depending on your needs.

Available command line arguments (excluding help):

  • --port: Listening port, defaults to 12801
  • --page: Path to custom login HTML file (recommended to store in /usr/local/lib/pageos-greet/). If not specified, uses the built-in HTML from src/server.rs (HTML)
  • --launch-command: Command to run when starting pageos-greet, typically used to launch a kiosk browser to display the login page. This command will be terminated when pageos-greet exits.
  • --session-command: Command to execute after successful login, defaults to $SHELL or /usr/bin/bash

Example:

pageos-greet \
  --port 12801 \
  --page /path/to/login.html \
  --launch-command "cage -s -- firefox --kiosk --no-remote http://127.0.0.1:12801" \
  --session-command "pageos-core -p 12800 --command \"cage -s -- firefox --kiosk --no-remote http://127.0.0.1:12800\""

When configuring /etc/greetd/greetd.toml, add commands to set up a temporary Home directory to prevent Firefox startup issues:

[default_session]
command = "bash -c 'mkdir -p /tmp/pageos-greet; export HOME=/tmp/pageos-greet; pageos-greet --launch-command \"cage -s -- firefox --kiosk --no-remote http://127.0.0.1:12801\" --session-command \"pageos-core -p 12800 --command \\"cage -s -- firefox --kiosk --no-remote http://127.0.0.1:12800\\"\"'"

Contributing

See CONTRIBUTING.md for contribution guidelines.```markdown

Adaptation

Ey bro, how do I adapt my page or Scratch to use the pageos-greet login manager?

Yes! Bro! You just need to do these two things:

  1. Mode Detection: Determine whether currently in login state. Can use PageOS environment extension. Check the domain and port at the very beginning of page initialization. If matched, initialize and enter the login page. For example, if your OS specifies the login page at 127.0.0.1:12801, the condition would be:

    if (
     (window.location.hostname === "127.0.0.1" ||
       window.location.hostname === "localhost") &&
     window.location.port === "12801"
    ) {
     // Initialize login page
    }
    
  2. Interface Adaptation: Ensure your page/project contains all display (output) and input controls, and adapts to the login logic/message format. Reference:

Project Info