Skip to content
This repository has been archived by the owner on Sep 29, 2023. It is now read-only.

User-agent generated with extra spaces #1357

Closed
amaramrahul opened this issue Feb 13, 2022 · 2 comments · Fixed by #1367
Closed

User-agent generated with extra spaces #1357

amaramrahul opened this issue Feb 13, 2022 · 2 comments · Fixed by #1367
Labels

Comments

@amaramrahul
Copy link

amaramrahul commented Feb 13, 2022

Homework

Bug description

Auto-generated user agent contains additional spaces. I retrieved the user agent by looking at the requests in Network tab of Developer Tools.
Because of this, WhatsApp is giving me the same issue as mentioned in #1112.
Removing the extra space and setting the user-agent explicitly while building the WhatsApp app no longer causes the issue.

Steps to reproduce

Give your full nativefier command and its logs, with the --verbose flag, on a public site:

$ docker run --rm -v ~/Downloads/nativefier-apps:/target/ nativefier/nativefier https://web.whatsapp.com/ /target/ --name WhatsApp --single-instance --verbose
Running in verbose mode! This will produce a mountain of logs and is recommended only for troubleshooting or if you like Shakespeare.


    Hi! Nativefier is minimally maintained these days, and needs more hands.
    If you have the time & motivation, help with bugfixes and maintenance is VERY welcome.
    Please go to https://github.com/nativefier/nativefier and help how you can. Thanks.



Processing options...
rawOptions {
  _: [ 'https://web.whatsapp.com/', '/target/' ],
  name: 'WhatsApp',
  n: 'WhatsApp',
  'single-instance': true,
  singleInstance: true,
  verbose: true,
  c: false,
  conceal: false,
  'no-overwrite': false,
  noOverwrite: false,
  overwrite: true,
  portable: false,
  widevine: false,
  'always-on-top': false,
  alwaysOnTop: false,
  'disable-context-menu': false,
  disableContextMenu: false,
  'disable-dev-tools': false,
  disableDevTools: false,
  'full-screen': false,
  fullScreen: false,
  'hide-window-frame': false,
  hideWindowFrame: false,
  m: false,
  'show-menu-bar': false,
  showMenuBar: false,
  maximize: false,
  tray: 'false',
  zoom: 1,
  'user-agent-honest': false,
  honest: false,
  userAgentHonest: false,
  'clear-cache': false,
  clearCache: false,
  'block-external-urls': false,
  blockExternalUrls: false,
  'strict-internal-urls': false,
  strictInternalUrls: false,
  'disable-gpu': false,
  disableGpu: false,
  'enable-es3-apis': false,
  enableEs3Apis: false,
  'ignore-gpu-blacklist': false,
  ignoreGpuBlacklist: false,
  'disable-old-build-warning-yesiknowitisinsecure': false,
  disableOldBuildWarningYesiknowitisinsecure: false,
  'ignore-certificate': false,
  ignoreCertificate: false,
  insecure: false,
  flash: false,
  bounce: false,
  counter: false,
  'darwin-dark-mode-support': false,
  darwinDarkModeSupport: false,
  f: false,
  'fast-quit': false,
  fastQuit: false,
  quiet: false,
  '$0': 'nativefier',
  targetUrl: 'https://web.whatsapp.com/',
  out: '/target/'
}
Inferred arch x64
Normalized URL https://web.whatsapp.com/ to: https://web.whatsapp.com/
Running in verbose mode! This will produce a mountain of logs and is recommended only for troubleshooting or if you like Shakespeare.
Inferred platform linux

Performing async options post-processing.
Inferring icon for https://web.whatsapp.com/ on linux
Inferring icon from store for https://web.whatsapp.com/ on linux
Allowed icon formats when building for linux: [ '.png', '.ico' ]
Sanitized filename for WhatsApp : WhatsApp
Got 246 icons from gitcloud
Max icon match score: 1
Downloading https://nativefier.github.io/nativefier-icons/files/whatsapp.png
Got an icon from the page.
Writing 159.2 kb icon to /tmp/nativefier-12-38-4-iconinfer--1-JJSaDHZeES52/icon.png
options {
  packager: {
    appCopyright: undefined,
    appVersion: undefined,
    arch: 'x64',
    asar: false,
    buildVersion: undefined,
    darwinDarkModeSupport: false,
    dir: '/nativefier/app',
    electronVersion: '16.0.8',
    icon: '/tmp/nativefier-12-38-4-iconinfer--1-JJSaDHZeES52/icon.png',
    name: 'WhatsApp',
    out: '/target/',
    overwrite: true,
    quiet: false,
    platform: 'linux',
    portable: false,
    targetUrl: 'https://web.whatsapp.com/',
    tmpdir: false,
    upgrade: false,
    upgradeFrom: undefined,
    win32metadata: {
      ProductName: 'WhatsApp',
      InternalName: 'WhatsApp',
      FileDescription: 'WhatsApp'
    }
  },
  nativefier: {
    accessibilityPrompt: true,
    alwaysOnTop: false,
    backgroundColor: undefined,
    basicAuthPassword: undefined,
    basicAuthUsername: undefined,
    blockExternalUrls: false,
    bookmarksMenu: undefined,
    bounce: false,
    browserwindowOptions: undefined,
    clearCache: false,
    counter: false,
    crashReporter: undefined,
    disableContextMenu: false,
    disableDevTools: false,
    disableGpu: false,
    diskCacheSize: undefined,
    disableOldBuildWarning: false,
    enableEs3Apis: false,
    fastQuit: false,
    fileDownloadOptions: undefined,
    flashPluginDir: undefined,
    fullScreen: false,
    globalShortcuts: undefined,
    hideWindowFrame: false,
    ignoreCertificate: false,
    ignoreGpuBlacklist: false,
    inject: [],
    insecure: false,
    internalUrls: undefined,
    lang: undefined,
    maximize: false,
    nativefierVersion: '46.1.0',
    quiet: false,
    processEnvs: undefined,
    proxyRules: undefined,
    showMenuBar: false,
    singleInstance: true,
    strictInternalUrls: false,
    titleBarStyle: undefined,
    tray: 'false',
    userAgent: undefined,
    userAgentHonest: false,
    verbose: true,
    versionString: undefined,
    width: 1280,
    height: 800,
    minWidth: undefined,
    minHeight: undefined,
    maxWidth: undefined,
    maxHeight: undefined,
    widevine: false,
    x: undefined,
    y: undefined,
    zoom: 1
  }
}

Preparing Electron app...
Copying electron app from /nativefier/app to /tmp/nativefier-12-38-4-app--1-JtlhCYyp4iKi
Writing app config to /tmp/nativefier-12-38-4-app--1-JtlhCYyp4iKi/nativefier.json {
  accessibilityPrompt: true,
  alwaysOnTop: false,
  appBundleId: undefined,
  appCategoryType: undefined,
  appCopyright: undefined,
  appVersion: undefined,
  arch: 'x64',
  asar: false,
  backgroundColor: undefined,
  basicAuthPassword: undefined,
  basicAuthUsername: undefined,
  blockExternalUrls: false,
  bounce: false,
  browserwindowOptions: undefined,
  buildDate: 1644755886817,
  buildVersion: undefined,
  clearCache: false,
  counter: false,
  crashReporter: undefined,
  darwinDarkModeSupport: false,
  derefSymlinks: undefined,
  disableContextMenu: false,
  disableDevTools: false,
  disableGpu: false,
  disableOldBuildWarning: false,
  diskCacheSize: undefined,
  download: undefined,
  electronVersionUsed: '16.0.8',
  enableEs3Apis: false,
  executableName: undefined,
  fastQuit: false,
  fileDownloadOptions: undefined,
  flashPluginDir: undefined,
  fullScreen: false,
  globalShortcuts: undefined,
  height: 800,
  helperBundleId: undefined,
  hideWindowFrame: false,
  ignoreCertificate: false,
  ignoreGpuBlacklist: false,
  insecure: false,
  internalUrls: undefined,
  isUpgrade: false,
  junk: undefined,
  lang: undefined,
  maximize: false,
  maxHeight: undefined,
  maxWidth: undefined,
  minHeight: undefined,
  minWidth: undefined,
  name: 'WhatsApp',
  nativefierVersion: '46.1.0',
  osxNotarize: undefined,
  osxSign: undefined,
  portable: false,
  processEnvs: undefined,
  protocols: undefined,
  proxyRules: undefined,
  prune: undefined,
  quiet: false,
  showMenuBar: false,
  singleInstance: true,
  strictInternalUrls: false,
  targetUrl: 'https://web.whatsapp.com/',
  titleBarStyle: undefined,
  tray: 'false',
  usageDescription: undefined,
  userAgent: undefined,
  userAgentHonest: false,
  versionString: undefined,
  width: 1280,
  widevine: false,
  win32metadata: {
    ProductName: 'WhatsApp',
    InternalName: 'WhatsApp',
    FileDescription: 'WhatsApp'
  },
  x: undefined,
  y: undefined,
  zoom: 1,
  oldBuildWarningText: ''
}
No files to inject, skipping copy.
Updating /tmp/nativefier-12-38-4-app--1-JtlhCYyp4iKi/package.json 'name' field to whatsapp-nativefier-d40211

Converting icons...
Building for Linux and icon is already a .png, no conversion needed
Copying icons if necessary
Copying icon /tmp/nativefier-12-38-4-iconinfer--1-JJSaDHZeES52/icon.png to /tmp/nativefier-12-38-4-app--1-JtlhCYyp4iKi/icon.png

Packaging... This will take a few seconds, maybe minutes if the requested Electron isn't cached yet...
2022-02-13T12:38:06.999Z electron-packager Electron Packager 15.4.0
Node v12.22.9
Host Operating system: linux 5.10.0-10-amd64 (x64)
2022-02-13T12:38:06.999Z electron-packager Packager Options: {"arch":"x64","asar":false,"darwinDarkModeSupport":false,"dir":"/tmp/nativefier-12-38-4-app--1-JtlhCYyp4iKi","electronVersion":"16.0.8","icon":"/tmp/nativefier-12-38-4-iconinfer--1-JJSaDHZeES52/icon.png","name":"WhatsApp","out":"/target/","overwrite":true,"quiet":false,"platform":"linux","portable":false,"targetUrl":"https://web.whatsapp.com/","tmpdir":false,"upgrade":false,"win32metadata":{"ProductName":"WhatsApp","InternalName":"WhatsApp","FileDescription":"WhatsApp"},"appBundleId":"com.electron.nativefier.whatsapp-nativefier-d40211"}
2022-02-13T12:38:07.000Z electron-packager Target Platforms: linux
2022-02-13T12:38:07.000Z electron-packager Target Architectures: x64
2022-02-13T12:38:07.005Z electron-packager Inferring appVersion from version in /tmp/nativefier-12-38-4-app--1-JtlhCYyp4iKi/package.json
2022-02-13T12:38:07.005Z electron-packager Application name: WhatsApp
2022-02-13T12:38:07.005Z electron-packager Target Electron version: 16.0.8
2022-02-13T12:38:07.005Z electron-packager Ignored path regular expressions: [
  '/package-lock\\.json$',
  '/yarn\\.lock$',
  '/\\.git($|/)',
  '/node_modules/\\.bin($|/)',
  '\\.o(bj)?$',
  '/tmp/electron-packager'
]
2022-02-13T12:38:07.006Z electron-packager Downloading Electron with options {"platform":"linux","arch":"x64","version":"16.0.8","artifactName":"electron"}
Packaging app for platform linux x64 using electron v16.0.8
2022-02-13T12:38:07.008Z electron-packager Creating /target/linux-x64-template
2022-02-13T12:38:07.008Z electron-packager Extracting /home/node/.cache/electron/2d180e08dca127a4bacab44a68d94f5ef852a6e6d9cda4cc740c970757bf287d/electron-v16.0.8-linux-x64.zip to /target/linux-x64-template
2022-02-13T12:38:10.000Z electron-packager Initializing app in /target/WhatsApp-linux-x64 from /target/linux-x64-template template
2022-02-13T12:38:10.032Z electron-packager Ignored paths based on the out param: [ '/target' ]
2022-02-13T12:38:10.324Z electron-packager Validating bundled Electron app
2022-02-13T12:38:10.324Z electron-packager Checking for a package.json file
2022-02-13T12:38:10.324Z electron-packager Checking for the main entry point file
2022-02-13T12:38:10.325Z electron-packager Validation complete
2022-02-13T12:38:10.325Z electron-packager Renaming electron to WhatsApp in /target/WhatsApp-linux-x64

Finalizing build...
App built to /target/WhatsApp-linux-x64, move to wherever it makes sense for you and run the contained executable file (prefixing with ./ if necessary)
Menu/desktop shortcuts are up to you, because Nativefier cannot know where you're going to move the app. Search for "linux .desktop file" for help, or see https://wiki.archlinux.org/index.php/Desktop_entries

Expected behavior

User-agent should not have extra spaces.

Actual behavior

Generated user-agent had extra spaces.

Debug info

User Agent:

Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko)  Chrome/96.0.4664.110 Safari/537.36

As you can see there are two spaces before the text "Chrome".
The user agent was retrieved by looking at request headers in Developer tools.

Context

  • Nativefier: 46.1.0
  • OS: Debian 11.2
  • Docker version: 20.10.5+dfsg1, build 55c4c88
  • Is it a regression? Yes
@SrIzan10
Copy link

Hey! I had this problem yesterday when I made my own Whatsapp Web Webapp (you can download it here btw https://github.com/SrIzan10/whatsapp-web/releases/tag/v1.0.0 for windows). I fixed it using my own user agent. You can try this one: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.169 Safari/537.36.
This user agent is Chrome 74 on Windows 10 on a x64 (AMD) architecture.

@amaramrahul
Copy link
Author

amaramrahul commented Feb 13, 2022

hey. I did something similar. But I decided to just use the generated user agent with the extra spaces removed as that would accurately reflect the exact chrome version and OS I was using. So, in my case, I used:

Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.110 Safari/537.36

ronjouch pushed a commit that referenced this issue Mar 21, 2022
Fixes #1357 , by
not adding a new space when removing the app name from the User-Agent.

Co-authored-by: noxafy <hci@gmx.de>
Adam777Z pushed a commit to Adam777Z/nativefier that referenced this issue Nov 9, 2022
…ier#1367)

Fixes nativefier#1357 , by
not adding a new space when removing the app name from the User-Agent.

Co-authored-by: noxafy <hci@gmx.de>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
2 participants