From f9ef9620ac90aa993326858596edc69987e25b26 Mon Sep 17 00:00:00 2001 From: josc146 Date: Wed, 15 Mar 2023 17:09:28 +0800 Subject: [PATCH] ChatGPTBox v2.0.0 --- .github/workflows/pre-release-build.yml | 6 +++++- .github/workflows/tagged-release.yml | 7 ++++++- package-lock.json | 4 ++-- package.json | 2 +- safari/appdmg.json | 4 ++-- safari/build.sh | 10 +++++----- safari/project.patch | 8 ++++---- src/content-script/site-adapters/youtube/index.mjs | 8 ++++++-- src/manifest.json | 6 +++--- src/manifest.v2.json | 6 +++--- src/popup/index.html | 2 +- 11 files changed, 38 insertions(+), 25 deletions(-) diff --git a/.github/workflows/pre-release-build.yml b/.github/workflows/pre-release-build.yml index 3f4dec52..a7981624 100644 --- a/.github/workflows/pre-release-build.yml +++ b/.github/workflows/pre-release-build.yml @@ -3,7 +3,7 @@ on: workflow_dispatch: # push: # branches: -# - main +# - master # paths: # - "src/**" # - "!src/**/*.json" @@ -11,6 +11,10 @@ on: # tags-ignore: # - "v*" +permissions: + id-token: "write" + contents: "write" + jobs: build_and_release: runs-on: ubuntu-22.04 diff --git a/.github/workflows/tagged-release.yml b/.github/workflows/tagged-release.yml index d7ba0a75..b8c7eb4f 100644 --- a/.github/workflows/tagged-release.yml +++ b/.github/workflows/tagged-release.yml @@ -4,6 +4,10 @@ on: tags: - "v*" +permissions: + id-token: "write" + contents: "write" + jobs: build_and_release: runs-on: macos-12 @@ -12,7 +16,7 @@ jobs: - run: echo "VERSION=${GITHUB_REF_NAME#v}" >> $GITHUB_ENV - uses: actions/checkout@v3 with: - ref: main + ref: master - name: Update manifest.json version uses: jossef/action-set-json-field@v2.1 @@ -29,6 +33,7 @@ jobs: value: ${{ env.VERSION }} - name: Push files + continue-on-error: true run: | git config --global user.email "github-actions[bot]@users.noreply.github.com" git config --global user.name "github-actions[bot]" diff --git a/package-lock.json b/package-lock.json index f3877779..a0ab4ca9 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,10 +1,10 @@ { - "name": "chat-gpt-search-engine-extension", + "name": "chatgptbox", "lockfileVersion": 3, "requires": true, "packages": { "": { - "name": "chat-gpt-search-engine-extension", + "name": "chatgptbox", "dependencies": { "@nem035/gpt-3-encoder": "^1.1.7", "@picocss/pico": "^1.5.6", diff --git a/package.json b/package.json index 71a53904..1b91c5ec 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,5 @@ { - "name": "chat-gpt-search-engine-extension", + "name": "chatgptbox", "scripts": { "build": "node build.mjs --production", "build:safari": "bash ./safari/build.sh", diff --git a/safari/appdmg.json b/safari/appdmg.json index 8cd181f5..9f1d3c60 100644 --- a/safari/appdmg.json +++ b/safari/appdmg.json @@ -1,8 +1,8 @@ { - "title": "chatGPT for Search Engine", + "title": "ChatGPTBox", "icon": "../src/logo.png", "contents": [ { "x": 448, "y": 344, "type": "link", "path": "/Applications" }, - { "x": 192, "y": 344, "type": "file", "path": "../build/chatGPT-for-Search-Engine.app" } + { "x": 192, "y": 344, "type": "file", "path": "../build/chatGPTBox.app" } ] } diff --git a/safari/build.sh b/safari/build.sh index cf869f5d..8095f813 100644 --- a/safari/build.sh +++ b/safari/build.sh @@ -1,10 +1,10 @@ xcrun safari-web-extension-converter ./build/firefox \ - --project-location ./build/safari --app-name chatGPT-for-Search-Engine \ - --bundle-identifier dev.josStorer.chatGPT-for-Search-Engine --force --no-prompt --no-open + --project-location ./build/safari --app-name chatGPTBox \ + --bundle-identifier dev.josStorer.chatGPTBox --force --no-prompt --no-open git apply safari/project.patch -xcodebuild archive -project ./build/safari/chatGPT-for-Search-Engine/chatGPT-for-Search-Engine.xcodeproj \ - -scheme "chatGPT-for-Search-Engine (macOS)" -configuration Release -archivePath ./build/safari/chatGPT-for-Search-Engine.xcarchive -xcodebuild -exportArchive -archivePath ./build/safari/chatGPT-for-Search-Engine.xcarchive \ +xcodebuild archive -project ./build/safari/chatGPTBox/chatGPTBox.xcodeproj \ + -scheme "chatGPTBox (macOS)" -configuration Release -archivePath ./build/safari/chatGPTBox.xcarchive +xcodebuild -exportArchive -archivePath ./build/safari/chatGPTBox.xcarchive \ -exportOptionsPlist ./safari/export-options.plist -exportPath ./build npm install -D appdmg rm ./build/safari.dmg diff --git a/safari/project.patch b/safari/project.patch index ff2f8a23..ee097ed3 100644 --- a/safari/project.patch +++ b/safari/project.patch @@ -1,5 +1,5 @@ ---- a/build/safari/chatGPT-for-Search-Engine/chatGPT-for-Search-Engine.xcodeproj/project.pbxproj -+++ b/build/safari/chatGPT-for-Search-Engine/chatGPT-for-Search-Engine.xcodeproj/project.pbxproj +--- a/build/safari/chatGPTBox/chatGPTBox.xcodeproj/project.pbxproj ++++ b/build/safari/chatGPTBox/chatGPTBox.xcodeproj/project.pbxproj @@ -825,7 +825,7 @@ "@executable_path/../../../../Frameworks", ); @@ -19,11 +19,11 @@ + ); ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; - CODE_SIGN_ENTITLEMENTS = "macOS (App)/chatGPT-for-Search-Engine.entitlements"; + CODE_SIGN_ENTITLEMENTS = "macOS (App)/chatGPTBox.entitlements"; @@ -887,6 +891,7 @@ GENERATE_INFOPLIST_FILE = YES; INFOPLIST_FILE = "macOS (App)/Info.plist"; - INFOPLIST_KEY_CFBundleDisplayName = "chatGPT-for-Search-Engine"; + INFOPLIST_KEY_CFBundleDisplayName = "chatGPTBox"; + INFOPLIST_KEY_LSApplicationCategoryType = "public.app-category.utilities"; INFOPLIST_KEY_NSMainStoryboardFile = Main; INFOPLIST_KEY_NSPrincipalClass = NSApplication; diff --git a/src/content-script/site-adapters/youtube/index.mjs b/src/content-script/site-adapters/youtube/index.mjs index c5b42456..8a2140d2 100644 --- a/src/content-script/site-adapters/youtube/index.mjs +++ b/src/content-script/site-adapters/youtube/index.mjs @@ -24,7 +24,10 @@ export default { }) ).text() - let subtitleUrl = docText.substring(docText.indexOf('https://www.youtube.com/api/timedtext')) + const subtitleUrlStartAt = docText.indexOf('https://www.youtube.com/api/timedtext') + if (subtitleUrlStartAt === -1) return + + let subtitleUrl = docText.substring(subtitleUrlStartAt) subtitleUrl = subtitleUrl.substring(0, subtitleUrl.indexOf('"')) subtitleUrl = subtitleUrl.replaceAll('\\u0026', '&') @@ -32,6 +35,7 @@ export default { title = title.substring(0, title.indexOf('","')) const subtitleResponse = await fetch(subtitleUrl) + if (!subtitleResponse.ok) return let subtitleData = await subtitleResponse.text() let subtitleContent = '' @@ -44,7 +48,7 @@ export default { return cropText( `Provide a brief summary of the video using concise language and incorporating the video title.` + - `The video title is:"${title}".The subtitle content is as follows:\n${subtitleContent}`, + `The video title is:"${title}".The subtitle content is as follows:\n${subtitleContent}`, ) } catch (e) { console.log(e) diff --git a/src/manifest.json b/src/manifest.json index 0b04e0df..f34bd895 100644 --- a/src/manifest.json +++ b/src/manifest.json @@ -1,7 +1,7 @@ { - "name": "ChatGPT for Search Engine", - "description": "Display ChatGPT response alongside Search Engine results", - "version": "1.26.1", + "name": "ChatGPTBox", + "description": "Integrating ChatGPT into your browser deeply, everything you need is here", + "version": "2.0.0", "manifest_version": 3, "icons": { "16": "logo.png", diff --git a/src/manifest.v2.json b/src/manifest.v2.json index 20621a4d..32da5fa3 100644 --- a/src/manifest.v2.json +++ b/src/manifest.v2.json @@ -1,7 +1,7 @@ { - "name": "ChatGPT for Search Engine", - "description": "Display ChatGPT response alongside Search Engine results", - "version": "1.26.1", + "name": "ChatGPTBox", + "description": "Integrating ChatGPT into your browser deeply, everything you need is here", + "version": "2.0.0", "manifest_version": 2, "icons": { "16": "logo.png", diff --git a/src/popup/index.html b/src/popup/index.html index 8323aa0a..e0dc93d8 100644 --- a/src/popup/index.html +++ b/src/popup/index.html @@ -1,6 +1,6 @@ - ChatGPT for Search Engine + ChatGPTBox