MCPcopy Create free account
hub / github.com/DialmasterOrg/Youtarr / getServerIdentityWithParams

Method getServerIdentityWithParams

server/modules/plexModule.js:165–187  ·  view source on GitHub ↗
(plexIP, plexApiKey, plexPort, plexViaHttps)

Source from the content-addressed store, hash-verified

163 // "unclaimed server" playlist scope for playlists to be visible in Plex Web.
164 // claimed is null when the server is unreachable or the response is unexpected.
165 async getServerIdentityWithParams(plexIP, plexApiKey, plexPort, plexViaHttps) {
166 try {
167 const config = configModule.getConfig();
168 const baseUrl = this.getBaseUrl(plexIP, config, plexPort, plexViaHttps);
169 if (!baseUrl) {
170 logger.warn('Missing Plex server URL for identity check');
171 return { claimed: null, machineIdentifier: null };
172 }
173
174 const params = plexApiKey ? { 'X-Plex-Token': plexApiKey } : {};
175 const response = await axios.get(`${baseUrl}/identity`, {
176 params,
177 timeout: PLEX_REQUEST_TIMEOUT_MS,
178 });
179
180 const container = response.data?.MediaContainer || {};
181 const claimed = typeof container.claimed === 'boolean' ? container.claimed : null;
182 return { claimed, machineIdentifier: container.machineIdentifier || null };
183 } catch (error) {
184 logger.warn({ err: error }, 'Failed to read Plex server identity');
185 return { claimed: null, machineIdentifier: null };
186 }
187 }
188
189 async getAuthUrl() {
190 try {

Callers 2

plexModule.test.jsFile · 0.80
plex.jsFile · 0.80

Calls 2

getBaseUrlMethod · 0.95
getConfigMethod · 0.80

Tested by

no test coverage detected