What is this#
This is a cloud attendance sheet hosted on Cloudflare Workers, which is very useful for certain positions. The attendance sheet displays the current time, and clicking on a name will strike it out and move it to the bottom, while also providing options to select all, deselect all, and toggle the theme.
Login page:
Attendance sheet page:
Why do this strange project?#
Because the author found that most TODO software on the market cannot achieve the effect of an attendance 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 based on it but is usable; 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 name 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)