mirror of
https://github.com/ergochat/ergo.git
synced 2024-12-23 03:02:48 +01:00
commit
3fe27ae0b5
@ -24,7 +24,7 @@ const (
|
|||||||
// 'version' of the database schema
|
// 'version' of the database schema
|
||||||
keySchemaVersion = "db.version"
|
keySchemaVersion = "db.version"
|
||||||
// latest schema of the db
|
// latest schema of the db
|
||||||
latestDbSchema = "14"
|
latestDbSchema = "15"
|
||||||
|
|
||||||
keyCloakSecret = "crypto.cloak_secret"
|
keyCloakSecret = "crypto.cloak_secret"
|
||||||
)
|
)
|
||||||
@ -792,6 +792,26 @@ func schemaChangeV13ToV14(config *Config, tx *buntdb.Tx) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// #1327: delete any invalid klines
|
||||||
|
func schemaChangeV14ToV15(config *Config, tx *buntdb.Tx) error {
|
||||||
|
prefix := "bans.klinev2 "
|
||||||
|
var keys []string
|
||||||
|
tx.AscendGreaterOrEqual("", prefix, func(key, value string) bool {
|
||||||
|
if !strings.HasPrefix(key, prefix) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
if key != strings.TrimSpace(key) {
|
||||||
|
keys = append(keys, key)
|
||||||
|
}
|
||||||
|
return true
|
||||||
|
})
|
||||||
|
// don't bother trying to fix these up
|
||||||
|
for _, key := range keys {
|
||||||
|
tx.Delete(key)
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
allChanges := []SchemaChange{
|
allChanges := []SchemaChange{
|
||||||
{
|
{
|
||||||
@ -859,6 +879,11 @@ func init() {
|
|||||||
TargetVersion: "14",
|
TargetVersion: "14",
|
||||||
Changer: schemaChangeV13ToV14,
|
Changer: schemaChangeV13ToV14,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
InitialVersion: "14",
|
||||||
|
TargetVersion: "15",
|
||||||
|
Changer: schemaChangeV14ToV15,
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
// build the index
|
// build the index
|
||||||
|
@ -222,6 +222,7 @@ func realSkeleton(name string) (string, error) {
|
|||||||
// Shivaram@good-fortune -> *!shivaram@good-fortune
|
// Shivaram@good-fortune -> *!shivaram@good-fortune
|
||||||
// EDMUND -> edmund!*@*
|
// EDMUND -> edmund!*@*
|
||||||
func CanonicalizeMaskWildcard(userhost string) (expanded string, err error) {
|
func CanonicalizeMaskWildcard(userhost string) (expanded string, err error) {
|
||||||
|
userhost = strings.TrimSpace(userhost)
|
||||||
var nick, user, host string
|
var nick, user, host string
|
||||||
bangIndex := strings.IndexByte(userhost, '!')
|
bangIndex := strings.IndexByte(userhost, '!')
|
||||||
strudelIndex := strings.IndexByte(userhost, '@')
|
strudelIndex := strings.IndexByte(userhost, '@')
|
||||||
|
@ -215,6 +215,7 @@ func TestCanonicalizeMaskWildcard(t *testing.T) {
|
|||||||
tester("shivaram*", "shivaram*!*@*", nil)
|
tester("shivaram*", "shivaram*!*@*", nil)
|
||||||
tester("Shivaram*", "shivaram*!*@*", nil)
|
tester("Shivaram*", "shivaram*!*@*", nil)
|
||||||
tester("*SHIVARAM*", "*shivaram*!*@*", nil)
|
tester("*SHIVARAM*", "*shivaram*!*@*", nil)
|
||||||
|
tester("*SHIVARAM* ", "*shivaram*!*@*", nil)
|
||||||
}
|
}
|
||||||
|
|
||||||
func validFoldTester(first, second string, equal bool, folder func(string) (string, error), t *testing.T) {
|
func validFoldTester(first, second string, equal bool, folder func(string) (string, error), t *testing.T) {
|
||||||
|
2
irctest
2
irctest
@ -1 +1 @@
|
|||||||
Subproject commit 513c74a52b7fb4121e95037d7230ad1119188e00
|
Subproject commit f0eb6e4e80669b7587ffd8802f20e0e5fef923b5
|
Loading…
Reference in New Issue
Block a user