Skip to content

Commit

Permalink
🔖 Change version to 4.3.1
Browse files Browse the repository at this point in the history
- Bump package version to 4.3.1.
- Update README.md for Library V10.
- Document changes and improvements in CHANGELOG.md.
- Add Release Note documentation for Library V10.
- Generate the `bundle.js` file using the latest source files.
  • Loading branch information
chriskyfung committed Mar 15, 2024
1 parent d0246f8 commit 793d89e
Show file tree
Hide file tree
Showing 5 changed files with 158 additions and 61 deletions.
58 changes: 55 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,66 @@ For more details on specific issues and pull requests, you can refer to the
corresponding GitHub links provided. If you require further specific details
about a particular build or feature, feel free to reach out.

## Work-in-progress (WIP) for Library V10
## Library V10 (build240315a) / 2024-03-15

### Bug Fixes

- Standardized the log date and time format to be consistent with the local time
zone and locale settings[#80].
- Standardized log datetime format ([#80])

- Enhanced the `insertNewLog` function in `logger.js` to receive a JavaScript
Date object for the `datetime` parameter instead of a string.
- Retrieve the time zone from the spreadsheet's locate setting.
- Transformed the `datetime` parameter to a datetime string in the format of
`"yyyy-MM-dd HH:mm:ss"` using the `Utilities.formatDate()` method.
- Adjusted the `fetcher.js` file to pass the date and time as a `Date` object
when calling the `insertNewLog` function.

- Resolved the "No item with the given ID could be found" error ([#112])

- Enclosed the `DriveApp.getFileById` method call in a `try-catch` block in
`logger.js`.
- Included error logging in the `catch` block if an exception is thrown.

[#80]: https://github.com/chriskyfung/AutoFetcher-IG-Stories-to-GDrive/issues/80
[#112]: https://github.com/chriskyfung/AutoFetcher-IG-Stories-to-GDrive/issues/112

### Dependencies

- **Updated:**
- jekyll (3.9.0 → 3.9.5)
- nokogiri (1.16.0 → 1.16.2) in `/docs` ([#96])
- apps-script-oauth2 (72d4dbc → 6ae908a) ([#101])
- eslint-plugin-googleappsscript (1.0.4 → 1.0.5) ([#106])
- @babel/preset-env (7.23.7 → 7.24.0) ([#107])
- @rollup/plugin-multi-entry (6.0.0 → 6.0.1) ([#108])
- eslint (8.34.0 → 8.57.0) ([#109])
- rollup (3.15.0 → 4.12.0) ([#110])

[#96]: https://github.com/chriskyfung/AutoFetcher-IG-Stories-to-GDrive/pull/96
[#101]: https://github.com/chriskyfung/AutoFetcher-IG-Stories-to-GDrive/pull/101
[#106]: https://github.com/chriskyfung/AutoFetcher-IG-Stories-to-GDrive/pull/106
[#107]: https://github.com/chriskyfung/AutoFetcher-IG-Stories-to-GDrive/pull/107
[#108]: https://github.com/chriskyfung/AutoFetcher-IG-Stories-to-GDrive/pull/108
[#109]: https://github.com/chriskyfung/AutoFetcher-IG-Stories-to-GDrive/pull/109
[#110]: https://github.com/chriskyfung/AutoFetcher-IG-Stories-to-GDrive/pull/110

### Documentation

- Corrected the permalink URLs of "Release Notes" and "Advanced Configurations"
pages.
- Updated API endpoint URLs for status badges.
- Enhanced formatting of H2 headers in release notes:

- Eliminated build numbers from H2 headers.
- Enclosed release dates with parentheses.

- Refined and styled the changelog.

### CI/CD Integration

- Implemented automated version updates via Dependabot.
- Upgraded github/codeql-action (1 → 3) and actions/checkout (2 → 4) in
`codeql-analysis.yml`

* * *

Expand Down
27 changes: 17 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,26 +14,20 @@ your Google Drive. You don’t need to install anything on your computer or
phone, just use Google Sheets and Google Apps Script as a cloud tool to fetch
the Stories you want.

> [!NOTE]
> **Release On 2023-02-16**
> Thanks for the contributions from [hidehiro98](https://github.com/hidehiro98)
> We can now save downloaded files from different IG users to separate Google
> Drive folders 📁.
> [!IMPORTANT]
> **Release On 2024-02-05**
> **Release On 2024-03-15**
> To use the latest features and bug fixes, please update the Library Version of
> your Google Script to the latest one or create a new copy of the Google Sheet
> template with the name V9 or higher.
> template with the name V10 or higher.
> [!TIP]
> **Manual upgrade from V8 to V9**
> **Manual upgrade from V8 to V9 or higher**
> If you prefer to keep your existing Google Sheet file, you can manually update
> the Apps Script by following these steps:
>
> 1. Open the Apps Script editor from your Google Sheet file.
> 2. In the left panel, click on the **IGStoriesToGDrive** library under the **Libraries** section.
> 3. From the **Version** dropdown, select **9** and click **Save**.
> 3. From the **Version** dropdown, select **10** and click **Save**.
> 4. Delete the `ui.gs` file from the project files.
> 5. Open the `code.gs` file and add the following code to enable the new features.
>
Expand All @@ -49,6 +43,12 @@ the Stories you want.
> }
> ```
> [!NOTE]
> **Release On 2023-02-16**
> Thanks for the contributions from [hidehiro98](https://github.com/hidehiro98)
> We can now save downloaded files from different IG users to separate Google
> Drive folders 📁.
## 🗄️ Table of Contents

- [Introduction](#-introduction)
Expand Down Expand Up @@ -106,6 +106,13 @@ The spreadsheet consists of the following three sheets:
| Logs | A log sheet that records the file download activities. |
| Settings | A tabular form where you can fill in the values of options and parameters for running the script. |

> [!NOTE]
> With Library V10, the script now leverages the time zone setting configured in Google Sheets, ensuring accurate
timestamps irrespective of your geographical location. To modify the time zone for a specific spreadsheet, please
refer to this [Google Support page]. By aligning the script with your spreadsheet's time zone, you can seamlessly manage tasks and track time entries with utmost precision.

[Google Support page]: https://support.google.com/docs/answer/58515

You can use the Google Sheet file and bind our script to it in the following
ways:

Expand Down
104 changes: 60 additions & 44 deletions dist/bundle.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
*
* Homepage: https://chriskyfung.github.io/AutoFetcher-IG-Stories-to-GDrive/
*
* Build at: Wed, 13 Mar 2024 05:45:49 GMT
* Build at: Fri, 15 Mar 2024 06:01:06 GMT
*/

const IGSF = Object.create(null);
Expand Down Expand Up @@ -150,6 +150,7 @@ function loadSettings() {
* Last modified : 2021-11-02
*/


/**
* Create badges, namely "last-tested-date.svg" and a "last-tested-status.svg",
* in the destination folder of your Google Drive using DriveApp service.
Expand Down Expand Up @@ -242,6 +243,7 @@ function setHealthStatusBadge(healthy) {
* Last updated at : 2023-02-21
*/


const numOfColumns = 5;
const column = {
filename: 5,
Expand All @@ -251,27 +253,37 @@ const column = {
let previousLogs;

/**
* Insert and record the date time, username, media URL and file type to be
* downloaded to a new row at the start of the Google Sheet file that the
* Apps Script is bounded to.
* @param {String} datetime A date time in string format.
* @param {String} username An Instagram username
* @param {String} url A media URL
* @param {String} filetype The extension of the downloaded file
* @param {String} filename The filename of the downloaded file
* This function inserts a new log entry into the "Logs" sheet in a Google
* Sheets document. The log entry includes the datetime, username, URL,
* filetype, and filename. It formats the datetime, inserts a new row below the
* header, writes the log data to the new row, and inserts checkboxes into the
* respective column.
* @param {Date} datetime - The date and time of the log entry
* @param {string} username - TheInstagram username
* @param {string} url - The media URL
* @param {string} filetype - The extension of the downloaded file
* @param {string} filename - The filename of the downloaded file
*/
function insertNewLog(datetime, username, url, filetype, filename) {
// TODO: fix #84 logging blank file name
// Get the sheet to store the log data.
const logsSheet = SpreadsheetApp.getActive().getSheetByName(
sheetNames['logs']
const spreadsheet = SpreadsheetApp.getActive();
const logsSheet = spreadsheet.getSheetByName(sheetNames['logs']);

// Use spreadsheet methods to get the desired date format and time zone
const formattedDateTime = Utilities.formatDate(
datetime,
spreadsheet.getSpreadsheetTimeZone(),
'yyyy-MM-dd HH:mm:ss'
);
// Insert a blank row in a sheet below the header.

// Insert a new row below the header
logsSheet.insertRows(2);
// Write the log data to the new row.

// Write the log data to the new row
logsSheet
.getRange(2, 1, 1, numOfColumns)
.setValues([[datetime, username, url, filetype, filename]]);
.setValues([[formattedDateTime, username, url, filetype, filename]]);

// Insert checkboxes into the respective column (column.selected)
logsSheet.getRange(2, column.selected).insertCheckboxes();
}

Expand Down Expand Up @@ -553,6 +565,7 @@ const getFileDetails = (url) => {
* @author Chris K.Y. Fung <github.com/chriskyfung>
*/


/**
* Compose the URL and the query string to the Instagram's API endpoint.
* @param {String} igUserID The ID of the target Instagram user to fetch.
Expand Down Expand Up @@ -734,11 +747,11 @@ function fetch(target) {
return;
}
insertNewLog(
currentDatatime.toLocaleString(), // Datatime string
currentDatatime, // Date object
target.name, // IG username
url, // Full URL
fileExtension, // File extension
fileLink, // Linked file name
fileLink, // Linked file name
);
});
return msg;
Expand All @@ -761,32 +774,6 @@ function createViewFileFormula(filename, folderId) {
}
}

/**
* ui.js
* Copyright (c) 2024
*
* This file contains the Google Apps Script to create a custom menu in the
* Google Sheets when the spreadsheet opens.
*
* @author Chris K.Y. Fung <github.com/chriskyfung>
*/

function initUi(e) {
try {
let ui = SpreadsheetApp.getUi();
ui.createMenu('igFetcher')
.addItem('Fetch stories', 'run')
.addSubMenu(ui.createMenu('Logs')
.addItem('Move seleted files', 'moveSelected')
.addItem('Delete seleted logs', 'deleteSelected')
)
.addToUi();
} catch (err) {
// TODO (Developer) - Handle exception
Logger.log('Failed with error: %s', err.error);
}
}

/**
* subscriber.js
* Copyright (c) 2021
Expand All @@ -800,6 +787,7 @@ function initUi(e) {
* Last modified : 2021-11-02
*/


/**
* Get the listing from the Google Sheet that the Apps Script is bounded to,
* and then fetch Instagram Stories for each item.
Expand Down Expand Up @@ -833,6 +821,7 @@ function batchFetch() {
* Last modified : 2022-11-22
*/


/**
* Global variables
*/
Expand Down Expand Up @@ -921,6 +910,7 @@ function try_get() {
* Last modified : 2022-11-22
*/


const igUserSampleSet = [
{ name: 'bbcnews', id: '16278726' },
{ name: 'cnn', id: '217723373' },
Expand Down Expand Up @@ -962,6 +952,32 @@ function test_pipeline() {
return healthy;
}

/**
* ui.js
* Copyright (c) 2024
*
* This file contains the Google Apps Script to create a custom menu in the
* Google Sheets when the spreadsheet opens.
*
* @author Chris K.Y. Fung <github.com/chriskyfung>
*/

function initUi(e) {
try {
let ui = SpreadsheetApp.getUi();
ui.createMenu('igFetcher')
.addItem('Fetch stories', 'run')
.addSubMenu(ui.createMenu('Logs')
.addItem('Move seleted files', 'moveSelected')
.addItem('Delete seleted logs', 'deleteSelected')
)
.addToUi();
} catch (err) {
// TODO (Developer) - Handle exception
Logger.log('Failed with error: %s', err.error);
}
}

exports.badgeFileIds = badgeFileIds;
exports.batchFetch = batchFetch;
exports.createBadages = createBadages;
Expand Down
28 changes: 25 additions & 3 deletions docs/release-notes.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,28 @@ image:
hide: true
---

{:.note.tip}
> ## Library V10 (2024-03-15)
**Improved Reliability and Accuracy**

* Standardized log date and time format for enhanced clarity and consistency.
* Resolved an error related to file retrieval, ensuring seamless operation.

**Updated Dependencies for Enhanced Security and Functionality**

* Boosted security and functionality with the latest versions of jekyll, nokogiri, and other dependencies.

**Enhanced Documentation**

* Corrected website links for better navigation.
* Updated API endpoint URLs for accurate information.
* Refined formatting for clearer and easier-to-read documentation.

**Automated Versioning and Security Scans**

* Automated version updates through Dependabot, ensuring timely updates for enhanced security.
* Upgraded GitHub actions for improved code quality and vulnerability detection.

{:.note.tip}
> ## Library V9 (2024-02-05)
Expand Down Expand Up @@ -50,7 +72,7 @@ the Apps Script by following these steps:
}
```

✨ Features
New Features

- Add custom menu and menu items to Google Sheets

Expand Down Expand Up @@ -78,7 +100,7 @@ the Apps Script by following these steps:
{:.note.tip}
> ## Library V8 (2023-02-16)
✨ Feature
New Feature

- Save downloaded files to seperate folders based on their IG username. 📁

Expand Down Expand Up @@ -118,7 +140,7 @@ the Apps Script by following these steps:
{:.note.tip}
> ## Library V2 (2021-12-06)
✨ Features
New Features

- Save the filename of downloaded files in Column E in the "Logs" sheet.
- Show the thumbnail preview and open the file on Drive by hovering and clicking on a hyperlinked filename.
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "autofetcher-ig-stories-to-gdrive",
"version": "4.3.0",
"version": "4.3.1",
"description": "A no-code tool that lets you easily save the Instagram Stories of any user to your Google Drive",
"license": "AGPL-3.0",
"author": "Chris K.Y. Fung (https://github.com/chriskyfung)",
Expand Down

0 comments on commit 793d89e

Please sign in to comment.