Skip to content

Commit

Permalink
Next/clear browser data (#289)
Browse files Browse the repository at this point in the history
* fix: all app issues related new version api

* chore: bump version

* feat: support clear browser data
  • Loading branch information
Quorafind authored Nov 9, 2024
1 parent 714c106 commit 88de805
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 4 deletions.
2 changes: 1 addition & 1 deletion manifest.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"id": "surfing",
"name": "Surfing",
"version": "0.9.13",
"version": "0.9.14",
"minAppVersion": "1.4.0",
"description": "Surf the Net in Obsidian.",
"author": "Boninall & Windily-cloud",
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "surfing",
"version": "0.9.13",
"version": "0.9.14",
"description": "Use surfing to surf the net in Obsidian.",
"main": "main.js",
"scripts": {
Expand Down
30 changes: 30 additions & 0 deletions src/surfingIndex.ts
Original file line number Diff line number Diff line change
Expand Up @@ -477,6 +477,36 @@ export default class SurfingPlugin extends Plugin {
},
});


this.addCommand({
id: "clear-browsing-data",
name: "Clear browsing data",
callback: () => {
// @ts-ignore
const session = remote.session.fromPartition(
// @ts-ignore
`persist:surfing-vault-${this.app.appId}`
);
session
.clearStorageData({
storages: [
"appcache",
"cookies",
"filesystem",
"indexdb",
"localstorage",
"shadercache",
"websql",
"serviceworkers",
"cachestorage",
],
})
.then(() => {
new Notice("Browsing data cleared");
});
},
});

// Use checkCallback method to check if the view is WebBrowserView;
// And change the default private to public.
this.addCommand({
Expand Down
3 changes: 2 additions & 1 deletion src/surfingView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ import { hashCode } from "./component/BookmarkManager/utils";
import { PopoverWebView } from "./component/PopoverWebView";

export const WEB_BROWSER_VIEW_ID = "surfing-view";

export class SurfingView extends ItemView {
plugin: SurfingPlugin;
private searchBox: searchBox;
Expand Down Expand Up @@ -495,6 +494,8 @@ export class SurfingView extends ItemView {
// Allow views to replace this views.
this.navigation = true;



// Create search bar in the header bar.
this.headerBar = new HeaderBar(
this.titleContainerEl,
Expand Down
3 changes: 2 additions & 1 deletion versions.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,5 +59,6 @@
"0.9.10": "1.4.0",
"0.9.11": "1.4.0",
"0.9.12": "1.4.0",
"0.9.13": "1.4.0"
"0.9.13": "1.4.0",
"0.9.14": "1.4.0"
}

0 comments on commit 88de805

Please sign in to comment.