Skip to content
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

feat: Make recent webapps compatible with old URL configs #10326

Merged
merged 1 commit into from
Jan 21, 2021

Conversation

bennycode
Copy link
Contributor

Current situation
The current config code sets URL to what is given by env.URL or a set of default values.

Problem
When you are now launching the webapp with a very old configuration, then env.URL might not have entries like URL.SUPPORT.HISTORY, so our code fails at statements like Config.getConfig().URL.SUPPORT.HISTORY.

Solution
To make new Wire web app versions compatible with old configs, we can set URL to a set of defaults first and then spread the config properties of our custom (old) config into the config object. Thus it will be guaranteed that we have a config with meaningful default values.

Real-World Scenario
I ran into this problem by using a webapp version (commit ID 14ee262) from 2021 with a config from 2020.

  • My old config:
window.wire = window.wire || {};
window.wire.env = {
  ANALYTICS_API_KEY: '',
  APP_NAME: 'Webapp',
  BACKEND_REST: 'https://prod-nginz-https.wire.com',
  BACKEND_WS: 'wss://prod-nginz-ssl.wire.com',
  BRAND_NAME: 'Wire',
  ENVIRONMENT: 'production',
  FEATURE: {
    ALLOWED_FILE_UPLOAD_EXTENSIONS: ['*'],
    APPLOCK_SCHEDULED_TIMEOUT: null,
    APPLOCK_UNFOCUS_TIMEOUT: null,
    CHECK_CONSENT: true,
    DEFAULT_LOGIN_TEMPORARY_CLIENT: false,
    ENABLE_ACCOUNT_REGISTRATION: true,
    ENABLE_DEBUG: false,
    ENABLE_DOMAIN_DISCOVERY: true,
    ENABLE_PHONE_LOGIN: true,
    ENABLE_SSO: true,
    PERSIST_TEMPORARY_CLIENTS: true,
    SHOW_LOADING_INFORMATION: false,
  },
  MAX_GROUP_PARTICIPANTS: 500,
  MAX_VIDEO_PARTICIPANTS: 4,
  NEW_PASSWORD_MINIMUM_LENGTH: 8,
  RAYGUN_API_KEY: '',
  URL: {
    ACCOUNT_BASE: 'https://account.wire.com',
    MOBILE_BASE: '',
    PRIVACY_POLICY: 'https://wire.com/security',
    SUPPORT_BASE: 'https://support.wire.com',
    TEAMS_BASE: 'https://teams.wire.com',
    TERMS_OF_USE_PERSONAL: 'https://wire.com/legal/terms/personal',
    TERMS_OF_USE_TEAMS: 'https://wire.com/legal/terms/teams',
    WEBSITE_BASE: 'https://wire.com',
  },
  VERSION: '2020-02-14-13-07',
  APP_BASE: 'https://app.wire.com',
};

@bennycode bennycode changed the title fix: Merge custom config with default config feat: Make recent webapps compatible with old configs Jan 21, 2021
@github-actions
Copy link
Contributor

Coverage Report

Totals Coverage
Statements: 46.13% ( 10650 / 23088 )
Methods: 38.07% ( 2051 / 5388 )

@bennycode bennycode changed the title feat: Make recent webapps compatible with old configs feat: Make recent webapps compatible with old URL configs Jan 21, 2021
@bennycode bennycode merged commit f2ede92 into dev Jan 21, 2021
@bennycode bennycode deleted the bennycode-merge-default-custom branch January 21, 2021 14:26
lipis added a commit that referenced this pull request Jan 26, 2021
…-lock

* 'dev' of github.com:wireapp/wire-webapp: (73 commits)
  refactor: Migrate legal hold dot component to React (#10329)
  refactor: Migrate loading-bar to react (#10328)
  refactor: Migrate info-toggle to react (#10277)
  feat: Make recent webapps compatible with old URL configs (#10326)
  fix: Video call remembers last speaker view (SQCALL-127) (#10325)
  fix: No active speaker tab for less than 3 participants (SQCALL-124) (#10324)
  test: Mock joinedCall state correctly
  refactor: Extract CallState (#10281)
  docs: Remove Travis CI from build workflow
  chore: bump eslint-plugin-jsdoc from 31.0.5 to 31.0.8 (#10322)
  chore: bump stylelint from 13.8.0 to 13.9.0 (#10321)
  chore: bump webpack-cli from 4.3.1 to 4.4.0 (#10318)
  chore: bump @typescript-eslint/eslint-plugin from 4.13.0 to 4.14.0 (#10317)
  chore: bump eslint-config-prettier from 7.1.0 to 7.2.0 (#10315)
  chore: bump enzyme-adapter-react-16 from 1.15.5 to 1.15.6 (#10314)
  chore: bump fs-extra from 9.0.1 to 9.1.0 in /server (#10313)
  chore: bump helmet from 4.3.1 to 4.4.1 in /server (#10312)
  refactor: Replace jQuery keydown listener (#10311)
  chore: bump @wireapp/store-engine-dexie from 1.3.27 to 1.3.28 (#10316)
  chore: Ignore less dependency updates (#10309)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants