Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
108 changes: 108 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
name: "Bug Report"
description: "Submit a bug report to help us improve"
title: "[Bug]: "
labels: ["bug"]
body:
- type: markdown
attributes:
value: We value your time and your efforts to submit this bug report.
- type: textarea
id: description
validations:
required: true
attributes:
label: "Description"
description: "A clear and concise description of what the bug is."
placeholder: "It bugs out when ..."

- type: textarea
id: steps-to-reproduce
validations:
required: true
attributes:
label: "Reproduction steps"
description: "How do you trigger this bug? Please walk us through it step by step."
placeholder: "1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error"

- type: textarea
id: expected-behavior
validations:
required: true
attributes:
label: "Expected behavior"
description: "What did you think should happen?"
placeholder: "It should ..."

- type: textarea
id: actual-behavior
validations:
required: true
attributes:
label: "Actual Behavior with Screenshots"
description: "What did actually happen? Add screenshots, if applicable."
placeholder: "It actually ..."

- type: dropdown
id: operating-system
attributes:
label: "💻 Operating system"
description: "What OS is your app running on?"
options:
- Linux
- MacOS
- Windows
- Something else
validations:
required: true

- type: dropdown
id: browsers
attributes:
label: What browsers are you seeing the problem on?
multiple: true
options:
- Firefox
- Chrome
- Safari
- Microsoft Edge
- Something else

- type: textarea
id: additional-context
validations:
required: false
attributes:
label: "Provide any additional context for the Bug."
description: "Add any other context about the problem here."
placeholder: "It actually ..."

- type: textarea
id: logs
validations:
required: false
attributes:
label: Relevant log output
description: Please copy and paste any relevant log output. This will be automatically formatted into code, so no need for backticks.
render: shell

- type: checkboxes
id: no-duplicate-issues
attributes:
label: "Have you spent some time to check if this bug has been raised before?"
options:
- label: "I checked and didn't find similar issue"
required: true

- type: dropdown
id: willing-to-submit-pr
attributes:
label: 🔗 Are you willing to submit PR?
description: This is absolutely not required, but we are happy to guide you in the contribution process.
options:
- "Yes, I am willing to submit a PR!"
- "No"
validations:
required: false
48 changes: 48 additions & 0 deletions .github/ISSUE_TEMPLATE/docs_improvement.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: "Docs Improvement"
description: "Suggest improvements or additions to the documentation"
title: "[Docs]: "
labels: ["documentation"]
body:
- type: markdown
attributes:
value: Thanks for taking the time to help improve our documentation! Please provide the following details

- type: input
id: current_section
attributes:
label: "Current Section"
description: "Which section of the documentation needs improvement?"
placeholder: "e.g., Installation Guide"

- type: textarea
id: improvement_suggestion
attributes:
label: "Improvement Suggestion"
description: "Describe the improvement or addition you are suggesting."
placeholder: "e.g., Add more details about setting up the environment."

- type: textarea
id: additional_context
attributes:
label: "Additional Context"
description: "Any additional context or information that might be helpful."
placeholder: "e.g., Links to related documentation, screenshots, etc."

- type: checkboxes
id: no-duplicate-issues
attributes:
label: "Have you spent some time to check if this issue has been raised before?"
options:
- label: "I checked and didn't find similar issue"
required: true

- type: dropdown
id: willing-to-submit-pr
attributes:
label: "Are you willing to submit PR?"
description: "This is absolutely not required, but we are happy to guide you in the contribution process."
options:
- "Yes I am willing to submit a PR!"
- "No"
validations:
required: true
63 changes: 63 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
name: Feature Request
description: "Submit a proposal for a new feature"
title: "[Feature]: "
labels: ["enhancement"]
body:
- type: markdown
attributes:
value: We value your time and your efforts to submit this feature request.

- type: textarea
id: feature-description
validations:
required: true
attributes:
label: "Feature description"
description: "A clear and concise description of what the feature is."
placeholder: "You should add ..."

- type: textarea
id: pitch
validations:
required: false
attributes:
label: "Why is this feature needed ?"
description: "Please explain why this feature should be implemented and how it would be used. Add examples, if applicable."
placeholder: "In my use-case, ..."

- type: textarea
id: solution
validations:
required: false
attributes:
label: "How do you aim to achieve this?"
description: "A clear and concise description of what you want to happen."
placeholder: "I want this feature to, ..."

- type: textarea
id: alternative
validations:
required: false
attributes:
label: "Additional Information"
description: "A clear and concise description of any alternative solutions or additional solutions you've considered."
placeholder: "I tried, ..."

- type: checkboxes
id: no-duplicate-issues
attributes:
label: "Have you spent some time to check if this feature request has been raised before?"
options:
- label: "I checked and didn't find similar issue"
required: true

- type: dropdown
id: willing-to-submit-pr
attributes:
label: Are you willing to submit PR?
description: This is absolutely not required, but we are happy to guide you in the contribution process.
options:
- "Yes I am willing to submit a PR!"
- "No"
validations:
required: true
38 changes: 38 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
## Description
Briefly describe the purpose of this pull request and the changes introduced.

## Type of Change
Select the relevant option(s):

- [ ] Bug fix
- [ ] New feature
- [ ] Documentation update
- [ ] Code improvement or refactor
- [ ] UI/UX update
- [ ] Other (please specify)

## Related Issue
Link any related issue(s):
`Closes #issue-number` or `Related to #issue-number`

## Implementation Details
Summarize the technical changes made and their purpose.

## Testing
Describe how the changes were tested and verified.

> Example:
> - Run `npm run dev` and verify new section loads correctly.
> - Tested responsive layout on desktop and mobile.

## Checklist
Please ensure the following before submitting:

- [ ] Code follows project guidelines and conventions
- [ ] Changes tested locally and working as intended
- [ ] Documentation updated if required
- [ ] Linked related issue (if applicable)
- [ ] Commits are clear and descriptive

## Additional Notes
Provide any additional context or dependencies reviewers should know.
90 changes: 88 additions & 2 deletions scripts/content.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,85 @@ function getDirectDownloadLink(driveLink) {
return null;
}

function cleanFileName(fileName) {
if (!fileName) return null;

// Trim whitespace first
let cleaned = fileName.trim();

// Remove common prefixes with flexible separators (spaces, colons, commas, hyphens)
cleaned = cleaned.replace(/^(Attachment[\s:,\-]*|PDF[\s:,\-]*|Word Document[\s:,\-]*|Microsoft Word[\s:,\-]*|Microsoft Excel[\s:,\-]*|Microsoft PowerPoint[\s:,\-]*|Google Docs[\s:,\-]*|Google Sheets[\s:,\-]*|Google Slides[\s:,\-]*|Document[\s:,\-]*|Spreadsheet[\s:,\-]*|Presentation[\s:,\-]*)+/gi, '');

// Trim again after removing prefixes
cleaned = cleaned.trim();

// Replace spaces with underscores
cleaned = cleaned.replace(/\s+/g, '_');

// Remove any invalid filename characters
cleaned = cleaned.replace(/[<>:"\/\\|?*]/g, '');

// Ensure we still have a file extension
if (!cleaned.includes('.')) {
return null;
}

return cleaned;
}

function extractFileName(anchor) {
// Try multiple selector strategies to find the actual filename

// Strategy 1: Look for aria-label which often contains the full filename
const ariaLabel = anchor.getAttribute('aria-label');
if (ariaLabel && ariaLabel.trim() && ariaLabel.includes('.')) {
return ariaLabel.trim();
}

// Strategy 2: Look for title attribute
const title = anchor.getAttribute('title');
if (title && title.trim() && title.includes('.')) {
return title.trim();
}

// Strategy 3: Search all descendant divs for filename with extension
const allDivs = anchor.querySelectorAll('div');
for (const div of allDivs) {
const text = div.textContent.trim();
// Check if text contains a file extension
if (text && /\.[a-zA-Z0-9]{2,5}$/.test(text)) {
return text;
}
}

// Strategy 4: Try specific Google Classroom selectors
const secondDiv = anchor.querySelector('div:nth-child(2)');
if (secondDiv) {
const firstDivInsideSecondDiv = secondDiv.querySelector('div:nth-child(1)');
if (firstDivInsideSecondDiv) {
return firstDivInsideSecondDiv.textContent.trim();
const text = firstDivInsideSecondDiv.textContent.trim();
if (text && text.length > 0 && /\.[a-zA-Z0-9]{2,5}$/.test(text)) {
return text;
}
}
}

// Strategy 5: Look in parent container for filename
const parent = anchor.closest('[data-item-id]') || anchor.closest('div[role="listitem"]');
if (parent) {
const allText = parent.textContent;
const matches = allText.match(/([^\\/:"*?<>|]+\.[a-zA-Z0-9]{2,5})/g);
if (matches && matches.length > 0) {
// Return the first match that looks like a real filename
for (const match of matches) {
const cleaned = match.trim();
if (cleaned.length > 3) { // Minimum filename.ext length
return cleaned;
}
}
}
}

return null;
}

Expand All @@ -23,12 +94,27 @@ chrome.runtime.onMessage.addListener((request, sender, sendResponse) => {
const driveFiles = Array.from(document.querySelectorAll('a'))
.filter(a => a.href.includes("drive.google.com/file/d/"))
.map(a => {
const fileName = extractFileName(a);
let fileName = extractFileName(a);
const fileLink = getDirectDownloadLink(a.href);

// Clean the filename
fileName = cleanFileName(fileName);

// If we still don't have a filename with extension, use file ID as fallback
if (!fileName || !fileName.includes('.')) {
const fileIdMatch = a.href.match(/\/file\/d\/(.*?)\//);
if (fileIdMatch) {
fileName = `download_${fileIdMatch[1]}.file`;
}
}

console.log('Extracted:', { fileName, fileLink }); // Debug logging

return { name: fileName, link: fileLink };
})
.filter(file => file.link !== null && file.name !== null);

console.log('Total files found:', driveFiles.length); // Debug logging
sendResponse({ files: driveFiles });
}
});
Loading