Skip to content

Commit

Permalink
✨ feat(extension): enhance clipboard functionality and add filtered i…
Browse files Browse the repository at this point in the history
…nfo support
  • Loading branch information
s045pd committed Jan 4, 2025
1 parent 7eeb859 commit 12234b5
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 4 deletions.
21 changes: 17 additions & 4 deletions gui/src/components/DataCookies.vue
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@
>

<b-button
v-bind:data-clipboard-text="JSON.stringify(info)"
v-on:click="copy_toast"
@click="copyToClipboard"
>
<font-awesome-icon
:icon="['fas', 'clipboard']"
Expand Down Expand Up @@ -70,6 +69,7 @@ export default {
data() {
return {
info: [],
filteredInfo: [],
// boot cookies
cookies_search_word: "",
cookies_filterOn: ["domain", "name", "value"],
Expand Down Expand Up @@ -122,6 +122,19 @@ export default {
this.fetchData();
},
methods: {
copyToClipboard() {
const textToCopy = JSON.stringify(
this.cookies_search_word ? this.filteredInfo : this.info
);
navigator.clipboard.writeText(textToCopy)
.then(() => {
this.copy_toast();
})
.catch(err => {
console.error('Failed to copy text: ', err);
});
},
copy_toast() {
copy_toast();
},
Expand Down Expand Up @@ -157,8 +170,8 @@ export default {
},
on_cookies_filtered(filtered_items) {
this.cookies_page = 1;
this.bot_length_map[this.id_bot_selected]["cookies"] =
filtered_items.length;
this.filteredInfo = filtered_items;
this.bot_length_map[this.id_bot_selected]["cookies"] = filtered_items.length;
},
},
};
Expand Down
4 changes: 4 additions & 0 deletions gui/src/views/Main.vue
Original file line number Diff line number Diff line change
Expand Up @@ -590,6 +590,10 @@ export default {
response.bots.map((bot) => {
this.bots_map[bot.id] = bot;
});
// Update selected_bot if there's a bot currently selected
if (this.id_bot_selected) {
this.selected_bot = copy(this.bots_map?.[this.id_bot_selected] || {});
}
},
copy_toast() {
this.$toastr.s("Copied to clipboard successfully.");
Expand Down

0 comments on commit 12234b5

Please sign in to comment.