@@ -10,31 +10,27 @@ const fillServerURLs = url => ({
1010 api : url ,
1111} ) ;
1212
13- function getDefaultServerURLs ( appId , region ) {
14- if ( region === 'us' ) return fillServerURLs ( 'https://us-api.leancloud.cn' ) ;
15- let id ;
13+ function getDefaultServerURLs ( appId ) {
14+ let domain ;
15+ const id = appId . slice ( 0 , 8 ) . toLowerCase ( ) ;
1616 switch ( appId . slice ( - 9 ) ) {
1717 case '-9Nh9j0Va' :
1818 // TAB
19- id = appId . slice ( 0 , 8 ) . toLowerCase ( ) ;
20- return {
21- push : `https://${ id } .push.lncldapi.com` ,
22- stats : `https://${ id } .stats.lncldapi.com` ,
23- engine : `https://${ id } .engine.lncldapi.com` ,
24- api : `https://${ id } .api.lncldapi.com` ,
25- } ;
19+ domain = 'lncldapi.com' ;
20+ break ;
2621 case '-MdYXbMMI' :
2722 // US
28- return fillServerURLs ( 'https://us-api.leancloud.cn' ) ;
23+ domain = 'lncldglobal.com' ;
24+ break ;
2925 default :
30- id = appId . slice ( 0 , 8 ) . toLowerCase ( ) ;
31- return {
32- push : `https://${ id } .push.lncld.net` ,
33- stats : `https://${ id } .stats.lncld.net` ,
34- engine : `https://${ id } .engine.lncld.net` ,
35- api : `https://${ id } .api.lncld.net` ,
36- } ;
26+ domain = 'lncld.net' ;
3727 }
28+ return {
29+ push : `https://${ id } .push.${ domain } ` ,
30+ stats : `https://${ id } .stats.${ domain } ` ,
31+ engine : `https://${ id } .engine.${ domain } ` ,
32+ api : `https://${ id } .api.${ domain } ` ,
33+ } ;
3834}
3935
4036let _disableAppRouter = false ;
@@ -56,7 +52,6 @@ let _disableAppRouter = false;
5652 * @param {String } options.appId application id
5753 * @param {String } options.appKey application key
5854 * @param {String } [options.masterKey] application master key
59- * @param {String } [options.region='cn'] region
6055 * @param {Boolean } [options.production]
6156 * @param {String|ServerURLs } [options.serverURLs] URLs for services. if a string was given, it will be applied for all services.
6257 * @param {Boolean } [options.disableCurrentUser]
@@ -67,15 +62,13 @@ AV.init = function init(options, ...params) {
6762 appId : options ,
6863 appKey : params [ 0 ] ,
6964 masterKey : params [ 1 ] ,
70- region : params [ 2 ] ,
7165 } ) ;
7266 }
7367 const {
7468 appId,
7569 appKey,
7670 masterKey,
7771 hookKey,
78- region = 'cn' ,
7972 serverURLs,
8073 disableCurrentUser,
8174 production,
@@ -96,11 +89,11 @@ AV.init = function init(options, ...params) {
9689 AV . _config . disableCurrentUser = disableCurrentUser ;
9790 AV . _appRouter = new AppRouter ( AV ) ;
9891 const disableAppRouter =
99- _disableAppRouter || typeof serverURLs !== 'undefined' || region !== 'cn' ;
92+ _disableAppRouter || typeof serverURLs !== 'undefined' ;
10093 AV . _setServerURLs (
10194 extend (
10295 { } ,
103- getDefaultServerURLs ( appId , region ) ,
96+ getDefaultServerURLs ( appId ) ,
10497 AV . _config . serverURLs ,
10598 typeof serverURLs === 'string' ? fillServerURLs ( serverURLs ) : serverURLs
10699 ) ,
@@ -112,7 +105,6 @@ AV.init = function init(options, ...params) {
112105 AV . _config . realtime = new AV . _sharedConfig . liveQueryRealtime ( {
113106 appId,
114107 appKey,
115- region,
116108 } ) ;
117109 }
118110} ;
0 commit comments