add some logs when fetching a new token opengroupv2

pull/1675/head
Audric Ackermann 4 years ago
parent 0aefd1b2bf
commit 9a9fb7271e
No known key found for this signature in database
GPG Key ID: 999F434D76324AD4

@ -1,51 +0,0 @@
A TESTER
move mentions user to redux for opengroups
* MENTIONS opengroupv2
lokiPublicChatAPI
DELETED
LokiPushNotificationServerApi
channelAPI.sendMessage
dot_net_api
loki_public_chat_api
tokenlessFileServerAdnAPI
channelId
publicChat with only a cahnnel of 1
loki_file_server_api
LokiAppDotNetApi
LokiPublicChatFactoryAPI
lastPublicMessage
getLastRetrievedMessage
setLastRetrievedMessage
attemptConnection
attemptConnectionOneAtATime
getPublicSendData
setPublicSource
getPublicSource
findOrCreateServer
initAPIs
OpenGroup.
findOrCreateChannel
initSpecialConversations
updateOpenGroupV1
partChannel
acceptOpenGroupInvitationV1
pollForChannelOnce
publicConversatio
handleOpenGroupJoinV1
setChannelName
setChannelAvatar
isOpenGroupV1
toOpenGroupV1
setListOfMembers
lokiFileServerAPI
lokiFileServerAPIFactory

@ -45,27 +45,34 @@ export async function getAuthToken({
return roomDetails.token;
}
await allowOnlyOneAtATime(`getAuthTokenV2${serverUrl}:${roomId}`, async () => {
await allowOnlyOneAtATime(`getAuthToken${serverUrl}:${roomId}`, async () => {
try {
window?.log?.info('TRIGGERING NEW AUTH TOKEN WITH', { serverUrl, roomId });
window?.log?.info(
`Triggering getAuthToken with serverUrl:'${serverUrl}'; roomId:'${roomId}'`
);
const token = await requestNewAuthToken({ serverUrl, roomId });
if (!token) {
window?.log?.warn('invalid new auth token', token);
return;
}
window?.log?.info(`Got AuthToken for serverUrl:'${serverUrl}'; roomId:'${roomId}'`);
const claimedToken = await claimAuthToken(token, serverUrl, roomId);
if (!claimedToken) {
window?.log?.warn('invalid claimed token', claimedToken);
window?.log?.warn('Failed to claim token', claimedToken);
} else {
window?.log?.info(`Claimed AuthToken for serverUrl:'${serverUrl}'; roomId:'${roomId}'`);
}
// still save it to the db. just to mark it as to be refreshed later
roomDetails.token = claimedToken || '';
await saveV2OpenGroupRoom(roomDetails);
window?.log?.info(`AuthToken saved to DB for serverUrl:'${serverUrl}'; roomId:'${roomId}'`);
} catch (e) {
window?.log?.error('Failed to getAuthToken', e);
throw e;
}
});
// fetch the data from the db again, which should have been written in the saveV2OpenGroupRoom() call above
const refreshedRoomDetails = await getV2OpenGroupRoomByRoomId({
serverUrl,
roomId,

Loading…
Cancel
Save