Skip to content

Commit

Permalink
Provide activeHost for all pageAction
Browse files Browse the repository at this point in the history
  • Loading branch information
ruihildt committed Aug 22, 2023
1 parent 5549238 commit 8c66c29
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 33 deletions.
5 changes: 2 additions & 3 deletions src/components/Headers/ProxyHeader.vue
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
<script lang="ts" setup>
import { computed } from 'vue';
import { computed, inject, ref } from 'vue';
import { useRouter } from 'vue-router';
import { NIcon } from 'naive-ui';
import FeCog from '@/components/Icons/FeCog.vue';
import useActiveTab from '@/composables/useActiveTab';
const { currentRoute } = useRouter();
const { activeTabHost } = useActiveTab();
const { activeTabHost } = inject('activeTabHost', { activeTabHost: ref('') });
const pageTitle = computed(() => currentRoute.value.meta.title);
</script>
Expand Down
12 changes: 10 additions & 2 deletions src/pageaction/PageAction.vue
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
<script lang="ts" setup>
import { computed } from 'vue';
import { computed, provide } from 'vue';
import { useRoute } from 'vue-router';
import { NScrollbar } from 'naive-ui';
import ProxyHeader from '@/components/Headers/ProxyHeader.vue';
import SettingsHeader from '@/components/Headers/SettingsHeader.vue';
import useActiveTab from '@/composables/useActiveTab';
const { activeTabHost } = useActiveTab();
provide('activeTabHost', { activeTabHost });
const path = computed(() => {
return useRoute().path;
});
Expand All @@ -28,6 +33,9 @@ const path = computed(() => {

<style scoped>
header {
box-shadow: rgb(0 0 0 / 5%) 0 1px 2px 0, rgb(0 0 0 / 5%) 0 1px 4px 0, rgb(0 0 0 / 5%) 0 2px 8px 0;
box-shadow:
rgb(0 0 0 / 5%) 0 1px 2px 0,
rgb(0 0 0 / 5%) 0 1px 4px 0,
rgb(0 0 0 / 5%) 0 2px 8px 0;
}
</style>
28 changes: 0 additions & 28 deletions src/pageaction/views/Home.vue
Original file line number Diff line number Diff line change
@@ -1,42 +1,14 @@
<script lang="ts" setup>
// import { computed, inject, ref } from 'vue';
import CurrentProxyDetails from '@/components/CurrentProxyDetails.vue';
// import Button from '@/components/Buttons/Button.vue';
import useSocksProxy from '@/composables/useSocksProxy';
import useStore from '@/composables/useStore';
// const { activeTabHost } = inject('activeTabHost', { activeTabHost: ref('') });
// const { excludedHosts, customProxies } = useStore();
const { globalProxyDetails } = useStore();
const { globalProxyEnabled } = useSocksProxy();
// const isExcluded = computed(() => excludedHosts.value.includes(activeTabHost.value));
// const handleExclude = () => {
// // Add existing url to the exception list
// excludedHosts.value = [...excludedHosts.value, activeTabHost.value];
// // Remove any custom proxy
// const updatedcustomProxies = { ...customProxies.value };
// delete updatedcustomProxies[activeTabHost.value];
// customProxies.value = updatedcustomProxies;
// };
// const handleRemoveExclude = () => {
// excludedHosts.value = excludedHosts.value.filter((host) => host !== activeTabHost.value);
// };
</script>

<template>
<!-- <Button v-if="isExcluded" @click="handleRemoveExclude">Allow proxying for {{ activeTabHost }}</Button>
<Button v-else @click="handleExclude">Never proxy {{ activeTabHost }}</Button> -->

<CurrentProxyDetails v-if="globalProxyEnabled" :proxy-details="globalProxyDetails" />
<div v-else>No proxy currently in use</div>

<!-- <h1>Custom proxy</h1>
<Location /> -->
</template>

0 comments on commit 8c66c29

Please sign in to comment.