@@ -26,7 +26,6 @@ limitations under the License.
26
26
*/
27
27
28
28
import { MatrixGlob } from "matrix-bot-sdk" ;
29
- import { setToArray } from "../utils" ;
30
29
31
30
export interface ServerAclContent {
32
31
allow : string [ ] ;
@@ -93,15 +92,15 @@ export class ServerAcl {
93
92
94
93
public literalAclContent ( ) : ServerAclContent {
95
94
return {
96
- allow : setToArray ( this . allowedServers ) ,
97
- deny : setToArray ( this . deniedServers ) ,
95
+ allow : [ ... this . allowedServers ] ,
96
+ deny : [ ... this . deniedServers ] ,
98
97
allow_ip_literals : this . allowIps ,
99
98
} ;
100
99
}
101
100
102
101
public safeAclContent ( ) : ServerAclContent {
103
- const allowed = setToArray ( this . allowedServers ) ;
104
- if ( ! allowed || allowed . length === 0 ) {
102
+ const allowed = [ ... this . allowedServers ] ;
103
+ if ( allowed . length === 0 ) {
105
104
allowed . push ( "*" ) ; // allow everything
106
105
}
107
106
if ( ! allowed . some ( server => new MatrixGlob ( server ) . test ( this . homeserver ) ) ) {
@@ -125,7 +124,7 @@ export class ServerAcl {
125
124
let denyMatches = true ; // until proven false
126
125
let ipsMatch = ips === this . allowIps ;
127
126
128
- const currentAllowed = setToArray ( this . allowedServers ) ;
127
+ const currentAllowed = [ ... this . allowedServers ] ;
129
128
if ( allow . length === currentAllowed . length ) {
130
129
for ( const s of allow ) {
131
130
if ( ! currentAllowed . includes ( s ) ) {
@@ -135,7 +134,7 @@ export class ServerAcl {
135
134
}
136
135
} else allowMatches = false ;
137
136
138
- const currentDenied = setToArray ( this . deniedServers ) ;
137
+ const currentDenied = [ ... this . deniedServers ] ;
139
138
if ( deny . length === currentDenied . length ) {
140
139
for ( const s of deny ) {
141
140
if ( ! currentDenied . includes ( s ) ) {
0 commit comments