GeezerVison is showing github.com — Show help when app is start and new gtag events · allproxy/allproxy@0038f74
File treeExpand file treeCollapse file tree Open diff view settings Expand file treeCollapse file tree Open diff view settings Collapse file Copy file name to clipboardExpand all lines: client/src/GTag.ts +11Lines changed: 11 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -12,6 +12,17 @@ export default class GTag { | 12 | 12 | } else { | 13 | 13 | ReactGA.initialize('G-H1NDQRZW8J'); | 14 | 14 | } | | 15 | + | | 16 | + setTimeout(async () => { | | 17 | + const { urlPathStore } = await import('./store/UrlPathStore'); | | 18 | + if (urlPathStore.isGitHubPages()) { | | 19 | + this.pageView('Package: Github Pages App'); | | 20 | + } else { | | 21 | + const { socketStore } = await import('./store/SocketStore'); | | 22 | + const type = await socketStore.emitGetInstallType(); | | 23 | + this.pageView('Package: ' + type); | | 24 | + } | | 25 | + }, 1000); | 15 | 26 | } | 16 | 27 |
| 17 | 28 | public static pageView(title: string) { | |
Collapse file Copy file name to clipboardExpand all lines: client/src/components/Header.tsx +6-2Lines changed: 6 additions & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -24,6 +24,7 @@ import { jsonLogStore, updateJSONRequestLabels } from '../store/JSONLogStore'; | 24 | 24 | import FilterBar from './FilterBar'; | 25 | 25 | import NotesModal from './NotesModal'; | 26 | 26 | import { urlPathStore } from '../store/UrlPathStore'; | | 27 | +import GTag from '../GTag'; | 27 | 28 |
| 28 | 29 | let filterWasStopped = false; | 29 | 30 |
| @@ -45,7 +46,7 @@ const Header = observer(({ socketStore, messageQueueStore, mainTabStore, filterS | 45 | 46 | const [settingsMenuIcon, setSettingsMenuIcon] = React.useState<HTMLDivElement | null>(null); | 46 | 47 | const [openExportDialog, setOpenExportDialog] = React.useState(false); | 47 | 48 | const [openImportJSONFileDialog, setOpenImportJSONFileDialog] = React.useState(false); | 48 | | - const [showHelp, setShowHelp] = React.useState(false); | | 49 | + const [showHelp, setShowHelp] = React.useState(true); | 49 | 50 | const [showDarkModeDialog, setShowDarkModeDialog] = React.useState(false); | 50 | 51 | const [showNotesModal, setShowNotesModal] = React.useState(false); | 51 | 52 | const [showJSONFieldsModal, setShowJSONFieldsModal] = React.useState(false); | @@ -93,7 +94,10 @@ const Header = observer(({ socketStore, messageQueueStore, mainTabStore, filterS | 93 | 94 | } | 94 | 95 | </span> | 95 | 96 | } | 96 | | - onChange={(e) => urlPathStore.setApp(e.target.value as 'allproxy' | 'mitmproxy' | 'jlogviewer')} | | 97 | + onChange={(e) => { | | 98 | + urlPathStore.setApp(e.target.value as 'allproxy' | 'mitmproxy' | 'jlogviewer'); | | 99 | + GTag.selectItem('Select App', e.target.value as string); | | 100 | + }} | 97 | 101 | > | 98 | 102 | <MenuItem | 99 | 103 | value="allproxy" | |
Collapse file Copy file name to clipboardExpand all lines: client/src/components/HelpDialog.tsx +5-1Lines changed: 5 additions & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -101,7 +101,10 @@ const HelpDialog = observer(({ open, onClose }: Props) => { | 101 | 101 | <Tabs | 102 | 102 | variant='scrollable' | 103 | 103 | value={tabValue} | 104 | | - onChange={(_, v) => setTabValue(v)} | | 104 | + onChange={(_, v) => { | | 105 | + setTabValue(v); | | 106 | + GTag.selectItem('HelpDialog Tab', v); | | 107 | + }} | 105 | 108 | textColor="primary" | 106 | 109 | indicatorColor="primary" | 107 | 110 | aria-label="help-tabs" | @@ -124,6 +127,7 @@ const HelpDialog = observer(({ open, onClose }: Props) => { | 124 | 127 | <button className="btn btn-lg btn-secondary" | 125 | 128 | style={{ marginBottom: "1rem", background: getBrowserIconColor(browserName(browser)) }} | 126 | 129 | onClick={() => { | | 130 | + GTag.selectItem('Launch Browser', browser.name); | 127 | 131 | browserStore.launchBrowser(browser); | 128 | 132 | handleClose(); | 129 | 133 | }}> | |
Collapse file Copy file name to clipboardExpand all lines: client/src/components/JSONFieldsModal.tsx +1Lines changed: 1 addition & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -33,6 +33,7 @@ const JSONFieldsModal = observer(({ open, onClose, store, jsonFields, selectTab | 33 | 33 |
| 34 | 34 | function handleTabChange(_e: React.ChangeEvent<{}>, tabValue: 'jsonFields' | 'scripts' | 'showFields') { | 35 | 35 | setTabValue(tabValue); | | 36 | + GTag.selectContent('JSONFieldsModal', tabValue); | 36 | 37 | } | 37 | 38 |
| 38 | 39 | function close() { | |
Collapse file Copy file name to clipboardExpand all lines: client/src/store/JSONLogStore.ts +5Lines changed: 5 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -5,6 +5,7 @@ import { compressJSON } from "./MainTabStore"; | 5 | 5 | import { filterStore } from "./FilterStore"; | 6 | 6 | import { urlPathStore } from "./UrlPathStore"; | 7 | 7 | import { getPluginFunc } from "../Plugins"; | | 8 | +import GTag from "../GTag"; | 8 | 9 |
| 9 | 10 | export const JSON_FIELDS_DIR = 'jsonFields'; | 10 | 11 | export const SCRIPTS_DIR = 'scripts'; | @@ -171,6 +172,7 @@ export default class JSONLogStore { | 171 | 172 | public async setParsingMethod(method: 'auto' | 'simple' | 'advanced' | 'plugin') { | 172 | 173 | this.method = method; | 173 | 174 | await apFileSystem.writeFile(SCRIPTS_DIR + '/method', method); | | 175 | + GTag.selectItem('JSON Parse Method', method); | 174 | 176 | } | 175 | 177 |
| 176 | 178 | public getAutoFields() { return this.autoFields; } | @@ -209,6 +211,7 @@ export default class JSONLogStore { | 209 | 211 | @action public toggleBriefChecked() { | 210 | 212 | this.briefChecked = !this.briefChecked; | 211 | 213 | filterStore.filterUpdated(); | | 214 | + GTag.selectItem('Less Detail Checked', this.briefChecked + ''); | 212 | 215 | } | 213 | 216 | public getBriefMap() { | 214 | 217 | return this.briefMap; | @@ -223,6 +226,7 @@ export default class JSONLogStore { | 223 | 226 | @action public toggleRawJsonChecked() { | 224 | 227 | this.rawJsonChecked = !this.rawJsonChecked; | 225 | 228 | filterStore.filterUpdated(); | | 229 | + GTag.selectItem('Show Raw JSON Checked', this.rawJsonChecked + ''); | 226 | 230 | } | 227 | 231 |
| 228 | 232 | public isShowUtcChecked() { | @@ -231,6 +235,7 @@ export default class JSONLogStore { | 231 | 235 | @action public toggleShowUtcChecked() { | 232 | 236 | this.showUtcChecked = !this.showUtcChecked; | 233 | 237 | filterStore.filterUpdated(); | | 238 | + GTag.selectItem('UTC Time Checked', this.showUtcChecked + ''); | 234 | 239 | } | 235 | 240 |
| 236 | 241 | @action public async resetScriptToDefault() { | |
Collapse file Copy file name to clipboardExpand all lines: client/src/store/LayoutStore.ts +3Lines changed: 3 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 1 | 1 | import { makeAutoObservable, action } from "mobx"; | | 2 | +import GTag from "../GTag"; | 2 | 3 |
| 3 | 4 | export default class LayoutStore { | 4 | 5 | private verticalLayout = true; | @@ -13,6 +14,7 @@ export default class LayoutStore { | 13 | 14 | } | 14 | 15 | @action toggleNowrap() { | 15 | 16 | this.nowrap = !this.nowrap; | | 17 | + GTag.selectItem('No Wrap Checked', this.nowrap + ''); | 16 | 18 | } | 17 | 19 |
| 18 | 20 | public isVertical() { | @@ -24,6 +26,7 @@ export default class LayoutStore { | 24 | 26 |
| 25 | 27 | @action public toggleVertical() { | 26 | 28 | this.verticalLayout = !this.verticalLayout; | | 29 | + GTag.selectItem('Layout', this.verticalLayout ? 'vertical' : 'horizontal'); | 27 | 30 | } | 28 | 31 |
| 29 | 32 | public flexDirection() { | |
Collapse file Copy file name to clipboardExpand all lines: client/src/store/MessageQueueStore.ts +12Lines changed: 12 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -3,6 +3,7 @@ import Message, { NO_RESPONSE } from '../common/Message'; | 3 | 3 | import MessageStore from './MessageStore'; | 4 | 4 | import { PROXY_TAB_NAME, mainTabStore } from './MainTabStore'; | 5 | 5 | import { dateToHHMMSS } from "../components/Request"; | | 6 | +import GTag from "../GTag"; | 6 | 7 |
| 7 | 8 | export const DEFAULT_LIMIT = 50000; | 8 | 9 | const LOCAL_STORAGE_LIMIT = 'allproxy-limit'; | @@ -84,26 +85,32 @@ export default class MessageQueueStore { | 84 | 85 | } | 85 | 86 | @action public toggleShowTooltip() { | 86 | 87 | this.showTooltip = !this.showTooltip; | | 88 | + GTag.selectItem('Show Tooltip Checked', this.showTooltip + ''); | 87 | 89 | } | 88 | 90 |
| 89 | 91 | public getShowUserAgent() { | 90 | 92 | return this.showUserAgent; | 91 | 93 | } | 92 | 94 | @action public toggleShowRequestUA() { | 93 | 95 | this.showUserAgent = !this.showUserAgent; | | 96 | + GTag.selectItem('Show User Agent Checked', this.showUserAgent + ''); | 94 | 97 | } | 95 | 98 |
| 96 | 99 | public getSortOrder() { | 97 | 100 | return this.sortOrder; | 98 | 101 | } | 99 | 102 | @action public setSortOrder(order: "desc" | "asc") { | 100 | 103 | this.sortOrder = order; | | 104 | + GTag.selectItem('Sort Order', this.sortOrder); | 101 | 105 | } | 102 | 106 | public getSortByField() { | 103 | 107 | return this.sortByField; | 104 | 108 | } | 105 | 109 | @action public setSortByField(field: string | undefined) { | 106 | 110 | this.sortByField = field; | | 111 | + if (field) { | | 112 | + GTag.selectItem('Sort By Field', field); | | 113 | + } | 107 | 114 | } | 108 | 115 | @action public sortOrderChanged() { | 109 | 116 | this.sort(); | @@ -124,10 +131,12 @@ export default class MessageQueueStore { | 124 | 131 |
| 125 | 132 | @action public setStopped(stopped: boolean) { | 126 | 133 | this.stopped = stopped; | | 134 | + GTag.selectItem('Capture Stopped', this.stopped + ''); | 127 | 135 | } | 128 | 136 |
| 129 | 137 | @action public toggleStopped() { | 130 | 138 | this.stopped = !this.stopped; | | 139 | + GTag.selectItem('Capture Stopped', this.stopped + ''); | 131 | 140 | } | 132 | 141 |
| 133 | 142 | public getScrollAction(): 'top' | 'bottom' | 'pageup' | 'pagedown' | 'filter' | undefined { | @@ -136,6 +145,9 @@ export default class MessageQueueStore { | 136 | 145 |
| 137 | 146 | @action public setScrollAction(action: 'top' | 'bottom' | 'pageup' | 'pagedown' | 'filter' | undefined) { | 138 | 147 | this.scrollAction = action; | | 148 | + if (action === 'top' || action === 'bottom') { | | 149 | + GTag.selectItem('Scroll', action); | | 150 | + } | 139 | 151 | } | 140 | 152 |
| 141 | 153 | public getSortByReq(): boolean { | |
Collapse file Copy file name to clipboardExpand all lines: client/src/store/SocketStore.ts +9Lines changed: 9 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -283,6 +283,15 @@ export default class SocketStore { | 283 | 283 | }); | 284 | 284 | }); | 285 | 285 | } | | 286 | + | | 287 | + public emitGetInstallType(): Promise<string> { | | 288 | + return new Promise((resolve) => { | | 289 | + this.socket?.emit('get install type', | | 290 | + (type: string) => { | | 291 | + resolve(type); | | 292 | + }); | | 293 | + }); | | 294 | + } | 286 | 295 | } | 287 | 296 |
| 288 | 297 | export const socketStore = new SocketStore(); |
Collapse file Copy file name to clipboardExpand all lines: server/src/SocketIoManager.ts +13Lines changed: 13 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -200,6 +200,19 @@ export default class SocketIoManager { | 200 | 200 | setOsBinaries(os); | 201 | 201 | }) | 202 | 202 |
| | 203 | + socket.on('get install type', (callback: (type: string) => void) => { | | 204 | + var type = 'Electron'; | | 205 | + let headless = process.env.HEADLESS; | | 206 | + if (headless) { | | 207 | + if (process.env.npm_command === 'start') { | | 208 | + type = 'GitHub'; | | 209 | + } else { | | 210 | + type = 'NPM'; | | 211 | + } | | 212 | + } | | 213 | + callback(type); | | 214 | + }) | | 215 | + | 203 | 216 | socket.on('proxy config', (proxyConfigs: ProxyConfig[]) => { | 204 | 217 | ConsoleLog.info(`${Paths.configJson()}:\n`, proxyConfigs); | 205 | 218 | this.saveConfig(proxyConfigs); | |
|