File tree 1 file changed +11
-2
lines changed
1 file changed +11
-2
lines changed Original file line number Diff line number Diff line change @@ -111,6 +111,15 @@ class SpotifyInstance extends InstanceBase<DeviceConfig> implements SpotifyInsta
111
111
this . initActions ( )
112
112
}
113
113
114
+ override updateStatus ( status : InstanceStatus , message ?: string | null ) : void {
115
+ // Override the implementation so that when the auth checks say 'ok' we can hijack it and report a status based on the selected device
116
+ if ( status === InstanceStatus . Ok && ! this . config . deviceId ) {
117
+ super . updateStatus ( InstanceStatus . BadConfig , 'No playout device selected' )
118
+ } else {
119
+ super . updateStatus ( status , message )
120
+ }
121
+ }
122
+
114
123
private setupOrRefreshAuthentication ( clearToken = false ) {
115
124
if ( clearToken ) {
116
125
// Clear the access token each time to ensure it is correct
@@ -129,7 +138,7 @@ class SpotifyInstance extends InstanceBase<DeviceConfig> implements SpotifyInsta
129
138
this . updateStatus ( InstanceStatus . Connecting )
130
139
131
140
// Fetch then clear the code
132
- const code = this . config . code
141
+ const code = this . config . code . trim ( )
133
142
delete this . config . code
134
143
this . saveConfig ( this . config )
135
144
@@ -152,7 +161,7 @@ class SpotifyInstance extends InstanceBase<DeviceConfig> implements SpotifyInsta
152
161
} )
153
162
. catch ( ( err ) => {
154
163
console . log ( err )
155
- this . log ( 'debug' , `Failed to get access token: ${ err ?. message ?? err . toString ( ) } ` )
164
+ this . log ( 'debug' , `Failed to get access token: ${ err ?. message ?? err ? .toString ( ) ?? err } ` )
156
165
} )
157
166
} else if ( this . config . refreshToken ) {
158
167
this . updateStatus ( InstanceStatus . Connecting )
You can’t perform that action at this time.
0 commit comments