-
-
Notifications
You must be signed in to change notification settings - Fork 63
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3d59c00
commit 0cab8e5
Showing
16 changed files
with
556 additions
and
295 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
{"interval":"60","port":9998,"scrapingAnt":{"apiKey":"","proxy":"datacenter"},"workingHours":{"from":"","to":""}} | ||
{"interval":"60","port":9998,"scrapingAnt":{"apiKey":"","proxy":"datacenter"},"workingHours":{"from":"","to":""},"demoMode":false,"analyticsEnabled":null} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
export const DEFAULT_CONFIG = { | ||
'interval': '60', | ||
'port': 9998, | ||
'scrapingAnt': {'apiKey': '', 'proxy': 'datacenter'}, | ||
'workingHours': {'from': '', 'to': ''}, | ||
'demoMode': false, | ||
'analyticsEnabled': null | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import Mixpanel from 'mixpanel'; | ||
import {getJobs} from '../storage/jobStorage.js'; | ||
|
||
import {config} from '../../utils.js'; | ||
|
||
export const track = function () { | ||
//only send tracking information if the user allowed to do so. | ||
if (config.analyticsEnabled) { | ||
|
||
const mixpanelTracker = Mixpanel.init('718670ef1c58c0208256c1e408a3d75e'); | ||
|
||
const activeProvider = new Set(); | ||
const activeAdapter = new Set(); | ||
const platform = process.platform; | ||
const arch = process.arch; | ||
const language = process.env.LANG || 'en'; | ||
const nodeVersion = process.version || 'N/A'; | ||
|
||
const jobs = getJobs(); | ||
|
||
if (jobs != null && jobs.length > 0) { | ||
jobs.forEach(job => { | ||
job.provider.forEach(provider => { | ||
activeProvider.add(provider.id); | ||
}); | ||
job.notificationAdapter.forEach(adapter => { | ||
activeAdapter.add(adapter.id); | ||
}); | ||
}); | ||
|
||
mixpanelTracker.track('fredy_tracking', { | ||
adapter: Array.from(activeAdapter), | ||
provider: Array.from(activeProvider), | ||
isDemo: config.demoMode, | ||
platform, | ||
arch, | ||
nodeVersion, | ||
language | ||
}); | ||
} | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
import React from 'react'; | ||
import {Modal} from '@douyinfe/semi-ui'; | ||
import Logo from '../logo/Logo.jsx'; | ||
import {xhrPost} from '../../services/xhr.js'; | ||
|
||
import './TrackingModal.less'; | ||
|
||
const saveResponse = async (analyticsEnabled) => { | ||
await xhrPost('/api/admin/generalSettings', { | ||
analyticsEnabled | ||
}); | ||
}; | ||
|
||
export default function TrackingModal() { | ||
|
||
return <Modal | ||
visible={true} | ||
onOk={async () => { | ||
await saveResponse(true); | ||
location.reload(); | ||
}} | ||
onCancel={async () => { | ||
await saveResponse(false); | ||
location.reload(); | ||
}} | ||
maskClosable={false} | ||
closable={false} | ||
okText="Yes! I want to help" | ||
cancelText="No, thanks" | ||
> | ||
<Logo white/> | ||
<div className="trackingModal__description"> | ||
<p>Hey 👋</p> | ||
<p>Fed up with popups? Yeah, me too. But this one’s important, and I promise it will only appear once ;)</p> | ||
<p>Fredy is completely free (and will always remain free). If you’d like, you can support me by donating | ||
through my GitHub, but there’s absolutely no obligation to do so.</p> | ||
<p>However, it would be a huge | ||
help if you’d allow me to collect some analytical data. Wait, before you click “no,” let me explain. If | ||
you | ||
agree, Fredy will send a ping to my Mixpanel project each time it runs.</p> | ||
<p>The data includes: names of | ||
active adapters/providers, OS, architecture, Node version, and language. The information is entirely | ||
anonymous and helps me understand which adapters/providers are most frequently used.</p> | ||
<p>Thanks🤘</p> | ||
</div> | ||
</Modal>; | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
.trackingModal { | ||
&__description { | ||
margin-top:10rem; | ||
} | ||
} |
Oops, something went wrong.