Fix: Make version changeable from the environment vars (#4654)

This commit is contained in:
Tejaswini Chile 2022-05-10 19:20:55 +05:30 committed by GitHub
parent 81d0405473
commit 9ed1f5d96b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 9 additions and 5 deletions

View file

@ -38,9 +38,12 @@ class DashboardController < ActionController::Base
end
def app_config
{ APP_VERSION: Chatwoot.config[:version],
{
APP_VERSION: Chatwoot.config[:version],
VAPID_PUBLIC_KEY: VapidService.public_key,
ENABLE_ACCOUNT_SIGNUP: GlobalConfigService.load('ENABLE_ACCOUNT_SIGNUP', 'false'),
FB_APP_ID: GlobalConfigService.load('FB_APP_ID', '') }
FB_APP_ID: GlobalConfigService.load('FB_APP_ID', ''),
FACEBOOK_API_VERSION: 'v13.0'
}
end
end

View file

@ -4,7 +4,7 @@ export const createMessengerScript = pageId => `
FB.init({
appId: "${window.chatwootConfig.fbAppId}",
xfbml: true,
version: "v4.0"
version: "${window.chatwootConfig.fbApiVersion}"
});
};
(function(d, s, id){

View file

@ -163,7 +163,7 @@ export default {
FB.init({
appId: window.chatwootConfig.fbAppId,
xfbml: true,
version: 'v12.0',
version: window.chatwootConfig.fbApiVersion,
status: true,
});
window.fbSDKLoaded = true;

View file

@ -40,7 +40,7 @@ export default {
FB.init({
appId: window.chatwootConfig.fbAppId,
xfbml: true,
version: 'v12.0',
version: window.chatwootConfig.fbApiVersion,
status: true,
});
window.fbSDKLoaded = true;

View file

@ -34,6 +34,7 @@
window.chatwootConfig = {
hostURL: '<%= ENV.fetch('FRONTEND_URL', '') %>',
fbAppId: '<%= ENV.fetch('FB_APP_ID', nil) %>',
fbApiVersion: '<%= @global_config['FACEBOOK_API_VERSION'] %>',
signupEnabled: '<%= @global_config['ENABLE_ACCOUNT_SIGNUP'] %>',
<% if @global_config['VAPID_PUBLIC_KEY'] %>
vapidPublicKey: new Uint8Array(<%= Base64.urlsafe_decode64(@global_config['VAPID_PUBLIC_KEY']).bytes %>),