GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Show help when app is start and new gtag events · allproxy/allproxy@0038f74

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • client/src
    • GTag.ts
    • components
      • Header.tsx
      • HelpDialog.tsx
      • JSONFieldsModal.tsx
    • store
      • JSONLogStore.ts
      • LayoutStore.ts
      • MessageQueueStore.ts
      • SocketStore.ts
  • server/src
    • SocketIoManager.ts
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎client/src/GTag.ts‎

Copy file name to clipboardExpand all lines: client/src/GTag.ts
+11Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,17 @@ export default class GTag {
1212
} else {
1313
ReactGA.initialize('G-H1NDQRZW8J');
1414
}
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);
1526
}
1627

1728
public static pageView(title: string) {
Collapse file

‎client/src/components/Header.tsx‎

Copy file name to clipboardExpand all lines: client/src/components/Header.tsx
+6-2Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ import { jsonLogStore, updateJSONRequestLabels } from '../store/JSONLogStore';
2424
import FilterBar from './FilterBar';
2525
import NotesModal from './NotesModal';
2626
import { urlPathStore } from '../store/UrlPathStore';
27+
import GTag from '../GTag';
2728

2829
let filterWasStopped = false;
2930

@@ -45,7 +46,7 @@ const Header = observer(({ socketStore, messageQueueStore, mainTabStore, filterS
4546
const [settingsMenuIcon, setSettingsMenuIcon] = React.useState<HTMLDivElement | null>(null);
4647
const [openExportDialog, setOpenExportDialog] = React.useState(false);
4748
const [openImportJSONFileDialog, setOpenImportJSONFileDialog] = React.useState(false);
48-
const [showHelp, setShowHelp] = React.useState(false);
49+
const [showHelp, setShowHelp] = React.useState(true);
4950
const [showDarkModeDialog, setShowDarkModeDialog] = React.useState(false);
5051
const [showNotesModal, setShowNotesModal] = React.useState(false);
5152
const [showJSONFieldsModal, setShowJSONFieldsModal] = React.useState(false);
@@ -93,7 +94,10 @@ const Header = observer(({ socketStore, messageQueueStore, mainTabStore, filterS
9394
}
9495
</span>
9596
}
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+
}}
97101
>
98102
<MenuItem
99103
value="allproxy"
Collapse file

‎client/src/components/HelpDialog.tsx‎

Copy file name to clipboardExpand all lines: client/src/components/HelpDialog.tsx
+5-1Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,10 @@ const HelpDialog = observer(({ open, onClose }: Props) => {
101101
<Tabs
102102
variant='scrollable'
103103
value={tabValue}
104-
onChange={(_, v) => setTabValue(v)}
104+
onChange={(_, v) => {
105+
setTabValue(v);
106+
GTag.selectItem('HelpDialog Tab', v);
107+
}}
105108
textColor="primary"
106109
indicatorColor="primary"
107110
aria-label="help-tabs"
@@ -124,6 +127,7 @@ const HelpDialog = observer(({ open, onClose }: Props) => {
124127
<button className="btn btn-lg btn-secondary"
125128
style={{ marginBottom: "1rem", background: getBrowserIconColor(browserName(browser)) }}
126129
onClick={() => {
130+
GTag.selectItem('Launch Browser', browser.name);
127131
browserStore.launchBrowser(browser);
128132
handleClose();
129133
}}>
Collapse file

‎client/src/components/JSONFieldsModal.tsx‎

Copy file name to clipboardExpand all lines: client/src/components/JSONFieldsModal.tsx
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ const JSONFieldsModal = observer(({ open, onClose, store, jsonFields, selectTab
3333

3434
function handleTabChange(_e: React.ChangeEvent<{}>, tabValue: 'jsonFields' | 'scripts' | 'showFields') {
3535
setTabValue(tabValue);
36+
GTag.selectContent('JSONFieldsModal', tabValue);
3637
}
3738

3839
function close() {
Collapse file

‎client/src/store/JSONLogStore.ts‎

Copy file name to clipboardExpand all lines: client/src/store/JSONLogStore.ts
+5Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import { compressJSON } from "./MainTabStore";
55
import { filterStore } from "./FilterStore";
66
import { urlPathStore } from "./UrlPathStore";
77
import { getPluginFunc } from "../Plugins";
8+
import GTag from "../GTag";
89

910
export const JSON_FIELDS_DIR = 'jsonFields';
1011
export const SCRIPTS_DIR = 'scripts';
@@ -171,6 +172,7 @@ export default class JSONLogStore {
171172
public async setParsingMethod(method: 'auto' | 'simple' | 'advanced' | 'plugin') {
172173
this.method = method;
173174
await apFileSystem.writeFile(SCRIPTS_DIR + '/method', method);
175+
GTag.selectItem('JSON Parse Method', method);
174176
}
175177

176178
public getAutoFields() { return this.autoFields; }
@@ -209,6 +211,7 @@ export default class JSONLogStore {
209211
@action public toggleBriefChecked() {
210212
this.briefChecked = !this.briefChecked;
211213
filterStore.filterUpdated();
214+
GTag.selectItem('Less Detail Checked', this.briefChecked + '');
212215
}
213216
public getBriefMap() {
214217
return this.briefMap;
@@ -223,6 +226,7 @@ export default class JSONLogStore {
223226
@action public toggleRawJsonChecked() {
224227
this.rawJsonChecked = !this.rawJsonChecked;
225228
filterStore.filterUpdated();
229+
GTag.selectItem('Show Raw JSON Checked', this.rawJsonChecked + '');
226230
}
227231

228232
public isShowUtcChecked() {
@@ -231,6 +235,7 @@ export default class JSONLogStore {
231235
@action public toggleShowUtcChecked() {
232236
this.showUtcChecked = !this.showUtcChecked;
233237
filterStore.filterUpdated();
238+
GTag.selectItem('UTC Time Checked', this.showUtcChecked + '');
234239
}
235240

236241
@action public async resetScriptToDefault() {
Collapse file

‎client/src/store/LayoutStore.ts‎

Copy file name to clipboardExpand all lines: client/src/store/LayoutStore.ts
+3Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { makeAutoObservable, action } from "mobx";
2+
import GTag from "../GTag";
23

34
export default class LayoutStore {
45
private verticalLayout = true;
@@ -13,6 +14,7 @@ export default class LayoutStore {
1314
}
1415
@action toggleNowrap() {
1516
this.nowrap = !this.nowrap;
17+
GTag.selectItem('No Wrap Checked', this.nowrap + '');
1618
}
1719

1820
public isVertical() {
@@ -24,6 +26,7 @@ export default class LayoutStore {
2426

2527
@action public toggleVertical() {
2628
this.verticalLayout = !this.verticalLayout;
29+
GTag.selectItem('Layout', this.verticalLayout ? 'vertical' : 'horizontal');
2730
}
2831

2932
public flexDirection() {
Collapse file

‎client/src/store/MessageQueueStore.ts‎

Copy file name to clipboardExpand all lines: client/src/store/MessageQueueStore.ts
+12Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import Message, { NO_RESPONSE } from '../common/Message';
33
import MessageStore from './MessageStore';
44
import { PROXY_TAB_NAME, mainTabStore } from './MainTabStore';
55
import { dateToHHMMSS } from "../components/Request";
6+
import GTag from "../GTag";
67

78
export const DEFAULT_LIMIT = 50000;
89
const LOCAL_STORAGE_LIMIT = 'allproxy-limit';
@@ -84,26 +85,32 @@ export default class MessageQueueStore {
8485
}
8586
@action public toggleShowTooltip() {
8687
this.showTooltip = !this.showTooltip;
88+
GTag.selectItem('Show Tooltip Checked', this.showTooltip + '');
8789
}
8890

8991
public getShowUserAgent() {
9092
return this.showUserAgent;
9193
}
9294
@action public toggleShowRequestUA() {
9395
this.showUserAgent = !this.showUserAgent;
96+
GTag.selectItem('Show User Agent Checked', this.showUserAgent + '');
9497
}
9598

9699
public getSortOrder() {
97100
return this.sortOrder;
98101
}
99102
@action public setSortOrder(order: "desc" | "asc") {
100103
this.sortOrder = order;
104+
GTag.selectItem('Sort Order', this.sortOrder);
101105
}
102106
public getSortByField() {
103107
return this.sortByField;
104108
}
105109
@action public setSortByField(field: string | undefined) {
106110
this.sortByField = field;
111+
if (field) {
112+
GTag.selectItem('Sort By Field', field);
113+
}
107114
}
108115
@action public sortOrderChanged() {
109116
this.sort();
@@ -124,10 +131,12 @@ export default class MessageQueueStore {
124131

125132
@action public setStopped(stopped: boolean) {
126133
this.stopped = stopped;
134+
GTag.selectItem('Capture Stopped', this.stopped + '');
127135
}
128136

129137
@action public toggleStopped() {
130138
this.stopped = !this.stopped;
139+
GTag.selectItem('Capture Stopped', this.stopped + '');
131140
}
132141

133142
public getScrollAction(): 'top' | 'bottom' | 'pageup' | 'pagedown' | 'filter' | undefined {
@@ -136,6 +145,9 @@ export default class MessageQueueStore {
136145

137146
@action public setScrollAction(action: 'top' | 'bottom' | 'pageup' | 'pagedown' | 'filter' | undefined) {
138147
this.scrollAction = action;
148+
if (action === 'top' || action === 'bottom') {
149+
GTag.selectItem('Scroll', action);
150+
}
139151
}
140152

141153
public getSortByReq(): boolean {
Collapse file

‎client/src/store/SocketStore.ts‎

Copy file name to clipboardExpand all lines: client/src/store/SocketStore.ts
+9Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -283,6 +283,15 @@ export default class SocketStore {
283283
});
284284
});
285285
}
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+
}
286295
}
287296

288297
export const socketStore = new SocketStore();
Collapse file

‎server/src/SocketIoManager.ts‎

Copy file name to clipboardExpand all lines: server/src/SocketIoManager.ts
+13Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,19 @@ export default class SocketIoManager {
200200
setOsBinaries(os);
201201
})
202202

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+
203216
socket.on('proxy config', (proxyConfigs: ProxyConfig[]) => {
204217
ConsoleLog.info(`${Paths.configJson()}:\n`, proxyConfigs);
205218
this.saveConfig(proxyConfigs);

0 commit comments

Comments
0 (0)
You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.