{"id":18338848,"url":"https://github.com/tableflip/electron-window.ipfs","last_synced_at":"2025-04-09T20:36:02.109Z","repository":{"id":72910492,"uuid":"126210973","full_name":"tableflip/electron-window.ipfs","owner":"tableflip","description":"Test repo to see if we can add `window.ipfs` to a web page bundled in electron","archived":false,"fork":false,"pushed_at":"2018-03-21T16:58:15.000Z","size":24,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-02-15T12:46:52.489Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"cc0-1.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tableflip.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-03-21T16:46:28.000Z","updated_at":"2018-03-21T16:58:17.000Z","dependencies_parsed_at":"2023-05-26T01:15:45.664Z","dependency_job_id":null,"html_url":"https://github.com/tableflip/electron-window.ipfs","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tableflip%2Felectron-window.ipfs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tableflip%2Felectron-window.ipfs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tableflip%2Felectron-window.ipfs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tableflip%2Felectron-window.ipfs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tableflip","download_url":"https://codeload.github.com/tableflip/electron-window.ipfs/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248108449,"owners_count":21049136,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-05T20:15:45.804Z","updated_at":"2025-04-09T20:36:02.083Z","avatar_url":"https://github.com/tableflip.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# electron-window.ipfs\n\n\u003e This is a test repo to see if we can add `window.ipfs` to a web page bundled in electron.\n\nIn this repo we're using the [`\u003cwebview\u003e`](https://electronjs.org/docs/api/webview-tag) tag in the renderer process to load up a web app from a URL.\n\n```html\n\u003cwebview\n  src=\"https://ipfs.io/ipfs/QmUmaEnH1uMmvckMZbh3yShaasvELPW4ZLPWnB4entMTEn/\"\n  preload=\"./webview.js\"\u003e\u003c/webview\u003e\n```\n\nThe web app makes use of `window.ipfs` if it is available.\n\nThe [`preload`](https://electronjs.org/docs/api/webview-tag#preload) attribute allows us to run a script on the `\u003cwebview\u003e` page before other scripts run. We use `preload` to create the `window.ipfs` object that the app can use.\n\n**webview.js**\n\n```js\nconst { ipcRenderer } = require('electron')\nconst { createProxyClient } = require('ipfs-postmsg-proxy')\n\nwindow.ipfs = createProxyClient({\n  postMessage: data =\u003e ipcRenderer.send('ipfs-postmsg-proxy:message', data),\n  addListener: (_, handler) =\u003e ipcRenderer.on('ipfs-postmsg-proxy:message', handler),\n  removeListener: (_, handler) =\u003e ipcRenderer.removeListener('ipfs-postmsg-proxy:message', handler),\n  getMessageData: (_, data) =\u003e data\n})\n```\n\nThe `window.ipfs` object is a proxy that uses IPC messaging to communicate with the IPFS node running in the main process. We're using [`ipfs-postmsg-proxy`](https://github.com/tableflip/ipfs-postmsg-proxy) for this.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftableflip%2Felectron-window.ipfs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftableflip%2Felectron-window.ipfs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftableflip%2Felectron-window.ipfs/lists"}