Introduction:#
I really can't understand why a roll call sheet needs to be password protected. Why not just let users input the list? I do not recommend reading this article; it's too dumbed down. See: This roll call sheet, based on HTML, can be installed as an APK
What is this#
This is a cloud-based roll call sheet hosted on Cloudflare Workers, which is very useful for certain positions. The roll call sheet displays the current time, and clicking on a name will strike it out and move it to the bottom. It also has select all, deselect all, and theme toggle options.
Login page:
Roll call sheet page:
Why create this strange project?#
Because the author found that most TODO software on the market cannot achieve the effect of a roll call sheet. In a fit of anger, I turned to AI for help and spent 20 days creating this piece of history (the code is indeed reliant, but it works; the future plan is to decouple it, such as storing HTML using KV variables).
Official Start#
-
Create Cloudflare Workers and paste the code. The GitHub repository is: https://github.com/afoim/name_cf_workers
-
Add environment variables
- NAMES is the list, one per line
- PASSWORD is the password you set
- TOTP_SECRET is the TOTP key you set, which can be generated using the following Python code
import pyotp
import qrcode
def generate_totp(secret, account_name, issuer_name):
# Generate a TOTP object
totp = pyotp.TOTP(secret)
# Print the current TOTP value
print(f"Current TOTP: {totp.now()}")
# Generate a URI suitable for QR code scanning (for Google Authenticator, etc.)
uri = totp.provisioning_uri(name=account_name, issuer_name=issuer_name)
print(f"TOTP URI: {uri}")
# Generate QR code
img = qrcode.make(uri)
img.show() # Display QR code
if __name__ == "__main__":
# Custom name, account, and key
account_name = input("Please enter account name: ")
issuer_name = input("Please enter application name: ")
# Generate a random key, or you can use your predefined key
secret = pyotp.random_base32()
print(f"Key: {secret}")
generate_totp(secret, account_name, issuer_name)