老孙博客 https://www.imsun.org/ zh-CN 资深网民孙先生 Tue, 25 Mar 2025 17:23:00 +0800 Tue, 25 Mar 2025 17:23:00 +0800 QQ-weather-bot https://www.imsun.org/archives/1719.html https://www.imsun.org/archives/1719.html Tue, 25 Mar 2025 17:23:00 +0800 老孙 由于最近QQ风控似乎更加严格了,有两个QQ号码被封号,还有一个经常掉线.

为了检测QQ机器人是否在线 我就让 Claude 3.5 写了一个定时发送消息的 python 程序

单纯只发个消息未免 单调,于是 就调用高德地图 的 天气查询 APi 查询 指定地点的天气情况

于是 实现了 指定QQ机器人 给 指定 QQ用户 指定频率 发送 天气情况的功能

2025-03-25T09:21:37.png
2025-03-25T09:21:37.png

我真是太机智了,一下子就解决了 两个问题

Docker镜像 jkjoy/qq-weather-bot

]]>
4 https://www.imsun.org/archives/1719.html#comments https://www.imsun.org/feed/
最近一周 & 不吐不快 https://www.imsun.org/archives/1717.html https://www.imsun.org/archives/1717.html Tue, 25 Mar 2025 17:06:00 +0800 老孙 本来日子平平淡淡.没有波澜.
什么也不想写.


把主题更新了一下,把之前没有完善的功能完善一番,优化了部分功能的实现方式


重新移植了一个主题,就是因为上班摸鱼随便弄着玩.


前两天荆门市宣传部突然打电话找我,说我已备案的网站上出现了不合规定的内容责令我删除.

主要内容有两处:

  1. 含有vmess科学上网的内容
  2. 含有ChatGPT相关内容

翻墙我可以理解,但是chatgpt 为啥就不行呢
我好奇问了一句

给我回复是,chatgpt 国内能用不?是不是得翻墙?

此话一出我竟无言以对.

于是删除了相关页面.


本以为这事情就完事了

昨天,又打电话来询问.
问能不能提供文章删除的证明.
我说文章都已经删除了,还怎么需要我证明我已经删除了呢?
你访问不到不就证明我删除了么

]]>
8 https://www.imsun.org/archives/1717.html#comments https://www.imsun.org/feed/
Mango - 又一款Typecho Theme https://www.imsun.org/archives/1716.html https://www.imsun.org/archives/1716.html Thu, 20 Mar 2025 10:50:00 +0800 老孙 简介

这是一款从wordpress 移植的双栏主题

原作者是 绘主题

预览

https://www.imsun.org/?theme=Mango

使用

使用友情链接 必须使用插件Links

后台
后台

更新日志

1.0.1

  • 修复固定链接
  • 修复侧边缩略图
  • 增加评论等级

1.0.0

初始版本

下载

Mango

]]>
10 https://www.imsun.org/archives/1716.html#comments https://www.imsun.org/feed/
使用Docker快速部署邮件服务器 Mailserver https://www.imsun.org/archives/1713.html https://www.imsun.org/archives/1713.html Sat, 15 Mar 2025 15:20:00 +0800 老孙 起因

想部署一个简单的邮件服务器 抛弃各种免费的企业邮局

主要是因为有太多账号都已经忘记了,而找回账号又是一阵折腾.

部署

Docker Compose 方式部署

services:
    mailserver:
        image: ghcr.io/docker-mailserver/docker-mailserver
        container_name: mailserver
        #env_file: ./.env
        healthcheck:
            retries: 0
            test: ss --listening --tcp | grep -P 'LISTEN.+:smtp' || exit 1
            timeout: 3s
        hostname: mail.imsun.org
        ports:
            - 25:25
            - 143:143
            - 465:465
            - 587:587
            - 993:993
        restart: always
        stop_grace_period: 1m
        volumes:
            - ./data/dms/mail-data/:/var/mail/
            - ./data/dms/mail-state/:/var/mail-state/
            - ./data/dms/mail-logs/:/var/log/mail/
            - ./data/dms/config/:/tmp/docker-mailserver/
            - /etc/localtime:/etc/localtime:ro
  • 务必开放以上端口 25 143 465 587 993
  • 如服务器端口被封禁则可以映射到其他端口

关于一些环境变量

# -----------------------------------------------
# --- Mailserver Environment Variables ----------
# -----------------------------------------------

# DOCUMENTATION FOR THESE VARIABLES IS FOUND UNDER
# https://docker-mailserver.github.io/docker-mailserver/latest/config/environment/

# -----------------------------------------------
# --- General Section ---------------------------
# -----------------------------------------------

# empty => uses the `hostname` command to get the mail server's canonical hostname
# => Specify a fully-qualified domainname to serve mail for.  This is used for many of the config features so if you can't set your hostname (e.g. you're in a container platform that doesn't let you) specify it in this environment variable.
OVERRIDE_HOSTNAME=

# REMOVED in version v11.0.0! Use LOG_LEVEL instead.
DMS_DEBUG=0

# Set the log level for DMS.
# This is mostly relevant for container startup scripts and change detection event feedback.
#
# Valid values (in order of increasing verbosity) are: `error`, `warn`, `info`, `debug` and `trace`.
# The default log level is `info`.
LOG_LEVEL=info

# critical => Only show critical messages
# error => Only show erroneous output
# **warn** => Show warnings
# info => Normal informational output
# debug => Also show debug messages
SUPERVISOR_LOGLEVEL=

# 0 => mail state in default directories
# 1 => consolidate all states into a single directory (`/var/mail-state`) to allow persistence using docker volumes
ONE_DIR=1

# Support for deployment where these defaults are not compatible (eg: some NAS appliances):
# /var/mail vmail User ID (default: 5000)
DMS_VMAIL_UID=
# /var/mail vmail Group ID (default: 5000)
DMS_VMAIL_GID=

# **empty** => use FILE
# LDAP => use LDAP authentication
# OIDC => use OIDC authentication (not yet implemented)
# FILE => use local files (this is used as the default)
ACCOUNT_PROVISIONER=

# empty => postmaster@domain.com
# => Specify the postmaster address
POSTMASTER_ADDRESS=

# Check for updates on container start and then once a day
# If an update is available, a mail is sent to POSTMASTER_ADDRESS
# 0 => Update check disabled
# 1 => Update check enabled
ENABLE_UPDATE_CHECK=1

# Customize the update check interval.
# Number + Suffix. Suffix must be 's' for seconds, 'm' for minutes, 'h' for hours or 'd' for days.
UPDATE_CHECK_INTERVAL=1d

# Set different options for mynetworks option (can be overwrite in postfix-main.cf)
# **WARNING**: Adding the docker network's gateway to the list of trusted hosts, e.g. using the `network` or
# `connected-networks` option, can create an open relay
# https://github.com/docker-mailserver/docker-mailserver/issues/1405#issuecomment-590106498
# The same can happen for rootless podman. To prevent this, set the value to "none" or configure slirp4netns
# https://github.com/docker-mailserver/docker-mailserver/issues/2377
#
# none => Explicitly force authentication
# container => Container IP address only
# host => Add docker container network (ipv4 only)
# network => Add all docker container networks (ipv4 only)
# connected-networks => Add all connected docker networks (ipv4 only)
PERMIT_DOCKER=none

# Set the timezone. If this variable is unset, the container runtime will try to detect the time using
# `/etc/localtime`, which you can alternatively mount into the container. The value of this variable
# must follow the pattern `AREA/ZONE`, i.e. of you want to use Germany's time zone, use `Europe/Berlin`.
# You can lookup all available timezones here: https://en.wikipedia.org/wiki/List_of_tz_database_time_zones#List
TZ=

# In case you network interface differs from 'eth0', e.g. when you are using HostNetworking in Kubernetes,
# you can set NETWORK_INTERFACE to whatever interface you want. This interface will then be used.
#  - **empty** => eth0
NETWORK_INTERFACE=

# empty => modern
# modern => Enables TLSv1.2 and modern ciphers only. (default)
# intermediate => Enables TLSv1, TLSv1.1 and TLSv1.2 and broad compatibility ciphers.
TLS_LEVEL=

# Configures the handling of creating mails with forged sender addresses.
#
# **0** => (not recommended) Mail address spoofing allowed. Any logged in user may create email messages with a forged sender address (see also https://en.wikipedia.org/wiki/Email_spoofing).
# 1 => Mail spoofing denied. Each user may only send with his own or his alias addresses. Addresses with extension delimiters(http://www.postfix.org/postconf.5.html#recipient_delimiter) are not able to send messages.
SPOOF_PROTECTION=

# Enables the Sender Rewriting Scheme. SRS is needed if your mail server acts as forwarder. See [postsrsd](https://github.com/roehling/postsrsd/blob/master/README.md#sender-rewriting-scheme-crash-course) for further explanation.
#  - **0** => Disabled
#  - 1 => Enabled
ENABLE_SRS=0

# Enables the OpenDKIM service.
# **1** => Enabled
#   0   => Disabled
ENABLE_OPENDKIM=1

# Enables the OpenDMARC service.
# **1** => Enabled
#   0   => Disabled
ENABLE_OPENDMARC=1


# Enabled `policyd-spf` in Postfix's configuration. You will likely want to set this
# to `0` in case you're using Rspamd (`ENABLE_RSPAMD=1`).
#
# - 0     => Disabled
# - **1** => Enabled
ENABLE_POLICYD_SPF=1

# 1 => Enables POP3 service
# empty => disables POP3
ENABLE_POP3=

# Enables ClamAV, and anti-virus scanner.
#   1   => Enabled
# **0** => Disabled
ENABLE_CLAMAV=0

# Enables Rspamd
# **0** => Disabled
#   1   => Enabled
ENABLE_RSPAMD=0

# When `ENABLE_RSPAMD=1`, an internal Redis instance is enabled implicitly.
# This setting provides an opt-out to allow using an external instance instead.
# 0 => Disabled
# 1 => Enabled
ENABLE_RSPAMD_REDIS=

# When enabled,
#
# 1. the "[autolearning][rspamd-autolearn]" feature is turned on;
# 2. the Bayes classifier will be trained when moving mails from or to the Junk folder (with the help of Sieve scripts).
#
# **0** => disabled
# 1     => enabled
RSPAMD_LEARN=0

# This settings controls whether checks should be performed on emails coming
# from authenticated users (i.e. most likely outgoing emails). The default value
# is `0` in order to align better with SpamAssassin. We recommend reading
# through https://rspamd.com/doc/tutorials/scanning_outbound.html though to
# decide for yourself whether you need and want this feature.
RSPAMD_CHECK_AUTHENTICATED=0

# Controls whether the Rspamd Greylisting module is enabled.
# This module can further assist in avoiding spam emails by greylisting
# e-mails with a certain spam score.
#
# **0** => disabled
# 1     => enabled
RSPAMD_GREYLISTING=0

# Can be used to enable or disable the Hfilter group module.
#
# - 0     => Disabled
# - **1** => Enabled
RSPAMD_HFILTER=1

# Can be used to control the score when the HFILTER_HOSTNAME_UNKNOWN symbol applies. A higher score is more punishing. Setting it to 15 is equivalent to rejecting the email when the check fails.
#
# Default: 6
RSPAMD_HFILTER_HOSTNAME_UNKNOWN_SCORE=6

# Amavis content filter (used for ClamAV & SpamAssassin)
# 0 => Disabled
# 1 => Enabled
ENABLE_AMAVIS=1

# -1/-2/-3 => Only show errors
# **0**    => Show warnings
# 1/2      => Show default informational output
# 3/4/5    => log debug information (very verbose)
AMAVIS_LOGLEVEL=0

# This enables DNS block lists in Postscreen.
# Note: Emails will be rejected, if they don't pass the block list checks!
# **0** => DNS block lists are disabled
# 1     => DNS block lists are enabled
ENABLE_DNSBL=0

# If you enable Fail2Ban, don't forget to add the following lines to your `compose.yaml`:
#    cap_add:
#      - NET_ADMIN
# Otherwise, `nftables` won't be able to ban IPs.
ENABLE_FAIL2BAN=0

# Fail2Ban blocktype
# drop   => drop packet (send NO reply)
# reject => reject packet (send ICMP unreachable)
FAIL2BAN_BLOCKTYPE=drop

# 1 => Enables Managesieve on port 4190
# empty => disables Managesieve
ENABLE_MANAGESIEVE=

# **enforce** => Allow other tests to complete. Reject attempts to deliver mail with a 550 SMTP reply, and log the helo/sender/recipient information. Repeat this test the next time the client connects.
# drop => Drop the connection immediately with a 521 SMTP reply. Repeat this test the next time the client connects.
# ignore => Ignore the failure of this test. Allow other tests to complete. Repeat this test the next time the client connects. This option is useful for testing and collecting statistics without blocking mail.
POSTSCREEN_ACTION=enforce

# empty => all daemons start
# 1 => only launch postfix smtp
SMTP_ONLY=

# Please read [the SSL page in the documentation](https://docker-mailserver.github.io/docker-mailserver/latest/config/security/ssl) for more information.
#
# empty => SSL disabled
# letsencrypt => Enables Let's Encrypt certificates
# custom => Enables custom certificates
# manual => Let's you manually specify locations of your SSL certificates for non-standard cases
# self-signed => Enables self-signed certificates
SSL_TYPE=

# These are only supported with `SSL_TYPE=manual`.
# Provide the path to your cert and key files that you've mounted access to within the container.
SSL_CERT_PATH=
SSL_KEY_PATH=
# Optional: A 2nd certificate can be supported as fallback (dual cert support), eg ECDSA with an RSA fallback.
# Useful for additional compatibility with older MTA and MUA (eg pre-2015).
SSL_ALT_CERT_PATH=
SSL_ALT_KEY_PATH=

# Set how many days a virusmail will stay on the server before being deleted
# empty => 7 days
VIRUSMAILS_DELETE_DELAY=

# Configure Postfix `virtual_transport` to deliver mail to a different LMTP client (default is a dovecot socket).
# Provide any valid URI. Examples:
#
# empty => `lmtp:unix:/var/run/dovecot/lmtp` (default, configured in Postfix main.cf)
# `lmtp:unix:private/dovecot-lmtp` (use socket)
# `lmtps:inet:<host>:<port>` (secure lmtp with starttls)
# `lmtp:<kopano-host>:2003` (use kopano as mailstore)
POSTFIX_DAGENT=

# Set the mailbox size limit for all users. If set to zero, the size will be unlimited (default).
#
# empty => 0
POSTFIX_MAILBOX_SIZE_LIMIT=

# See https://docker-mailserver.github.io/docker-mailserver/edge/config/user-management/accounts/#notes
# 0 => Dovecot quota is disabled
# 1 => Dovecot quota is enabled
ENABLE_QUOTAS=1

# Set the message size limit for all users. If set to zero, the size will be unlimited (not recommended!)
#
# empty => 10240000 (~10 MB)
POSTFIX_MESSAGE_SIZE_LIMIT=

# Mails larger than this limit won't be scanned.
# ClamAV must be enabled (ENABLE_CLAMAV=1) for this.
#
# empty => 25M (25 MB)
CLAMAV_MESSAGE_SIZE_LIMIT=

# Enables regular pflogsumm mail reports.
# This is a new option. The old REPORT options are still supported for backwards compatibility. If this is not set and reports are enabled with the old options, logrotate will be used.
#
# not set => No report
# daily_cron => Daily report for the previous day
# logrotate => Full report based on the mail log when it is rotated
PFLOGSUMM_TRIGGER=

# Recipient address for pflogsumm reports.
#
# not set => Use REPORT_RECIPIENT or POSTMASTER_ADDRESS
# => Specify the recipient address(es)
PFLOGSUMM_RECIPIENT=

# Sender address (`FROM`) for pflogsumm reports if pflogsumm reports are enabled.
#
# not set => Use REPORT_SENDER
# => Specify the sender address
PFLOGSUMM_SENDER=

# Interval for logwatch report.
#
# none => No report is generated
# daily => Send a daily report
# weekly => Send a report every week
LOGWATCH_INTERVAL=

# Recipient address for logwatch reports if they are enabled.
#
# not set => Use REPORT_RECIPIENT or POSTMASTER_ADDRESS
# => Specify the recipient address(es)
LOGWATCH_RECIPIENT=

# Sender address (`FROM`) for logwatch reports if logwatch reports are enabled.
#
# not set => Use REPORT_SENDER
# => Specify the sender address
LOGWATCH_SENDER=

# Defines who receives reports if they are enabled.
# **empty** => ${POSTMASTER_ADDRESS}
# => Specify the recipient address
REPORT_RECIPIENT=

# Defines who sends reports if they are enabled.
# **empty** => mailserver-report@${DOMAINNAME}
# => Specify the sender address
REPORT_SENDER=

# Changes the interval in which log files are rotated
# **weekly** => Rotate log files weekly
# daily => Rotate log files daily
# monthly => Rotate log files monthly
#
# Note: This Variable actually controls logrotate inside the container
# and rotates the log files depending on this setting. The main log output is
# still available in its entirety via `docker logs mail` (Or your
# respective container name). If you want to control logrotation for
# the Docker-generated logfile see:
# https://docs.docker.com/config/containers/logging/configure/
#
# Note: This variable can also determine the interval for Postfix's log summary reports, see [`PFLOGSUMM_TRIGGER`](#pflogsumm_trigger).
LOGROTATE_INTERVAL=weekly


# If enabled, employs `reject_unknown_client_hostname` to sender restrictions in Postfix's configuration.
#
# - **0** => Disabled
# - 1 => Enabled
POSTFIX_REJECT_UNKNOWN_CLIENT_HOSTNAME=0

# Choose TCP/IP protocols for postfix to use
# **all** => All possible protocols.
# ipv4 => Use only IPv4 traffic. Most likely you want this behind Docker.
# ipv6 => Use only IPv6 traffic.
#
# Note: More details at http://www.postfix.org/postconf.5.html#inet_protocols
POSTFIX_INET_PROTOCOLS=all

# Choose TCP/IP protocols for dovecot to use
# **all** => Listen on all interfaces
# ipv4 => Listen only on IPv4 interfaces. Most likely you want this behind Docker.
# ipv6 => Listen only on IPv6 interfaces.
#
# Note: More information at https://dovecot.org/doc/dovecot-example.conf
DOVECOT_INET_PROTOCOLS=all

# -----------------------------------------------
# --- SpamAssassin Section ----------------------
# -----------------------------------------------

ENABLE_SPAMASSASSIN=0

# deliver spam messages in the inbox (eventually tagged using SA_SPAM_SUBJECT)
SPAMASSASSIN_SPAM_TO_INBOX=1

# KAM is a 3rd party SpamAssassin ruleset, provided by the McGrail Foundation.
# If SpamAssassin is enabled, KAM can be used in addition to the default ruleset.
# - **0** => KAM disabled
# - 1 => KAM enabled
#
# Note: only has an effect if `ENABLE_SPAMASSASSIN=1`
ENABLE_SPAMASSASSIN_KAM=0

# spam messages will be moved in the Junk folder (SPAMASSASSIN_SPAM_TO_INBOX=1 required)
MOVE_SPAM_TO_JUNK=1

# spam messages wil be marked as read
MARK_SPAM_AS_READ=0

# add spam info headers if at, or above that level:
SA_TAG=2.0

# add 'spam detected' headers at that level
SA_TAG2=6.31

# triggers spam evasive actions
SA_KILL=10.0

# add tag to subject if spam detected
SA_SPAM_SUBJECT=***SPAM*****

# -----------------------------------------------
# --- Fetchmail Section -------------------------
# -----------------------------------------------

ENABLE_FETCHMAIL=0

# The interval to fetch mail in seconds
FETCHMAIL_POLL=300

# Enable or disable `getmail`.
#
# - **0** => Disabled
# - 1 => Enabled
ENABLE_GETMAIL=0

# The number of minutes for the interval. Min: 1; Max: 30.
GETMAIL_POLL=5

# -----------------------------------------------
# --- LDAP Section ------------------------------
# -----------------------------------------------

# A second container for the ldap service is necessary (i.e. https://hub.docker.com/r/bitnami/openldap/)

# empty => no
# yes => LDAP over TLS enabled for Postfix
LDAP_START_TLS=

# empty => mail.example.com
# Specify the `<dns-name>` / `<ip-address>` where the LDAP server is reachable via a URI like: `ldaps://mail.example.com`.
# Note: You must include the desired URI scheme (`ldap://`, `ldaps://`, `ldapi://`).
LDAP_SERVER_HOST=

# empty => ou=people,dc=domain,dc=com
# => e.g. LDAP_SEARCH_BASE=dc=mydomain,dc=local
LDAP_SEARCH_BASE=

# empty => cn=admin,dc=domain,dc=com
# => take a look at examples of SASL_LDAP_BIND_DN
LDAP_BIND_DN=

# empty** => admin
# => Specify the password to bind against ldap
LDAP_BIND_PW=

# e.g. `"(&(mail=%s)(mailEnabled=TRUE))"`
# => Specify how ldap should be asked for users
LDAP_QUERY_FILTER_USER=

# e.g. `"(&(mailGroupMember=%s)(mailEnabled=TRUE))"`
# => Specify how ldap should be asked for groups
LDAP_QUERY_FILTER_GROUP=

# e.g. `"(&(mailAlias=%s)(mailEnabled=TRUE))"`
# => Specify how ldap should be asked for aliases
LDAP_QUERY_FILTER_ALIAS=

# e.g. `"(&(|(mail=*@%s)(mailalias=*@%s)(mailGroupMember=*@%s))(mailEnabled=TRUE))"`
# => Specify how ldap should be asked for domains
LDAP_QUERY_FILTER_DOMAIN=

# -----------------------------------------------
# --- Dovecot Section ---------------------------
# -----------------------------------------------

# empty => no
# yes => LDAP over TLS enabled for Dovecot
DOVECOT_TLS=

# e.g. `"(&(objectClass=PostfixBookMailAccount)(uniqueIdentifier=%n))"`
DOVECOT_USER_FILTER=

# e.g. `"(&(objectClass=PostfixBookMailAccount)(uniqueIdentifier=%n))"`
DOVECOT_PASS_FILTER=

# Define the mailbox format to be used
# default is maildir, supported values are: sdbox, mdbox, maildir
DOVECOT_MAILBOX_FORMAT=maildir

# empty => no
# yes => Allow bind authentication for LDAP
# https://wiki.dovecot.org/AuthDatabase/LDAP/AuthBinds
DOVECOT_AUTH_BIND=

# -----------------------------------------------
# --- Postgrey Section --------------------------
# -----------------------------------------------

ENABLE_POSTGREY=0
# greylist for N seconds
POSTGREY_DELAY=300
# delete entries older than N days since the last time that they have been seen
POSTGREY_MAX_AGE=35
# response when a mail is greylisted
POSTGREY_TEXT="Delayed by Postgrey"
# whitelist host after N successful deliveries (N=0 to disable whitelisting)
POSTGREY_AUTO_WHITELIST_CLIENTS=5

# -----------------------------------------------
# --- SASL Section ------------------------------
# -----------------------------------------------

ENABLE_SASLAUTHD=0

# empty => pam
# `ldap` => authenticate against ldap server
# `shadow` => authenticate against local user db
# `mysql` => authenticate against mysql db
# `rimap` => authenticate against imap server
# Note: can be a list of mechanisms like pam ldap shadow
SASLAUTHD_MECHANISMS=

# empty => None
# e.g. with SASLAUTHD_MECHANISMS rimap you need to specify the ip-address/servername of the imap server  ==> xxx.xxx.xxx.xxx
SASLAUTHD_MECH_OPTIONS=

# empty => Use value of LDAP_SERVER_HOST
# Note: You must include the desired URI scheme (`ldap://`, `ldaps://`, `ldapi://`).
SASLAUTHD_LDAP_SERVER=

# empty => Use value of LDAP_BIND_DN
# specify an object with privileges to search the directory tree
# e.g. active directory: SASLAUTHD_LDAP_BIND_DN=cn=Administrator,cn=Users,dc=mydomain,dc=net
# e.g. openldap: SASLAUTHD_LDAP_BIND_DN=cn=admin,dc=mydomain,dc=net
SASLAUTHD_LDAP_BIND_DN=

# empty => Use value of LDAP_BIND_PW
SASLAUTHD_LDAP_PASSWORD=

# empty => Use value of LDAP_SEARCH_BASE
# specify the search base
SASLAUTHD_LDAP_SEARCH_BASE=

# empty => default filter `(&(uniqueIdentifier=%u)(mailEnabled=TRUE))`
# e.g. for active directory: `(&(sAMAccountName=%U)(objectClass=person))`
# e.g. for openldap: `(&(uid=%U)(objectClass=person))`
SASLAUTHD_LDAP_FILTER=

# empty => no
# yes => LDAP over TLS enabled for SASL
# If set to yes, the protocol in SASLAUTHD_LDAP_SERVER must be ldap:// or missing.
SASLAUTHD_LDAP_START_TLS=

# empty => no
# yes => Require and verify server certificate
# If yes you must/could specify SASLAUTHD_LDAP_TLS_CACERT_FILE or SASLAUTHD_LDAP_TLS_CACERT_DIR.
SASLAUTHD_LDAP_TLS_CHECK_PEER=

# File containing CA (Certificate Authority) certificate(s).
# empty => Nothing is added to the configuration
# Any value => Fills the `ldap_tls_cacert_file` option
SASLAUTHD_LDAP_TLS_CACERT_FILE=

# Path to directory with CA (Certificate Authority) certificates.
# empty => Nothing is added to the configuration
# Any value => Fills the `ldap_tls_cacert_dir` option
SASLAUTHD_LDAP_TLS_CACERT_DIR=

# Specify what password attribute to use for password verification.
# empty => Nothing is added to the configuration but the documentation says it is `userPassword` by default.
# Any value => Fills the `ldap_password_attr` option
SASLAUTHD_LDAP_PASSWORD_ATTR=

# empty => `bind` will be used as a default value
# `fastbind` => The fastbind method is used
# `custom` => The custom method uses userPassword attribute to verify the password
SASLAUTHD_LDAP_AUTH_METHOD=

# Specify the authentication mechanism for SASL bind
# empty => Nothing is added to the configuration
# Any value => Fills the `ldap_mech` option
SASLAUTHD_LDAP_MECH=

# -----------------------------------------------
# --- SRS Section -------------------------------
# -----------------------------------------------

# envelope_sender => Rewrite only envelope sender address (default)
# header_sender => Rewrite only header sender (not recommended)
# envelope_sender,header_sender => Rewrite both senders
# An email has an "envelope" sender (indicating the sending server) and a
# "header" sender (indicating who sent it). More strict SPF policies may require
# you to replace both instead of just the envelope sender.
SRS_SENDER_CLASSES=envelope_sender

# empty => Envelope sender will be rewritten for all domains
# provide comma separated list of domains to exclude from rewriting
SRS_EXCLUDE_DOMAINS=

# empty => generated when the image is built
# provide a secret to use in base64
# you may specify multiple keys, comma separated. the first one is used for
# signing and the remaining will be used for verification. this is how you
# rotate and expire keys
SRS_SECRET=

# -----------------------------------------------
# --- Default Relay Host Section ----------------
# -----------------------------------------------

# Setup relaying all mail through a default relay host
#
# empty => don't configure default relay host
# default host and optional port to relay all mail through
DEFAULT_RELAY_HOST=

# -----------------------------------------------
# --- Multi-Domain Relay Section ----------------
# -----------------------------------------------

# Setup relaying for multiple domains based on the domain name of the sender
# optionally uses usernames and passwords in postfix-sasl-password.cf and relay host mappings in postfix-relaymap.cf
#
# empty => don't configure relay host
# default host to relay mail through
RELAY_HOST=

# empty => 25
# default port to relay mail
RELAY_PORT=25

# empty => no default
# default relay username (if no specific entry exists in postfix-sasl-password.cf)
RELAY_USER=

# empty => no default
# password for default relay user
RELAY_PASSWORD=

创建账户

启动容器之后

在容器中执行

setup email add admin@example.com

输入密码
重复确认密码
example.com域名为例

为域名添加DNS记录

A 记录 mail 指向 服务器IP
MX 记录 @ 指向 mail.example.com
PTR 记录 @ 指向 mail.example.com

如此便可以使用smtp发送邮件了

SMTP 地址 mail.example.com
账户 : admin@example.com
密码 :
端口 : 587

webmail 客户端 roundcube

当然可以使用webmail客户端 roundcube 来进行收发邮件

使用Docker compose来快速部署

services:
  roundcubemail:
    image: roundcube/roundcubemail:1.6.9-apache
    volumes:
      - ./www:/var/www/html
      - ./db/sqlite:/var/roundcube/db
    environment:
      - ROUNDCUBEMAIL_DB_TYPE=sqlite
      - ROUNDCUBEMAIL_SKIN=elastic
      - ROUNDCUBEMAIL_DEFAULT_HOST=tls://mail.example.com
      - ROUNDCUBEMAIL_SMTP_SERVER=tls://mail.example.com
    ports:
      - 8080:80
  • 可以把8080 端口反向代理到 mail.example.com 域名
  • mail.example.com配置好SSL证书

访问 mail.example.com ,输入 账号密码 登录即可进行收发邮件了.

]]>
17 https://www.imsun.org/archives/1713.html#comments https://www.imsun.org/feed/
APU 黑苹果支持列表 https://www.imsun.org/archives/1711.html https://www.imsun.org/archives/1711.html Wed, 05 Mar 2025 10:51:39 +0800 老孙 得益于“NootedRed”驱动,目前部分AMD核显,即APU,包括桌面和移动端的处理器,可以实现黑苹果系统的安装。
https://chefkissinc.github.io/applehax/nootedred/

根据NootedRed官网的描述如下:支持Ryzen 1xxx (Athlon Silver/Gold) 到 5xxx,另外还有7x30系列。

综上来讲,核显主要以下几种的,可以安装黑苹果:

Radeon Graphics
Vega 3
Vega 8
Vega 11
Radeon Graphics (Vega)
RX Vega 11
RX Vega 10
Vega 9
Vega 6
GCN 5th gen(iGPU)
Radeon RX Vega 11

]]>
5 https://www.imsun.org/archives/1711.html#comments https://www.imsun.org/feed/
Typecho博客同步插件FediverseSync https://www.imsun.org/archives/1698.html https://www.imsun.org/archives/1698.html Wed, 19 Feb 2025 12:08:00 +0800 老孙 介绍

这是一个在发布文章时自动同步到Fediverse(Mastodon/Gotosocial)的插件
在发布文章时触发

更新

后台增加同步管理的面板

已知问题

在使用Mastodon实例时,对嘟文的回复无法保存为评论.

功能

很简单的功能实现,使用AI编写

实现的功能

  • 使用gts作为博客的评论
  • 在发布文章时自动同步到Mastodon/Gotosocial的插件

使用

2025-03-03T11:56:46.png
2025-03-03T11:56:46.png

在后台设置填入实例的地址和token.
可选择摘要的字数.
默认禁用插件时不删除同步数据.
Token的获取可参照

下载地址

https://github.com/jkjoy/FediverseSyncForTypecho

]]>
0 https://www.imsun.org/archives/1698.html#comments https://www.imsun.org/feed/
Gotosocial 通过API获取用户Timeline https://www.imsun.org/archives/1695.html https://www.imsun.org/archives/1695.html Mon, 17 Feb 2025 10:14:00 +0800 老孙 在测试Gotosocial 时发现
通过链接${Host}/api/v1/accounts/${userId}/statuses?limit=${limit}&exclude_replies=true&only_public=true
访问不到数据,提示Unauthorized: token not supplied需要提供token.

mastodonpleroma 还是可以正常访问的.

为了更好的解决这个问题(其实之前通过cloudflare workers已经可以解决了)
参见 https://www.imsun.org/archives/1643.html#%E9%80%9A%E8%BF%87Cloudflare-Workers%E8%8E%B7%E5%8F%96json%E6%95%B0%E6%8D%AE

这次使用vercel拿到数据.

https://github.com/jkjoy/Gotosocial-API-Vercel

主要代码是python

直接部署在vercel

环境变量

HOST=Gotosocial实例地址
USER_ID=Gotosocial用户ID
TOKEN=access_token

演示 https://gts.ima.cm

]]>
0 https://www.imsun.org/archives/1695.html#comments https://www.imsun.org/feed/
Gotosocial 的分域部署 https://www.imsun.org/archives/1694.html https://www.imsun.org/archives/1694.html Sun, 16 Feb 2025 09:29:00 +0800 老孙 我因为使用mastodon比较多,最近在与新关注的好友交流时发现他使用的GTS实例账号是顶级域名,访问时的网页地址却是二级域名,通过他我才知道GTS更新了很多有意思的功能

在最新的0.18.0 版本中新增了可信代理 trusted-proxies

跟我当时使用的版本相比,已经增加了许多功能

譬如 开放了注册页面, 譬如 分域部署
需要注意的是 这种部署布局的配置必须在第一次启动 GoToSocial 前完成。

主要是通过重定向来实现.把原本请求到账户所属域名的流量转发到真实的实例地址上去.

server {
  server_name ima.cm;                                                      # account-domain

  location /.well-known/webfinger {
    rewrite ^.*$ https://social.ima.cm/.well-known/webfinger permanent;    # host
  }

  location /.well-known/host-meta {
    rewrite ^.*$ https://social.ima.cm/.well-known/host-meta permanent;  # host
  }

  location /.well-known/nodeinfo {
    rewrite ^.*$ https://social.ima.cm/.well-known/nodeinfo permanent;   # host
  }
}

如此就需要部署一个新的GTS实例
修改一下docker-compose.yaml中的配置

services:
  gotosocial:
    image: superseriousbusiness/gotosocial:latest
    container_name: gotosocial
    user: 1000:1000
    networks:
      - gotosocial
    pull_policy: always  
    environment:
      GTS_HOST: social.ima.cm #实例地址
      GTS_ACCOUNT_DOMAIN: ima.cm #用户账户所属的域名
      GTS_DB_TYPE: sqlite #使用sqlite数据库
      GTS_DB_ADDRESS: /gotosocial/storage/sqlite.db
      GTS_STORAGE_BACKEND: s3 # 使用S3存储 ,如果不需要可以删除包含STORAGE的环境变量
      GTS_STORAGE_S3_BUCKET: user #桶名
      GTS_STORAGE_S3_ENDPOINT: s3.bitiful.net  #S3端点
      GTS_STORAGE_S3_ACCESS_KEY: kmX5VsV8cB4ma8jeAg #
      GTS_STORAGE_S3_SECRET_KEY: DJ9qG7pNAZy9 #密钥
      GTS_STORAGE_S3_PROXY: true #代理S3,不会显示S3地址
      GTS_ACCOUNTS_ALLOW_CUSTOM_CSS: true #允许自定义CSS
      TZ: Asia/Chongqing #时区
      GTS_SMTP_HOST: mail.cock.li #smtp服务器
      GTS_SMTP_PORT: 587 #必须使用TLS
      GTS_SMTP_USERNAME: admin@cock.li #用户名
      GTS_SMTP_PASSWORD: ******  #密码
      GTS_SMTP_FROM: admin@cock.li #邮箱地址
      GTS_INSTANCE_LANGUAGES: zh #中文
      GTS_ACCOUNTS_REGISTRATION_OPEN: true #开放注册
      GTS_TRUSTED_PROXIES: 172.18.0.1/16 #可信代理
    ports:
      - "127.0.0.1:8080:8080"
    volumes:
      - ./data:/gotosocial/storage
    restart: "always"

networks:
  gotosocial:
    ipam:
      driver: default
      config:
        - subnet: "172.18.0.0/16"
          gateway: "172.18.0.1"

访问https://social.ima.cm/@m
显示的账户所属的域名是ima.cm
mastodon 可以通过 @m@ima.cm 来添加好友

]]>
4 https://www.imsun.org/archives/1694.html#comments https://www.imsun.org/feed/
使用Github Action自动生成静态相册 https://www.imsun.org/archives/1684.html https://www.imsun.org/archives/1684.html Sat, 28 Dec 2024 09:48:00 +0800 老孙 前言

使用memos调用的相册虽然方便,但是也有一些痛点无法解决

  1. 在CDN被刷流量之后,我已经几乎关闭所有的国内CDN服务,小水管服务器也无法满足大量图片同时加载,那龟速谁用谁知道.
  2. S3存储太贵,在COS被刷了流量之后(没错,我就是这么倒霉),我决定多地备份,主要上传在github,利用Cloudflare+ vercel+github pages+ 其他SaaS. 这些服务的优点就是免费.
  3. 模板来源于网络

Deepseek

主要使用AI来解决主要功能代码,主打一个能用就行.至于有什么bug,一个简单的网页生成 能有什么逆天bug也没关系的....吧
主要代码是 Python

功能

  • 我想要的功能
  1. 上传图片到Github 仓库,触发 Actions 自动生成Html页面
  2. 相册的缩略图需要压缩,点击显示原图,缓解小水管压力(没错,我会定时使用git拉取到国内服务器,主打一个多地都能访问)
  3. 根据图片名称自动生成标题
  • 更新
    2024.12.29
    又找了一个模板,自己觉得还可以
    加了进去
    在workflow里设置需要执行的脚本
    两个脚本 分别为 times.pylens.py 对应着两个模板

演示地址

lens模板 https://photo.asbid.cn
times模板 https://photo.sgcd.net

部署在Github Pages

使用

项目模板

https://github.com/jkjoy/generate-albums

设置

在自己仓库的Settings中找到

指示
指示

TOKEN为你的 Github token

REPO为你想要生成相册的仓库名称 如username/repo

设置
设置

上传规则

相册内容上传到 photos 这个目录下

photos 根目录下的照片默认标题为分享生活

新建文件夹, 该文件夹名称为此目录下所有图片的标题

  • 照片同名txt中的文本为描述说明 最高优先级
    1.jpg 1.txt 则使用1.txt中的文本为描述说明
  • 目录下描述.txt为此目录下所有图片的描述说明 第二优先级
  • 如果两者都没有则使用照片文件名为描述说明

其他部分

可以根据需求修改 template目录下对应模板的index.html文件 中的布局和内容.

每次修改仓库会自动触发Action 生成HTML到目标仓库,目标仓库可以使用Github Pages,也可以部署在Vercel,这里就不多做说明

演示

https://photos-jkjkjoy.vercel.app/

总结

AI真好用!!
https://movie.douban.com/subject/2136204/

]]>
14 https://www.imsun.org/archives/1684.html#comments https://www.imsun.org/feed/
Tianji - 一个集成 网站分析 + 上线监控 + 服务器状态 的应用 https://www.imsun.org/archives/1690.html https://www.imsun.org/archives/1690.html Fri, 27 Dec 2024 18:48:00 +0800 老孙 简介

一个All-in-one的项目,集成了uptime-kuma+ nezha + umami 的功能的超强应用.

项目地址

https://github.com/msgbyte/tianji

预览

2025-03-16T08:08:01.png
2025-03-16T08:08:01.png

部署

使用 docker compose 的方式来部署

mkdir /home/tianji
cd /home/tianji
vi docker-compose.yaml

docker-compose.yaml的内容如下

services:
  tianji:
    image: moonrailgun/tianji
    ports:
      - "12345:12345"
    environment:
      DATABASE_URL: postgresql://tianji:tianji@postgres:5432/tianji
      JWT_SECRET: replace-me-with-a-random-string
      ALLOW_REGISTER: "false"
      ALLOW_OPENAPI: "true"
    depends_on:
      - postgres
    restart: always
  postgres:
    image: postgres:15.4-alpine
    environment:
      POSTGRES_DB: tianji
      POSTGRES_USER: tianji
      POSTGRES_PASSWORD: tianji
    volumes:
      - ./tianji-db-data:/var/lib/postgresql/data
    restart: always
    healthcheck:
      test: ["CMD-SHELL", "pg_isready -U $${POSTGRES_USER} -d $${POSTGRES_DB}"]
      interval: 5s
      timeout: 5s
      retries: 5

运行容器

docker compose up -d

默认密码

Url: http://<your-ip>:12345
Default username: admin
Default password: admin

监控

https://0tz.top/status/imsun
可以使用一个小徽章显示状态

遥测

在页面插入一张图片就可以侦测到访问量,但是只能显示 pv 浏览量

多用户

没错,Tianji是支持多用户使用的,若是有想体验的朋友可以留言,我可以发送邀请.

通知

可以支持多种通知方式

访客统计

从木木老师那里得到灵感,使用API获取网站的统计数据并使用js 调用,替代Umami.

在后台获取token websiteID workspaceID

然后使用Cloudflare Workers来保护token.
新建一个workers,填入以下代码(需要修改的部分已经标注出来)

addEventListener('fetch', event => {
  event.respondWith(handleRequest(event.request))
})

const tianji = 'https://tianji.top'; #自行修改
const token = 'sk_cf38cfb0bcb22d****'; #自行修改
const workspaceID = 'clnzoxcy10001vy2ohi4obbi0'; #自行修改
const websiteID = 'cm3sj40cs00018n2ezrgbdl5w'; #自行修改

async function handleRequest(request) {
  const url = `${tianji}/open/workspace/${workspaceID}/website/${websiteID}/stats`;

  // 获取当前时间的 Unix 时间戳(以毫秒为单位)
  const now = Date.now();

  // 设置查询参数
  const params = new URLSearchParams({
    startAt: '1704067200000', // 2024年1月1日的 Unix 时间戳(毫秒)
    endAt: now.toString()  
  });

  const fullUrl = `${url}?${params.toString()}`;

  const headers = new Headers({
    'Authorization': `Bearer ${token}`,
    'Content-Type': 'application/json'
  });

  const response = await fetch(fullUrl, {
    method: 'GET',
    headers: headers
  });

  const corsHeaders = {
    'Access-Control-Allow-Origin': '*',
    'Access-Control-Allow-Methods': 'GET, OPTIONS',
    'Access-Control-Allow-Headers': 'Content-Type, Authorization'
  };

  if (request.method === 'OPTIONS') {
    return new Response(null, {
      headers: corsHeaders
    });
  }

  if (response.ok) {
    const data = await response.json();
    return new Response(JSON.stringify(data), {
      headers: {
        'Content-Type': 'application/json',
        ...corsHeaders
      }
    });
  } else {
    return new Response(`Failed to fetch data: ${response.status} ${response.statusText}`, {
      status: response.status,
      headers: corsHeaders
    });
  }
}

startAt 的值 是某时间的unix时间戳 可以自行设置查询范围

调用

使用html+js调用

👣<p>本站到访<span id="uniques">0</span>位朋友.</p><p>共浏览页面<span id="pageviews">0</span>次</p>
<script>
// 定义 API URL
const apiUrl = 'https://tj.imsun.org';

fetch(apiUrl)
    .then(response => {
        if (!response.ok) {
            throw new Error('error');
        }
        return response.json();
    })
    .then(data => {
        const pageviewsElement = document.getElementById('pageviews');
        const uniquesElement = document.getElementById('uniques');
        pageviewsElement.textContent = data.pageviews.value;
        uniquesElement.textContent = data.uniques.value;
    })
    .catch(error => {
        console.error('获取数据时出现问题:', error);
    });
</script>

其他

还有其他很多功能,等待摸索

]]>
8 https://www.imsun.org/archives/1690.html#comments https://www.imsun.org/feed/