-
Notifications
You must be signed in to change notification settings - Fork 385
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* fix: 解决readme的冲突 * feat: 修改补充单测 (#437)
- Loading branch information
Showing
125 changed files
with
2,419 additions
and
1,133 deletions.
There are no files selected for viewing
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,22 @@ | ||
# Important Disclosure re:XIAOJUSURVEY Data Collection | ||
|
||
XIAOJUSURVEY is open-source software developed and maintained by XIAOJUSURVEY Team and available at https://github.com/didi/xiaoju-survey. | ||
We hereby state the purpose and reason for collecting data. | ||
|
||
## Purpose of data collection | ||
|
||
Data collected is used to help improve XIAOJUSURVEY for all users. It is important that our team understands the usage patterns as soon as possible, so we can best decide how to design future features and prioritize current work. | ||
|
||
## Types of data collected | ||
|
||
XIAOJUSURVEY just collects data about version's information. The data collected is subsequently reported to the XIAOJUSURVEY's backend services. | ||
|
||
All data collected will be used exclusively by the XIAOJUSURVEY team for analytical purposes only. The data will be neither accessible nor sold to any third party. | ||
|
||
## Sensitive data | ||
|
||
XIAOJUSURVEY will never collect and/or report sensitive information, such as private keys, API keys, or passwords. | ||
|
||
## How do I opt-in to or opt-out of data sharing? | ||
|
||
See [docs](https://xiaojusurvey.didi.cn/docs/next/community/%E6%95%B0%E6%8D%AE%E4%B8%8A%E6%8A%A5%E5%A3%B0%E6%98%8E) for information on configuring this functionality. |
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,20 @@ | ||
XIAOJU_SURVEY_MONGO_DB_NAME=xiaojuSurvey | ||
XIAOJU_SURVEY_MONGO_URL=mongodb://127.0.0.1:27017 | ||
XIAOJU_SURVEY_MONGO_AUTH_SOURCE=admin | ||
|
||
XIAOJU_SURVEY_REDIS_HOST= | ||
XIAOJU_SURVEY_REDIS_PORT= | ||
XIAOJU_SURVEY_REDIS_USERNAME= | ||
XIAOJU_SURVEY_REDIS_PASSWORD= | ||
XIAOJU_SURVEY_REDIS_DB= | ||
|
||
|
||
XIAOJU_SURVEY_RESPONSE_AES_ENCRYPT_SECRET_KEY=dataAesEncryptSecretKey | ||
XIAOJU_SURVEY_HTTP_DATA_ENCRYPT_TYPE=rsa | ||
|
||
XIAOJU_SURVEY_JWT_SECRET=xiaojuSurveyJwtSecret | ||
XIAOJU_SURVEY_JWT_EXPIRES_IN=8h | ||
|
||
XIAOJU_SURVEY_LOGGER_FILENAME=./logs/app.log | ||
|
||
XIAOJU_SURVEY_REPORT=true |
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,62 @@ | ||
import fs, { promises as fsa } from 'fs-extra'; | ||
import path from 'path'; | ||
import fetch from 'node-fetch'; | ||
|
||
interface PackageJson { | ||
type?: string; | ||
name?: string; | ||
version?: string; | ||
description?: string; | ||
id?: string; | ||
msg?: string; | ||
} | ||
|
||
const getId = () => { | ||
const id = new Date().getTime().toString(); | ||
process.env.XIAOJU_SURVEY_REPORT_ID = id; | ||
|
||
return id; | ||
}; | ||
|
||
const readData = async (directory: string): Promise<PackageJson | null> => { | ||
const packageJsonPath = path.join(directory, 'package.json'); | ||
const id = process.env.XIAOJU_SURVEY_REPORT_ID || getId(); | ||
try { | ||
if (!fs.existsSync(directory)) { | ||
return { | ||
type: 'server', | ||
name: '', | ||
version: '', | ||
description: '', | ||
id, | ||
msg: '文件不存在', | ||
}; | ||
} | ||
const data = await fsa.readFile(packageJsonPath, 'utf8').catch((e) => e); | ||
const { name, version, description } = JSON.parse(data) as PackageJson; | ||
return { type: 'server', name, version, description, id }; | ||
} catch (error) { | ||
return error; | ||
} | ||
}; | ||
|
||
(async (): Promise<void> => { | ||
if ( | ||
process.env.NODE_ENV === 'development' && | ||
!process.env.XIAOJU_SURVEY_REPORT | ||
) { | ||
return; | ||
} | ||
|
||
const res = await readData(path.join(process.cwd())); | ||
|
||
// 上报 | ||
fetch('https://xiaojusurveysrc.didi.cn/reportSourceData', { | ||
method: 'POST', | ||
headers: { | ||
Accept: 'application/json, */*', | ||
'Content-Type': 'application/json', | ||
}, | ||
body: JSON.stringify(res), | ||
}).catch(() => {}); | ||
})(); |
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,6 @@ | ||
export enum DOWNLOAD_TASK_STATUS { | ||
WAITING = 'waiting', // 排队中 | ||
COMPUTING = 'computing', // 计算中 | ||
SUCCEED = 'succeed', // 导出成功 | ||
FAILED = 'failed', // 导出失败 | ||
} |
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,4 @@ | ||
export enum SESSION_STATUS { | ||
ACTIVATED = 'activated', | ||
DEACTIVATED = 'deactivated', | ||
} |
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
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 was deleted.
Oops, something went wrong.
Oops, something went wrong.