Skip to content

Commit

Permalink
Refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
empeje committed Feb 8, 2025
1 parent 7f1f385 commit 41ebb1f
Show file tree
Hide file tree
Showing 10 changed files with 243 additions and 95 deletions.
25 changes: 24 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,25 @@
# Environment variables
.env
.env.local
.env.*.local

.env
# API keys and secrets
config.local.js

# Build files
dist/
build/
*.zip

# Dependencies
node_modules/

# IDE files
.idea/
.vscode/
*.sublime-project
*.sublime-workspace

# OS files
.DS_Store
Thumbs.db
79 changes: 79 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
# Variables
EXTENSION_NAME = purrspective
VERSION = $(shell grep '"version"' manifest.json | cut -d'"' -f4)
ZIP_NAME = $(EXTENSION_NAME)-$(VERSION).zip
BUILD_DIR = build

# Required files and directories
REQUIRED_FILES = \
manifest.json \
content.js \
background.js \
config.js \
popup/popup.html \
popup/popup.css \
popup/popup.js \
sidebar/sidebar.css \
icons/icon16.png \
icons/icon48.png \
icons/icon128.png

# Main build target
.PHONY: build
build: clean check-files
@echo "Building $(ZIP_NAME)..."
@mkdir -p $(BUILD_DIR)
@zip -r $(BUILD_DIR)/$(ZIP_NAME) $(REQUIRED_FILES) \
-x "*.DS_Store" \
-x "*.git*" \
-x "*.env*" \
-x "*node_modules*" \
-x "*.vscode*" \
-x "*.idea*"
@echo "✅ Build complete: $(BUILD_DIR)/$(ZIP_NAME)"

# Check if all required files exist
.PHONY: check-files
check-files:
@echo "Checking required files..."
@for file in $(REQUIRED_FILES); do \
if [ ! -e $$file ]; then \
echo "❌ Missing required file: $$file"; \
exit 1; \
fi \
done
@echo "✅ All required files present"

# Clean build directory
.PHONY: clean
clean:
@echo "Cleaning build directory..."
@rm -rf $(BUILD_DIR)
@echo "✅ Clean complete"

# Development build with source maps
.PHONY: dev
dev: clean check-files
@echo "Building development version..."
@mkdir -p $(BUILD_DIR)
@zip -r $(BUILD_DIR)/$(EXTENSION_NAME)-dev.zip . \
-x "*.DS_Store" \
-x "*.git*" \
-x "*.env*" \
-x "*node_modules*" \
-x "*.vscode*" \
-x "*.idea*" \
-x "$(BUILD_DIR)/*"
@echo "✅ Development build complete: $(BUILD_DIR)/$(EXTENSION_NAME)-dev.zip"

# Help target
.PHONY: help
help:
@echo "Available commands:"
@echo " make build - Create production zip for Chrome Web Store"
@echo " make dev - Create development zip with all source files"
@echo " make clean - Clean build directory"
@echo " make help - Show this help message"

# Default target
.DEFAULT_GOAL := help
108 changes: 25 additions & 83 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,96 +1,38 @@
# Perplexity Related Sites Extension
# PurrSpective

A browser extension that shows interesting related websites using the Perplexity Sonar API. The extension adds a collapsible sidebar to any webpage, displaying relevant websites based on the current page you're viewing.
A delightful Chrome extension that helps users evaluate webpage credibility and trustworthiness with the help of AI and cats! 😺

## Running Locally

### 1. Setup

1. Clone the repository:
```bash
git clone https://github.com/yourusername/perplexity-related-sites.git
cd perplexity-related-sites
```

2. Create a `.env` file in the root directory and add your Perplexity API key:
```
PERPLEXITY_API_KEY=your_api_key_here
```

### 2. Load in Chrome

1. Open Chrome browser
2. Go to `chrome://extensions/`
3. Enable "Developer mode" in the top right corner
4. Click "Load unpacked"
5. Select the extension directory (where your manifest.json is located)

### 3. Load in Firefox

1. Open Firefox browser
2. Go to `about:debugging#/runtime/this-firefox`
3. Click "Load Temporary Add-on"
4. Navigate to your extension directory and select `manifest.json`

### 4. Testing the Extension

1. After loading the extension, visit any website
2. You should see a small arrow button (←) on the right side of the page
3. Click the arrow to open the sidebar
4. The sidebar will show related websites based on your current page
5. Click the arrow again to close the sidebar

### 5. Development

To make changes during development:
## Features

1. Edit any file in the extension
2. For Chrome:
- Click the refresh icon on the extension card in `chrome://extensions/`
3. For Firefox:
- Click "Reload" next to the extension in `about:debugging`
- Real-time content analysis
- Credibility scoring
- Trust assessment
- Fact checking
- Related trustworthy sources
- Cute cat-themed interface

### 6. Debugging
## Installation

- Open browser's Developer Tools (F12)
- Check the Console tab for any error messages
- For Chrome, you can inspect the extension's background page from the extensions page
1. Visit the Chrome Web Store
2. Search for "PurrSpective"
3. Click "Add to Chrome"

## Features
## Usage

- 🔍 Uses Perplexity's Sonar-Pro API to find related websites
- 📱 Collapsible sidebar interface
- 🔄 Real-time suggestions based on current URL
- 🌐 Supports both Chrome and Firefox browsers
1. Click the PurrSpective cat icon in your toolbar
2. Enter your Perplexity API key
3. Browse any webpage and click the cat icon to analyze

## Project Structure
## Privacy

```
perplexity-related-sites/
├── manifest.json # Extension configuration
├── background.js # Background service worker
├── content.js # Main content script
├── config.js # Configuration management
├── .env # API key configuration (create this)
├── .gitignore # Git ignore file
└── sidebar/
├── sidebar.html # Sidebar HTML template
└── sidebar.css # Sidebar styles
```
- No user data is collected or stored
- API keys are stored locally
- All analysis is performed through secure API calls

## Troubleshooting
## Support

1. **API Key Issues**
- Make sure `.env` file exists and contains your API key
- Verify the API key is valid at Perplexity dashboard
- Check console for API-related errors
For support or feature requests, please open an issue on our GitHub repository.

2. **Extension Not Loading**
- Verify all files are in the correct location
- Check manifest.json for syntax errors
- Make sure Developer mode is enabled (Chrome)
## License

3. **Sidebar Not Appearing**
- Check if the content script is running (use console.log)
- Verify the CSS is being injected properly
- Check for JavaScript errors in the console
MIT License - See LICENSE file for details
Binary file added icons/icon128.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added icons/icon16.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added icons/icon32.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added icons/icon48.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
30 changes: 19 additions & 11 deletions manifest.json
Original file line number Diff line number Diff line change
@@ -1,28 +1,36 @@
{
"manifest_version": 3,
"name": "Perplexity Related Sites",
"version": "1.0",
"description": "Shows interesting related websites using Perplexity Sonar API",
"name": "PurrSpective",
"version": "1.0.0",
"description": "A cat-themed AI-powered content analyzer that helps evaluate webpage credibility and trustworthiness",
"icons": {
"16": "icons/icon16.png",
"48": "icons/icon48.png",
"128": "icons/icon128.png"
},
"action": {
"default_popup": "popup/popup.html",
"default_icon": {
"16": "icons/icon16.png",
"48": "icons/icon48.png",
"128": "icons/icon128.png"
}
},
"permissions": [
"activeTab",
"storage",
"scripting",
"tabs"
"storage"
],
"host_permissions": [
"https://api.perplexity.ai/*"
],
"action": {
"default_popup": "popup/popup.html"
},
"background": {
"service_worker": "background.js"
},
"content_scripts": [
{
"matches": ["<all_urls>"],
"css": ["sidebar/sidebar.css"],
"js": ["config.js", "content.js"]
"js": ["config.js", "content.js"],
"css": ["sidebar/sidebar.css"]
}
],
"web_accessible_resources": [
Expand Down
Empty file added popup/popup.css
Empty file.
96 changes: 96 additions & 0 deletions privacy-policy.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
# Privacy Policy for PurrSpective

**Last Updated:** [Current Date]

## Introduction

PurrSpective ("we", "our", or "us") is operated by PT Kulkul Teknologi Internasional, a company registered in Indonesia. This privacy policy explains how we handle information when you use our Chrome extension, PurrSpective.

## Contact Information

If you have any questions about this Privacy Policy, please contact us at:
- Email: [email protected]
- Company: PT Kulkul Teknologi Internasional
- Location: Indonesia

## Information Collection and Use

### API Key Storage
- Users provide their Perplexity API key to use the extension
- The API key is stored locally in the browser's storage
- We do not collect, store, or have access to your API key

### Webpage Analysis
- The extension analyzes content from your currently active tab
- Content is sent directly to Perplexity AI using your provided API key
- Analysis results are displayed only to you and are not stored by us

### Data Processing
- All content analysis is performed through Perplexity AI's services
- By using your API key, you consent to sending webpage data to your Perplexity account
- We act solely as a facilitator between your browser and Perplexity AI

## Data Storage and Security

### Local Storage
- We store only:
- Your Perplexity API key (locally in your browser)
- Basic extension settings and preferences
- No data is stored on our servers

### Third-Party Services
- We use Perplexity AI for content analysis
- Your use of the extension is subject to Perplexity's privacy policy and terms of service
- We recommend reviewing Perplexity's privacy policy regarding API usage

## Purpose Limitation

PurrSpective's sole purpose is to augment your browsing experience by:
- Analyzing webpage credibility
- Providing trust assessments
- Facilitating fact-checking
- Suggesting related trustworthy sources

## User Rights and Choices

You have the right to:
- Remove your API key at any time
- Clear all locally stored data
- Uninstall the extension
- Request information about your data usage

## Changes to This Policy

We may update this privacy policy from time to time. We will notify users of any material changes by:
- Updating the "Last Updated" date
- Providing notification through the extension
- Posting notices on our GitHub repository

## Children's Privacy

PurrSpective is not intended for use by children under 13 years of age. We do not knowingly collect personal information from children under 13.

## Consent

By installing and using PurrSpective, you consent to:
- The local storage of your Perplexity API key
- The processing of webpage content through Perplexity AI
- The terms outlined in this privacy policy

## Data Protection

We implement appropriate technical and organizational measures to ensure a level of security appropriate to the risk, including:
- Local storage encryption
- Secure API communications
- No collection of personal data
- No tracking or analytics

## Contact Us

For any questions or concerns about this privacy policy or our privacy practices, please contact us at:
- Email: [email protected]
- Subject: PurrSpective Privacy Policy

---

© [Current Year] PT Kulkul Teknologi Internasional. All rights reserved.

0 comments on commit 41ebb1f

Please sign in to comment.