Rename user-agent header to device-id
This commit is contained in:
parent
5448c1cf99
commit
70fe45a09d
8 changed files with 94 additions and 21 deletions
|
|
@ -44,6 +44,19 @@ export class SyncService {
|
|||
});
|
||||
}
|
||||
|
||||
private get deviceIdHeader(): string {
|
||||
// @ts-expect-error, injected by webpack
|
||||
const packageVersion = __CURRENT_VERSION__; // eslint-disable-line
|
||||
|
||||
const platform =
|
||||
typeof navigator !== "undefined"
|
||||
? navigator.platform // eslint-disable-line @typescript-eslint/no-deprecated
|
||||
: typeof process !== "undefined"
|
||||
? process.platform
|
||||
: "unknown";
|
||||
return `vault-link/${packageVersion} (${this.deviceId}; ${platform})`;
|
||||
}
|
||||
|
||||
private static formatError(
|
||||
error: components["schemas"]["SerializedError"]
|
||||
): string {
|
||||
|
|
@ -82,6 +95,9 @@ export class SyncService {
|
|||
params: {
|
||||
path: {
|
||||
vault_id: vaultName
|
||||
},
|
||||
header: {
|
||||
"device-id": this.deviceIdHeader
|
||||
}
|
||||
},
|
||||
// eslint-disable-next-line
|
||||
|
|
@ -135,6 +151,9 @@ export class SyncService {
|
|||
path: {
|
||||
vault_id: vaultName,
|
||||
document_id: documentId
|
||||
},
|
||||
header: {
|
||||
"device-id": this.deviceIdHeader
|
||||
}
|
||||
},
|
||||
// eslint-disable-next-line
|
||||
|
|
@ -175,8 +194,12 @@ export class SyncService {
|
|||
path: {
|
||||
vault_id: vaultName,
|
||||
document_id: documentId
|
||||
},
|
||||
header: {
|
||||
"device-id": this.deviceIdHeader
|
||||
}
|
||||
},
|
||||
|
||||
body: {
|
||||
relativePath,
|
||||
deviceId: this.deviceId
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ export interface paths {
|
|||
parameters: {
|
||||
query?: never;
|
||||
header: {
|
||||
"user-agent": string;
|
||||
"device-id": string;
|
||||
};
|
||||
path: {
|
||||
vault_id: string;
|
||||
|
|
@ -105,7 +105,7 @@ export interface paths {
|
|||
parameters: {
|
||||
query?: never;
|
||||
header: {
|
||||
"user-agent": string;
|
||||
"device-id": string;
|
||||
};
|
||||
path: {
|
||||
vault_id: string;
|
||||
|
|
@ -191,7 +191,7 @@ export interface paths {
|
|||
parameters: {
|
||||
query?: never;
|
||||
header: {
|
||||
"user-agent": string;
|
||||
"device-id": string;
|
||||
};
|
||||
path: {
|
||||
document_id: string;
|
||||
|
|
@ -232,7 +232,7 @@ export interface paths {
|
|||
parameters: {
|
||||
query?: never;
|
||||
header: {
|
||||
"user-agent": string;
|
||||
"device-id": string;
|
||||
};
|
||||
path: {
|
||||
document_id: string;
|
||||
|
|
@ -285,7 +285,7 @@ export interface paths {
|
|||
parameters: {
|
||||
query?: never;
|
||||
header: {
|
||||
"user-agent": string;
|
||||
"device-id": string;
|
||||
};
|
||||
path: {
|
||||
document_id: string;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
const path = require("path");
|
||||
const { merge } = require("webpack-merge");
|
||||
const webpack = require("webpack");
|
||||
const packageJson = require("./package.json");
|
||||
|
||||
const common = {
|
||||
entry: "./src/index.ts",
|
||||
|
|
@ -15,6 +17,11 @@ const common = {
|
|||
}
|
||||
]
|
||||
},
|
||||
plugins: [
|
||||
new webpack.DefinePlugin({
|
||||
__CURRENT_VERSION__: JSON.stringify(packageJson.version)
|
||||
})
|
||||
],
|
||||
optimization: {
|
||||
// the consuming project should take care of minification
|
||||
minimize: false
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue