more fix
This commit is contained in:
@ -174,76 +174,76 @@ const GenerateICS = function (shifts) {
|
|||||||
// const TOKEN_PATH = path.join(process.cwd(), 'content/token.json');
|
// const TOKEN_PATH = path.join(process.cwd(), 'content/token.json');
|
||||||
// const CREDENTIALS_PATH = path.join(process.cwd(), 'content/client_secret_926212607479-d3m8hm8f8esp3rf1639prskn445sa01v.apps.googleusercontent.com.json');
|
// const CREDENTIALS_PATH = path.join(process.cwd(), 'content/client_secret_926212607479-d3m8hm8f8esp3rf1639prskn445sa01v.apps.googleusercontent.com.json');
|
||||||
|
|
||||||
createEvent = async function createEvent(id) {
|
// const createEvent = async function createEvent(id) {
|
||||||
// var eventTest2 = {
|
// // var eventTest2 = {
|
||||||
// 'summary': 'Google I/O 2015',
|
// // 'summary': 'Google I/O 2015',
|
||||||
// 'location': '800 Howard St., San Francisco, CA 94103',
|
// // 'location': '800 Howard St., San Francisco, CA 94103',
|
||||||
// 'description': 'A chance to hear more about Google\'s developer products.',
|
// // 'description': 'A chance to hear more about Google\'s developer products.',
|
||||||
// 'start': {
|
// // 'start': {
|
||||||
// 'dateTime': '2015-05-28T09:00:00-07:00',
|
// // 'dateTime': '2015-05-28T09:00:00-07:00',
|
||||||
// 'timeZone': 'America/Los_Angeles',
|
// // 'timeZone': 'America/Los_Angeles',
|
||||||
// },
|
// // },
|
||||||
// 'end': {
|
// // 'end': {
|
||||||
// 'dateTime': '2015-05-28T17:00:00-07:00',
|
// // 'dateTime': '2015-05-28T17:00:00-07:00',
|
||||||
// 'timeZone': 'America/Los_Angeles',
|
// // 'timeZone': 'America/Los_Angeles',
|
||||||
// },
|
// // },
|
||||||
// 'recurrence': [
|
// // 'recurrence': [
|
||||||
// 'RRULE:FREQ=DAILY;COUNT=2'
|
// // 'RRULE:FREQ=DAILY;COUNT=2'
|
||||||
// ],
|
// // ],
|
||||||
// 'attendees': [
|
// // 'attendees': [
|
||||||
// { 'email': '' },
|
// // { 'email': '' },
|
||||||
|
|
||||||
// ],
|
// // ],
|
||||||
// 'reminders': {
|
// // 'reminders': {
|
||||||
// 'useDefault': false,
|
// // 'useDefault': false,
|
||||||
// 'overrides': [
|
// // 'overrides': [
|
||||||
// { 'method': 'email', 'minutes': 24 * 60 },
|
// // { 'method': 'email', 'minutes': 24 * 60 },
|
||||||
// { 'method': 'popup', 'minutes': 10 },
|
// // { 'method': 'popup', 'minutes': 10 },
|
||||||
// ],
|
// // ],
|
||||||
// },
|
// // },
|
||||||
// };
|
// // };
|
||||||
// var errors;
|
// // var errors;
|
||||||
// var auth = await exports.authorize().then((auth) => {
|
// // var auth = await exports.authorize().then((auth) => {
|
||||||
|
|
||||||
// const calendar = google.calendar({ version: 'v3', auth });
|
// // const calendar = google.calendar({ version: 'v3', auth });
|
||||||
// const res = calendar.events.insert({
|
// // const res = calendar.events.insert({
|
||||||
// calendarId: 'primary',
|
// // calendarId: 'primary',
|
||||||
// resource: eventTest,
|
// // resource: eventTest,
|
||||||
|
|
||||||
// }, (err, event) => {
|
// // }, (err, event) => {
|
||||||
// if (err) {
|
// // if (err) {
|
||||||
// console.log(`There was an error creating the event: ${err}`);
|
// // console.log(`There was an error creating the event: ${err}`);
|
||||||
// return;
|
// // return;
|
||||||
// }
|
// // }
|
||||||
// console.log(`Event created: ${event.data.htmlLink}`);
|
// // console.log(`Event created: ${event.data.htmlLink}`);
|
||||||
|
// // });
|
||||||
|
// // }).catch(console.error).then((err) => {
|
||||||
|
// // errors = err;
|
||||||
|
// // });
|
||||||
|
// // return errors;
|
||||||
|
// // }
|
||||||
|
|
||||||
|
// // authorizeNew = async function authorizeNew() {
|
||||||
|
// // let client = await loadSavedCredentialsIfExist();
|
||||||
|
// // if (client) {
|
||||||
|
// // return client;
|
||||||
|
// // }
|
||||||
|
// // // Set up the Google Calendar API client
|
||||||
|
// // const calendar = google.calendar({ version: 'v3', auth });
|
||||||
|
|
||||||
|
// // // Load the client secrets from a JSON file
|
||||||
|
|
||||||
|
// fs.readFile("./path/to/client_secret.json", (err, content) => {
|
||||||
|
// if (err) return console.error("Error loading client secret file:", err);
|
||||||
|
|
||||||
|
// // Authorize a client with the loaded credentials
|
||||||
|
// authorizeOA(JSON.parse(content), calendar.calendarList.list);
|
||||||
// });
|
// });
|
||||||
// }).catch(console.error).then((err) => {
|
// if (client.credentials) {
|
||||||
// errors = err;
|
// await saveCredentials(client);
|
||||||
// });
|
|
||||||
// return errors;
|
|
||||||
// }
|
// }
|
||||||
|
|
||||||
// authorizeNew = async function authorizeNew() {
|
|
||||||
// let client = await loadSavedCredentialsIfExist();
|
|
||||||
// if (client) {
|
|
||||||
// return client;
|
// return client;
|
||||||
// }
|
// };
|
||||||
// // Set up the Google Calendar API client
|
|
||||||
// const calendar = google.calendar({ version: 'v3', auth });
|
|
||||||
|
|
||||||
// // Load the client secrets from a JSON file
|
|
||||||
|
|
||||||
fs.readFile("./path/to/client_secret.json", (err, content) => {
|
|
||||||
if (err) return console.error("Error loading client secret file:", err);
|
|
||||||
|
|
||||||
// Authorize a client with the loaded credentials
|
|
||||||
authorizeOA(JSON.parse(content), calendar.calendarList.list);
|
|
||||||
});
|
|
||||||
if (client.credentials) {
|
|
||||||
await saveCredentials(client);
|
|
||||||
}
|
|
||||||
return client;
|
|
||||||
};
|
|
||||||
|
|
||||||
// var googletoken = axiosInstance.get("/content/google_token.json");
|
// var googletoken = axiosInstance.get("/content/google_token.json");
|
||||||
// console.log("googletoken: " + googletoken);
|
// console.log("googletoken: " + googletoken);
|
||||||
@ -372,7 +372,7 @@ async function importModules() {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
createEvent = async (event) => {
|
const createEvent = async (event) => {
|
||||||
|
|
||||||
const { open, getPort } = await importModules();
|
const { open, getPort } = await importModules();
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user