├── .gitignore
├── src
├── types
│ ├── index.ts
│ └── DOMMessages.ts
├── constants.ts
├── react-app-env.d.ts
├── chromeServices
│ └── DOMEvaluator.ts
├── logo.png
├── index.tsx
└── App.tsx
├── public
├── newtab.html
├── icons
│ └── favicon-180x180.png
├── background.js
└── manifest.json
├── tsconfig.node.json
├── README.md
├── package.json
├── index.html
├── tsconfig.json
├── LICENSE
└── vite.config.ts
/.gitignore:
--------------------------------------------------------------------------------
1 | **/.DS_Store
2 | build/
3 | node_modules/
--------------------------------------------------------------------------------
/src/types/index.ts:
--------------------------------------------------------------------------------
1 | export * from "./DOMMessages";
2 |
--------------------------------------------------------------------------------
/src/constants.ts:
--------------------------------------------------------------------------------
1 | export const YOUCHAT = "youchat";
2 |
--------------------------------------------------------------------------------
/src/react-app-env.d.ts:
--------------------------------------------------------------------------------
1 | ///
2 |
--------------------------------------------------------------------------------
/src/chromeServices/DOMEvaluator.ts:
--------------------------------------------------------------------------------
1 | import { DOMMessage, DOMMessageResponse } from "../types";
2 |
--------------------------------------------------------------------------------
/src/logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/You-OpenSource/You-Chrome-Extension/HEAD/src/logo.png
--------------------------------------------------------------------------------
/public/newtab.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | New tab
7 |
8 |
--------------------------------------------------------------------------------
/public/icons/favicon-180x180.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/You-OpenSource/You-Chrome-Extension/HEAD/public/icons/favicon-180x180.png
--------------------------------------------------------------------------------
/src/types/DOMMessages.ts:
--------------------------------------------------------------------------------
1 | export type DOMMessage = {
2 | type: "GET_DOM";
3 | };
4 |
5 | export type DOMMessageResponse = {
6 | negativeCount: number;
7 | positiveCount: number;
8 | };
9 |
--------------------------------------------------------------------------------
/src/index.tsx:
--------------------------------------------------------------------------------
1 | import React from "react";
2 | import App from "./App";
3 | import { createRoot } from 'react-dom/client';
4 |
5 | const root = createRoot(document.getElementById("root") as HTMLElement);
6 | root.render(
7 |
8 |
9 |
10 | );
11 |
--------------------------------------------------------------------------------
/tsconfig.node.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "composite": true,
4 | "skipLibCheck": true,
5 | "module": "ESNext",
6 | "moduleResolution": "bundler",
7 | "allowSyntheticDefaultImports": true,
8 | "types": ["node"]
9 | },
10 | "include": ["vite.config.ts"]
11 | }
12 |
13 |
--------------------------------------------------------------------------------
/src/App.tsx:
--------------------------------------------------------------------------------
1 | import React from "react";
2 |
3 | import { YOUCHAT } from "./constants";
4 |
5 | const handleSetSearchUrl = (
6 | domain: string,
7 | shouldOpenNewTab: boolean = true
8 | ) => {
9 | chrome.runtime.sendMessage(chrome.runtime.id, {
10 | domain: domain,
11 | shouldOpenNewTab: shouldOpenNewTab,
12 | });
13 | };
14 |
15 | function App() {
16 | React.useEffect(() => {
17 | handleSetSearchUrl(YOUCHAT, false);
18 | }, []);
19 |
20 | return null;
21 | }
22 |
23 | export default App;
24 |
--------------------------------------------------------------------------------
/public/background.js:
--------------------------------------------------------------------------------
1 | /*global chrome*/
2 |
3 | chrome.runtime.setUninstallURL("https://you.com/home");
4 |
5 | // Let the you.com website detect whether the extension is installed
6 | // Source: https://stackoverflow.com/a/21043701
7 | chrome.runtime.onMessageExternal.addListener(function (
8 | request,
9 | sender,
10 | sendResponse
11 | ) {
12 | if (request) {
13 | if (request.message) {
14 | if (request.message === "installed") {
15 | sendResponse(true);
16 | }
17 | }
18 | }
19 | return true;
20 | });
21 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # You-Chrome-Extension
2 |
3 | This Chrome extension sets [you.com](https://you.com/) as your default search engine.
4 |
5 | ## Use Extension:
6 |
7 | Download extension in the Chrome web store: https://chrome.google.com/webstore/detail/youcom-multi-engine-searc/fhplnehgjpmohhldfnjhibanpbiedofi
8 |
9 | ### **Development Setup:**
10 |
11 | 1. Download or clone this repo into a separate folder
12 | 2. run `npm install && npm run build`
13 | 3. Go to **chrome://extensions** in the Chrome address bar
14 | 4. At the top right, turn on **Developer mode**
15 | 5. Click **Load unpacked**
16 | 6. Find and select the build folder generated by step 2 at the top level of the repo
17 | 7. Celebrate
18 |
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "you-chrome-extension",
3 | "version": "3.0.2",
4 | "private": true,
5 | "scripts": {
6 | "dev": "vite",
7 | "build": "vite build",
8 | "preview": "vite preview",
9 | "prettier:fix": "prettier --write \"**/*.{js,tsx,ts,css,scss,jsx}\""
10 | },
11 | "dependencies": {
12 | "react": "^18.3.1",
13 | "react-dom": "^18.3.1"
14 | },
15 | "devDependencies": {
16 | "@types/chrome": "0.0.179",
17 | "@types/node": "^20.11.0",
18 | "@types/react-dom": "^18.3.5",
19 | "@vitejs/plugin-react": "^4.2.1",
20 | "typescript": "^4.9.5",
21 | "vite": "^5.1.0"
22 | },
23 | "overrides": {
24 | "esbuild": "^0.25.0"
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
12 |
13 |
14 | React App
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
--------------------------------------------------------------------------------
/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "target": "ES2020",
4 | "useDefineForClassFields": true,
5 | "lib": ["ES2020", "DOM", "DOM.Iterable"],
6 | "module": "ESNext",
7 | "skipLibCheck": true,
8 | "moduleResolution": "bundler",
9 | "allowImportingTsExtensions": true,
10 | "resolveJsonModule": true,
11 | "isolatedModules": true,
12 | "noEmit": true,
13 | "jsx": "react-jsx",
14 | "strict": true,
15 | "noUnusedLocals": true,
16 | "noUnusedParameters": true,
17 | "noFallthroughCasesInSwitch": true,
18 | "allowJs": true,
19 | "esModuleInterop": true,
20 | "allowSyntheticDefaultImports": true,
21 | "forceConsistentCasingInFileNames": true
22 | },
23 | "include": ["src"],
24 | "references": [{ "path": "./tsconfig.node.json" }]
25 | }
26 |
--------------------------------------------------------------------------------
/public/manifest.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "You.com: Default AI Search & Chat",
3 | "manifest_version": 3,
4 | "version": "3.0.2",
5 | "description": "Personalized AI that makes you more productive, creative, and extraordinary",
6 | "content_scripts": [
7 | {
8 | "matches": [""],
9 | "js": ["./static/js/content.js"]
10 | }
11 | ],
12 | "host_permissions": ["*://*/*"],
13 | "background": {
14 | "service_worker": "background.js"
15 | },
16 |
17 | "icons": {
18 | "180": "icons/favicon-180x180.png"
19 | },
20 |
21 | "chrome_settings_overrides": {
22 | "search_provider": {
23 | "name": "You.com",
24 | "keyword": "You.com",
25 | "search_url": "https://you.com/search?q={searchTerms}&fromExtension=true",
26 | "suggest_url": "https://you.com/api/ac?q={searchTerms}",
27 | "favicon_url": "https://you.com/favicon/favicon.ico",
28 | "encoding": "UTF-8",
29 | "is_default": true
30 | }
31 | },
32 |
33 | "externally_connectable": {
34 | "matches": ["*://localhost/*", "*://you.com/*", "*://*.you.com/*"]
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2022 You-OpenSource
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/vite.config.ts:
--------------------------------------------------------------------------------
1 | import { defineConfig } from 'vite';
2 | import react from '@vitejs/plugin-react';
3 | import path from 'path';
4 | import { fileURLToPath } from 'url';
5 |
6 | const __dirname = path.dirname(fileURLToPath(import.meta.url));
7 |
8 | export default defineConfig({
9 | plugins: [react()],
10 | build: {
11 | outDir: 'build',
12 | rollupOptions: {
13 | input: {
14 | main: path.resolve(__dirname, 'index.html'),
15 | content: path.resolve(__dirname, 'src/chromeServices/DOMEvaluator.ts'),
16 | },
17 | output: {
18 | entryFileNames: (chunkInfo) => {
19 | // Content script should go to static/js/content.js
20 | if (chunkInfo.name === 'content') {
21 | return 'static/js/content.js';
22 | }
23 | // Main entry goes to static/js/main.js
24 | return 'static/js/[name].js';
25 | },
26 | chunkFileNames: 'static/js/[name]-[hash].js',
27 | assetFileNames: 'static/[ext]/[name]-[hash].[ext]',
28 | },
29 | },
30 | // Disable code splitting for Chrome extension compatibility
31 | chunkSizeWarningLimit: 1000,
32 | },
33 | publicDir: 'public',
34 | });
35 |
36 |
--------------------------------------------------------------------------------