mirror of
https://github.com/omnivore-app/omnivore.git
synced 2026-03-11 08:54:26 +00:00
Merge pull request #4156 from omnivore-app/fix/android-client
Set Android client
This commit is contained in:
commit
f2fc0c49d0
3 changed files with 11 additions and 7 deletions
|
|
@ -17,5 +17,7 @@ class Networker @Inject constructor(
|
|||
private suspend fun authToken() = datastoreRepo.getString(omnivoreAuthToken) ?: ""
|
||||
|
||||
suspend fun authenticatedApolloClient() = ApolloClient.Builder().serverUrl(serverUrl())
|
||||
.addHttpHeader("Authorization", value = authToken()).build()
|
||||
.addHttpHeader("Authorization", value = authToken())
|
||||
.addHttpHeader("X-OmnivoreClient", value = "android")
|
||||
.build()
|
||||
}
|
||||
|
|
|
|||
|
|
@ -73,18 +73,19 @@ export const createApp = (): Express => {
|
|||
// set client info in the request context
|
||||
app.use(httpContext.middleware)
|
||||
app.use('/api/', (req, res, next) => {
|
||||
// get client info from header
|
||||
const client = req.header('X-OmnivoreClient')
|
||||
if (client) {
|
||||
httpContext.set('client', client)
|
||||
}
|
||||
|
||||
// get client info from user agent
|
||||
const userAgent = req.header('User-Agent')
|
||||
if (userAgent) {
|
||||
const client = getClientFromUserAgent(userAgent)
|
||||
httpContext.set('client', client)
|
||||
}
|
||||
|
||||
// get client info from header
|
||||
const client = req.header('X-OmnivoreClient')
|
||||
if (client) {
|
||||
httpContext.set('client', client)
|
||||
}
|
||||
|
||||
next()
|
||||
})
|
||||
|
||||
|
|
|
|||
|
|
@ -491,6 +491,7 @@ describe('auth router', () => {
|
|||
return request
|
||||
.post(`${route}/create-account`)
|
||||
.set('X-OmnivoreClient', client)
|
||||
.set('User-Agent', 'chrome')
|
||||
.set('Cookie', [`pendingUserAuth=${pendingUserAuth}`])
|
||||
.send({
|
||||
name,
|
||||
|
|
|
|||
Loading…
Reference in a new issue