- Fix SQLite connection string (drop query param, use explicit PRAGMA) - Register sqlite3-fk-wal driver for mautrix cryptohelper (pure Go, no CGO) - Fetch DeviceID via /whoami when using bare access token - Log cross-signing results at Warn/Info instead of Debug - Post deals into Matrix threads: Game Deals, DLC Deals, Epic Free Games - Add numbered watchlist; !extend and !unwatch accept list numbers - URL-encode search queries for multi-word !search commands - Add GetConfig/SetConfig helpers for persistent thread event IDs Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
37 lines
683 B
Go
37 lines
683 B
Go
package matrix
|
|
|
|
import (
|
|
"database/sql"
|
|
"database/sql/driver"
|
|
|
|
sqlite "modernc.org/sqlite"
|
|
)
|
|
|
|
type fkWALDriver struct {
|
|
inner *sqlite.Driver
|
|
}
|
|
|
|
func (d *fkWALDriver) Open(name string) (driver.Conn, error) {
|
|
conn, err := d.inner.Open(name)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
execer := conn.(driver.Execer)
|
|
for _, pragma := range []string{
|
|
"PRAGMA foreign_keys = ON",
|
|
"PRAGMA journal_mode = WAL",
|
|
"PRAGMA synchronous = NORMAL",
|
|
"PRAGMA busy_timeout = 5000",
|
|
} {
|
|
if _, err := execer.Exec(pragma, nil); err != nil {
|
|
conn.Close()
|
|
return nil, err
|
|
}
|
|
}
|
|
return conn, nil
|
|
}
|
|
|
|
func init() {
|
|
sql.Register("sqlite3-fk-wal", &fkWALDriver{inner: &sqlite.Driver{}})
|
|
}
|