8000 Log device info on api Start by PP-Contrib · Pull Request #52 · clairton/unoapi-cloud · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Log device info on api Start #52

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/defaults.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,8 @@ export const IGNORED_CONNECTIONS_NUMBERS = JSON.parse(process.env.IGNORED_CONNEC
export const CLEAN_CONFIG_ON_DISCONNECT =
process.env.CLEAN_CONFIG_ON_DISCONNECT === _undefined ? false : process.env.CLEAN_CONFIG_ON_DISCONNECT == 'true'
export const VALIDATE_ROUTING_KEY = process.env.VALIDATE_ROUTING_KEY === _undefined ? false : process.env.VALIDATE_ROUTING_KEY == 'true'
export const CONFIG_SESSION_PHONE_CLIENT = process.env.CONFIG_SESSION_PHONE_CLIENT || 'Unoapi'
export const CONFIG_SESSION_PHONE_NAME = process.env.CONFIG_SESSION_PHONE_NAME || 'Chrome'

// eslint-disable-next-line @typescript-eslint/no-explicit-any
export const STORAGE_OPTIONS = (storage: any) => {
Expand Down
5 changes: 3 additions & 2 deletions src/services/socket.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import logger from './logger'
import { Level } from 'pino'
import { SocksProxyAgent } from 'socks-proxy-agent'
import { isSessionStatusConnecting, isSessionStatusOnline, setSessionStatus, isSessionStatusOffline, isSessionStatusIsDisconnect } from './session_store'
import { CONFIG_SESSION_PHONE_CLIENT, CONFIG_SESSION_PHONE_NAME, LOG_LEVEL } from '../defaults'

export type string, time: number, limit: number) => Promise<void>
export type string, important: boolean) => Promise<void>
Expand Down Expand Up @@ -334,12 +335,12 @@ export const connect = async ({
logger.debug('Connecting %s', phone)

const browser: WABrowserDescription = config.ignoreHistoryMessages
? [process.env.CONFIG_SESSION_PHONE_CLIENT || 'Unoapi', process.env.CONFIG_SESSION_PHONE_NAME || 'Chrome', release()]
? [CONFIG_SESSION_PHONE_CLIENT || 'Unoapi', CONFIG_SESSION_PHONE_NAME || 'Chrome', release()]
: Browsers.windows('Desktop')

const loggerBaileys = MAIN_LOGGER.child({})
// logger.level = config.logLevel as Level
loggerBaileys.level = (process.env.LOG_LEVEL || (process.env.NODE_ENV == 'development' ? 'debug' : 'error')) as Level
loggerBaileys.level = (LOG_LEVEL) as Level

let agent
if (config.proxyUrl) {
Expand Down
12 changes: 10 additions & 2 deletions src/web.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,15 @@ import { Outgoing } from './services/outgoing'
import { OutgoingAmqp } from './services/outgoing_amqp'
import { SessionStore } from './services/session_store'
import { SessionStoreRedis } from './services/session_store_redis'
import { BASE_URL, PORT, AMQP_URL, UNOAPI_JOB_INCOMING, UNOAPI_MESSAGE_RETRY_DELAY } from './defaults'
import {
BASE_URL,
PORT,
AMQP_URL,
UNOAPI_JOB_INCOMING,
UNOAPI_MESSAGE_RETRY_DELAY,
CONFIG_SESSION_PHONE_CLIENT,
CONFIG_SESSION_PHONE_NAME
} from './defaults'
import { getConfigRedis } from './services/config_redis'
import security from './services/security'
import { amqpGetChannel } from './amqp'
Expand All @@ -25,5 +33,5 @@ const app: App = new App(incoming, outgoing, BASE_URL, getConfigRedis, sessionSt

app.server.listen(PORT, '0.0.0.0', async () => {
await amqpGetChannel(UNOAPI_JOB_INCOMING, '', AMQP_URL, { delay: UNOAPI_MESSAGE_RETRY_DELAY, priority: 5 }) // create a channel with priority
logger.info('Unoapi Cloud version: %s, listening on port: %s', version, PORT)
logger.info('Unoapi Cloud version: %s, listening on port: %s | Linked Device: %s(%s)', version, PORT, CONFIG_SESSION_PHONE_CLIENT, CONFIG_SESSION_PHONE_NAME)
})
Loading
0