Fix: Make version changeable from the environment vars (#4654)
This commit is contained in:
@@ -38,9 +38,12 @@ class DashboardController < ActionController::Base
|
|||||||
end
|
end
|
||||||
|
|
||||||
def app_config
|
def app_config
|
||||||
{ APP_VERSION: Chatwoot.config[:version],
|
{
|
||||||
|
APP_VERSION: Chatwoot.config[:version],
|
||||||
VAPID_PUBLIC_KEY: VapidService.public_key,
|
VAPID_PUBLIC_KEY: VapidService.public_key,
|
||||||
ENABLE_ACCOUNT_SIGNUP: GlobalConfigService.load('ENABLE_ACCOUNT_SIGNUP', 'false'),
|
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
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ export const createMessengerScript = pageId => `
|
|||||||
FB.init({
|
FB.init({
|
||||||
appId: "${window.chatwootConfig.fbAppId}",
|
appId: "${window.chatwootConfig.fbAppId}",
|
||||||
xfbml: true,
|
xfbml: true,
|
||||||
version: "v4.0"
|
version: "${window.chatwootConfig.fbApiVersion}"
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
(function(d, s, id){
|
(function(d, s, id){
|
||||||
|
|||||||
@@ -163,7 +163,7 @@ export default {
|
|||||||
FB.init({
|
FB.init({
|
||||||
appId: window.chatwootConfig.fbAppId,
|
appId: window.chatwootConfig.fbAppId,
|
||||||
xfbml: true,
|
xfbml: true,
|
||||||
version: 'v12.0',
|
version: window.chatwootConfig.fbApiVersion,
|
||||||
status: true,
|
status: true,
|
||||||
});
|
});
|
||||||
window.fbSDKLoaded = true;
|
window.fbSDKLoaded = true;
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ export default {
|
|||||||
FB.init({
|
FB.init({
|
||||||
appId: window.chatwootConfig.fbAppId,
|
appId: window.chatwootConfig.fbAppId,
|
||||||
xfbml: true,
|
xfbml: true,
|
||||||
version: 'v12.0',
|
version: window.chatwootConfig.fbApiVersion,
|
||||||
status: true,
|
status: true,
|
||||||
});
|
});
|
||||||
window.fbSDKLoaded = true;
|
window.fbSDKLoaded = true;
|
||||||
|
|||||||
@@ -34,6 +34,7 @@
|
|||||||
window.chatwootConfig = {
|
window.chatwootConfig = {
|
||||||
hostURL: '<%= ENV.fetch('FRONTEND_URL', '') %>',
|
hostURL: '<%= ENV.fetch('FRONTEND_URL', '') %>',
|
||||||
fbAppId: '<%= ENV.fetch('FB_APP_ID', nil) %>',
|
fbAppId: '<%= ENV.fetch('FB_APP_ID', nil) %>',
|
||||||
|
fbApiVersion: '<%= @global_config['FACEBOOK_API_VERSION'] %>',
|
||||||
signupEnabled: '<%= @global_config['ENABLE_ACCOUNT_SIGNUP'] %>',
|
signupEnabled: '<%= @global_config['ENABLE_ACCOUNT_SIGNUP'] %>',
|
||||||
<% if @global_config['VAPID_PUBLIC_KEY'] %>
|
<% if @global_config['VAPID_PUBLIC_KEY'] %>
|
||||||
vapidPublicKey: new Uint8Array(<%= Base64.urlsafe_decode64(@global_config['VAPID_PUBLIC_KEY']).bytes %>),
|
vapidPublicKey: new Uint8Array(<%= Base64.urlsafe_decode64(@global_config['VAPID_PUBLIC_KEY']).bytes %>),
|
||||||
|
|||||||
Reference in New Issue
Block a user