| 
					
				 | 
			
			
				@@ -10,32 +10,35 @@ const {getFetch, updateFetch} = require('./fetch'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 const bodyParser = require('body-parser'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 const https = require('https'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 const JSZIP = require('jszip'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-require('dotenv').config({ path: './env/.env.test' }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+require('dotenv').config({ path: './env/.env.local' }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 const session = require('express-session'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 const multer  = require('multer'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 const XLSX = require('xlsx'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 const pptxgen = require('pptxgenjs'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+const msal = require('@azure/msal-node'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+require('dotenv').config({ path: './env/.env.test' }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+const msalConfig = { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  auth: { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      clientId: process.env.TEAMS_APP_ID, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      authority: "https://login.microsoftonline.com/"+process.env.TEAMS_APP_TENANT_ID, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      clientSecret: process.env.TEAMS_APP_SECRET, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      knownAuthorities: [], 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  cache: { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      // your implementation of caching 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  system: { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      loggerOptions: { /** logging related options */ } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+}  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+const cca = new msal.ConfidentialClientApplication(msalConfig); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 const {Document, Packer, Paragraph, TextRun} = require('docx'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 let WebSocketServer = require('websocket').server; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 const redirectUri = 'https://localhost:53000/redirect'; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-// const {DeviceCodeCredential} = require('@azure/identity'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-// const {TokenCredentialAuthenticationProvider} = require('@microsoft/microsoft-graph-client/authProviders/azureTokenCredentials') 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-// const {Client} = require('@microsoft/microsoft-graph-client') 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-// const credential = new DeviceCodeCredential({ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//   tenantId : process.env.TENANT_ID, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//   clientId : process.env.CLIENT_ID, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//   userPromptCallback: (info) => { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//     console.log(info.message); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//   }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-// }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-// const authPr = new TokenCredentialAuthenticationProvider(credential, { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//   scopes: ['.default'], 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-// }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-// const graphClient = Client.initWithMiddleware({ authProvider: authPr }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 const storage =  multer.diskStorage({ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   destination: function (req, file, cb) {  
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -49,15 +52,7 @@ const upload = multer(storage); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 const serverApp = express(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 const endPoint = process.env.GRAPH_API_ENDPOINT + 'v1.0'; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-Buffer.prototype.toArrayInteger = function(){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-  if (this.length > 0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-      const data = new Array(this.length); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-      for (let i = 0; i < this.length; i=i+1) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-          data[i] = this[i]; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-      return data; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-  } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-  return []; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 serverApp.use(session({ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   secret: process.env.EXPRESS_SESSION_SECRET, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   resave: false, 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -135,14 +130,25 @@ server.listen(SERVER_PORT, function () { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 serverApp.get("/tab",  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-  isAuthenticated,  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  // isAuthenticated,  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   async function (req, res, next) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     res.sendFile(path.join(__dirname, "/views/hello.html"),  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       // { idTokenClaims: req.session.account.idTokenClaims } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     ); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 ); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+serverApp.post("/getProfileOnBehalfOf", async (req, res, next) => { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  result = await cca.acquireTokenOnBehalfOf({ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    oboAssertion: req.body.token, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    scopes: [".default"] 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  req.session.tokenCache = result.tokenCache; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  req.session.accessToken = result.accessToken; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  req.session.idToken = result.idToken; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  req.session.account = result.account; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  req.session.auth = result; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  return res.send(result); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+}) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 function isAuthenticated(req, res, next) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   if (!req.session.isAuthenticated) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     return res.redirect('/auth/signin'); // redirect to sign-in route 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -170,8 +176,8 @@ serverApp.get("/auth/signin", authProvider.login({ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 serverApp.post("/redirect", authProvider.handleRedirect()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 serverApp.post("/api-get",    
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-  isAuthenticated, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-  isAccessToken,  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  // isAuthenticated, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  // isAccessToken,  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   async (req, res, next) => { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     const uri = req.body.api_uri || req.session.apiUri; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     let param = {}; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -231,11 +237,69 @@ serverApp.post("/api-post", authProvider.acquireToken({ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   successRedirect: '/post-redirect' 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 })); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-serverApp.post("/getGroupList", authProvider.acquireToken({ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    scopes: ['.default'], 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    redirectUri: redirectUri, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    successRedirect: '/group-redirect' 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-})); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+// serverApp.post("/getGroupList", authProvider.acquireToken({ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//     scopes: ['.default'], 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//     redirectUri: redirectUri, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//     successRedirect: '/group-redirect' 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+// })); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+serverApp.post("/getGroupList",  async function (req, res, next) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  try { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      const oneDrive = await getFetch(endPoint + "/me/drive/root", req.session.accessToken); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      const sharePointIds = await getFetch(endPoint + "/me/drive/SharePointIds", req.session.accessToken); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      // const publicTeam = await getFetch(endPoint + "/groups?$filter=groupTypes/any(c:c+eq+'Unified')", req.session.accessToken); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      const graphResponse = await getFetch(endPoint + "/me/joinedTeams", req.session.accessToken); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      const sites = await getFetch(endPoint + "/sites/root", req.session.accessToken); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      const sitesSharePoint = await getFetch(endPoint + "/sites/root/SharePointIds", req.session.accessToken); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      // const public = publicTeam.value; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      const teams = graphResponse.value; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      oneDrive.sharePoint = sharePointIds; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      sites.sharePoint = sitesSharePoint; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      const resultObj = { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        oneDrive : { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          teams: oneDrive, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        joinedTeams : { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          teams : teams, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          // teams : public, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          items : {}, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        sites : { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          teams : sites, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      if (teams && teams.length) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      // if (public && public.length) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        // const options = { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        //   responseType: 'arraybuffer', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        //   headers: { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        //     Authorization: `Bearer ${req.session.accessToken}`, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        //     ConsistencyLevel: 'eventual', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        //     withCredentials:true, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        //   }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        // }; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        for (let team of teams) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        // for (let team of public) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          const item = await getFetch(endPoint + "/groups/"+team.id+"/drive/items/root/children", req.session.accessToken); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          const sharePoint = await getFetch(endPoint + "/groups/"+team.id+"/drive/SharePointIds", req.session.accessToken); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          // const image = await axios.get(endPoint + "/groups/" + team.id + "/photo/$value", options); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          // if (image && image.data) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          //   team.image = image.data; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          // } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          if (sharePoint) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            team.sharePoint = sharePoint; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          if (item && item.value) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            resultObj.joinedTeams.items[team.id] = item.value; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      res.json(resultObj); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  } catch (error) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      next(error); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  }  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+}); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 serverApp.get("/group-redirect",  
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -313,8 +377,8 @@ function isAccessTokens(req, res, next) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 serverApp.post('/api/makeFolder',  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    isAuthenticated, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    isAccessTokens, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    // isAuthenticated, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    // isAccessTokens, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     async (req, res, next)=>{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       const options = { 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -372,8 +436,8 @@ function getErrorMessage(error) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 serverApp.post('/api/makeWord',  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    isAuthenticated, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    isAccessTokens, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    // isAuthenticated, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    // isAccessTokens, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     async (req, res, next)=>{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       const options = { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         headers: { 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -422,8 +486,8 @@ serverApp.post('/api/makeWord', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 }) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 serverApp.post('/api/makeExcel',  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    isAuthenticated, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    isAccessTokens, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    // isAuthenticated, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    // isAccessTokens, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     async (req, res, next)=>{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       const fileOptions = { headers: { 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -458,8 +522,8 @@ serverApp.post('/api/makeExcel', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 }) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 serverApp.post('/api/makePptx',  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    isAuthenticated, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    isAccessTokens, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    // isAuthenticated, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    // isAccessTokens, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     async (req, res, next)=>{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       const options = { headers: { 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -491,8 +555,8 @@ serverApp.post('/api/makePptx', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 }) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 serverApp.post('/api/check-name',  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    isAuthenticated, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    isAccessTokens, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    // isAuthenticated, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    // isAccessTokens, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     async (req, res, next)=>{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       const options = { 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -671,8 +735,8 @@ serverApp.post('/api/check-name', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 // }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 serverApp.post('/api/upload', upload.array('file'), 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-  isAuthenticated, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-  isAccessTokens, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  // isAuthenticated, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  // isAccessTokens, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   async (req, res, next)=>{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     const startTime = new Date(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     const files = req.files; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -838,8 +902,8 @@ serverApp.post('/api/upload', upload.array('file'), 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 serverApp.post('/api/download', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-  isAuthenticated, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-  isAccessTokens, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  // isAuthenticated, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  // isAccessTokens, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   async (req, res, next)=>{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     if (req.body) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       const {siteId, path, fileIds, zipName} = req.body; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -1002,8 +1066,8 @@ async function getFolderItems(url, array, options) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 serverApp.post('/api/delete',  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-  isAuthenticated, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-  isAccessTokens, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  // isAuthenticated, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  // isAccessTokens, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   async (req, res, next)=>{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     if (req.body) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       const {siteId, itemIds} = req.body; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -1045,8 +1109,8 @@ serverApp.post('/api/delete', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   }) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 serverApp.post('/api/update-name',  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-  isAuthenticated, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-  isAccessTokens, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  // isAuthenticated, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  // isAccessTokens, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   async (req, res, next)=>{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     if (req.body) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       const {siteId, itemId, name} = req.body; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -1080,8 +1144,8 @@ serverApp.post('/api/update-name', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 serverApp.post('/api/move-item',  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-  isAuthenticated, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-  isAccessTokens, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  // isAuthenticated, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  // isAccessTokens, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   async (req, res, next)=>{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     if (req.body) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       const {id, name, siteId, text} = req.body; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -1128,8 +1192,8 @@ serverApp.post('/api/move-item', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 serverApp.post('/api/copy-item',  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-isAuthenticated, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-isAccessTokens, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+// isAuthenticated, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+// isAccessTokens, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 async (req, res, next)=>{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   if (req.body) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     const {id, name, siteId, driveId, text} = req.body; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -1201,8 +1265,8 @@ serverApp.post('/api/loading', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 serverApp.post('/api/folder-count', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-  isAuthenticated, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-  isAccessTokens, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  // isAuthenticated, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  // isAccessTokens, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   async (req, res, next)=>{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     if (req.body) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       const {id, siteId, originSiteId, originId, name, totalCount} = req.body; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -1270,8 +1334,8 @@ async function getFolderItemsCount(siteId, id, options, count) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 serverApp.post('/api/add-tab',  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-isAuthenticated, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-isAccessTokens, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+// isAuthenticated, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+// isAccessTokens, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 async (req, res, next)=>{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   if (req.body) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     const {name, siteId, path, teamId, teamName, bindId} = req.body; 
			 |