Skip to content

Commit

Permalink
Merge pull request #3 from Termina/fix-safari
Browse files Browse the repository at this point in the history
fix chrome detection; upgrade deps
  • Loading branch information
NoEgAm authored Oct 9, 2024
2 parents 59ed739 + 9b0c712 commit ae11a0e
Show file tree
Hide file tree
Showing 7 changed files with 211 additions and 210 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/upload.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ jobs:
node-version: 20
cache: 'yarn'

- uses: calcit-lang/setup-cr@0.0.3
- uses: calcit-lang/setup-cr@0.0.7
with:
version: '0.9.1'
bundler: false

- name: "compiles to js"
run: >
Expand Down
6 changes: 3 additions & 3 deletions calcit.cirru

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion compact.cirru
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@
:defs $ {}
|chrome-extension? $ %{} :CodeEntry (:doc |)
:code $ quote
def chrome-extension? $ and (some? js/chrome) (some? js/chrome.runtime) (some? js/chrome.runtime.id)
def chrome-extension? $ and (some? js/window.chrome) (some? js/window.chrome.runtime) (some? js/window.chrome.runtime.id)
|dev? $ %{} :CodeEntry (:doc |)
:code $ quote
def dev? $ = "\"dev" (get-env "\"mode" "\"release")
Expand Down
1 change: 1 addition & 0 deletions deps.cirru
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@

{}
:calcit-version |0.9.5
:dependencies $ {}
|calcit-lang/lilac |main
|calcit-lang/memof |main
Expand Down
6 changes: 3 additions & 3 deletions extension/get-selected.mjs
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
export let get_selected = () => {
return new Promise((resolve, reject) => {
if (chrome?.runtime?.id == null) {
if (window.chrome?.runtime?.id == null) {
console.warn("not chrome extension runtime...");
resolve(null);
return;
}
console.log("calling content script...");
chrome.tabs
window.chrome.tabs
.query({ active: true, currentWindow: true })
.then((x) => {
let activeTab = x[0];
if (activeTab) {
let id = activeTab.id;
chrome.tabs.sendMessage(id, { get: "selected" }, function (response) {
window.chrome.tabs.sendMessage(id, { get: "selected" }, function (response) {
// 接收来自 content.js 的返回数据
// console.info('Content script returned: ' + response);
resolve(response);
Expand Down
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
{
"dependencies": {
"@calcit/procs": "^0.9.1",
"@google/generative-ai": "^0.16.0",
"axios": "^1.7.3",
"@calcit/procs": "^0.9.5",
"@google/generative-ai": "^0.20.0",
"axios": "^1.7.7",
"cirru-color": "^0.2.4",
"copy-text-to-clipboard": "^3.2.0"
},
"devDependencies": {
"bottom-tip": "^0.1.5",
"vite": "^5.3.5"
"vite": "^5.4.8"
},
"scripts": {
"build": "yarn vite build --base ./ && rm -rfv extension/dist && cp -vr dist extension/"
Expand Down
Loading

0 comments on commit ae11a0e

Please sign in to comment.