Skip to content

Commit

Permalink
Merge branch 'main' of github.com:Postcatlab/postcat
Browse files Browse the repository at this point in the history
  • Loading branch information
buqiyuan committed Feb 16, 2023
2 parents 7f062d4 + 4bd7ea2 commit 3a2aab1
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 5 deletions.
2 changes: 1 addition & 1 deletion publish.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ qiniu.conf.ACCESS_KEY = AK;
qiniu.conf.SECRET_KEY = SK;

const toLatest = name => name.replace(/\d+\.\d+\.\d+/, 'latest');
const onlyName = name => name.replace(/build|release\//, '');
const onlyName = name => name.replace(/build\/|release\//, '');

// * 构建客户端实例
const client = new qiniu.rs.Client();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { Injectable } from '@angular/core';
// If you import a module but never use any of the imported values other than as TypeScript types,
// the resulting javascript file will look as if you never imported the module at all.
import { getSettings } from 'eo/workbench/browser/src/app/modules/system-setting/settings.service';
import { TraceService } from 'eo/workbench/browser/src/app/shared/services/trace.service';
import { getBrowserType } from 'eo/workbench/browser/src/app/utils/browser-type';
import StorageUtil from 'eo/workbench/browser/src/app/utils/storage/storage.utils';

Expand All @@ -18,7 +19,7 @@ type DescriptionsItem = {
})
export class ElectronService {
ipcRenderer;
constructor(private store: StoreService) {
constructor(private store: StoreService, private trace: TraceService) {
// Conditional imports
if (this.isElectron) {
// Notes :
Expand All @@ -33,6 +34,7 @@ export class ElectronService {
// https://www.electronjs.org/docs/latest/api/ipc-renderer#ipcrendererinvokechannel-args
this.ipcRenderer = window.electron.ipcRenderer;
}
this.trace.setUser({ client_type: this.isElectron ? 'client' : 'web' });
}

get isElectron(): boolean {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { Injectable } from '@angular/core';
import { ElectronService } from 'eo/workbench/browser/src/app/core/services/electron/electron.service';
import { LANGUAGES } from 'eo/workbench/browser/src/app/core/services/language/language.model';
import { SettingService } from 'eo/workbench/browser/src/app/modules/system-setting/settings.service';
import { TraceService } from 'eo/workbench/browser/src/app/shared/services/trace.service';
import { APP_CONFIG } from 'eo/workbench/browser/src/environments/environment';

@Injectable({
Expand All @@ -13,12 +14,13 @@ export class LanguageService {
// Web from nginx setting and App from computer system setting
systemLanguage;
langHashMap = new Map().set('zh-Hans', 'zh').set('en-US', 'en');
constructor(private electron: ElectronService, private setting: SettingService) {
constructor(private electron: ElectronService, private setting: SettingService, private trace: TraceService) {
//Curent language
this.systemLanguage =
this.languages.find(val => window.location.pathname.includes(`/${val.path}/`))?.value ||
this.setting.settings?.['system.language'] ||
(navigator.language.includes('zh') ? 'zh-Hans' : 'en-US');
this.trace.setUser({ app_language: this.systemLanguage });
}
get langHash() {
return this.langHashMap.get(this.systemLanguage);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import { StoreService } from '../../../shared/store/state.service';
<eo-ng-dropdown-menu #userMenu>
<ul nz-menu>
<li class="px-[12px] py-[5px] font-bold">
{{ store.getUserProfile?.userNickName }}
{{ store.getUserProfile?.email }}
</li>
<li nz-menu-item (click)="openSettingModal()" i18n>Account Setting</li>
<li nz-menu-item (click)="loginOut()" i18n>Sign Out</li>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -325,6 +325,7 @@ export class UserModalComponent implements OnInit, OnDestroy {
}
if (data.type == 1) {
// * register
this.trace.report('register_success');
this.trace.setUser({ register_way: this.hash.get(data.loginWay) });
}
this.store.setLoginInfo(data);
Expand Down Expand Up @@ -427,6 +428,7 @@ export class UserModalComponent implements OnInit, OnDestroy {
}
if (data.type == 1) {
// * register
this.trace.report('register_success');
this.trace.setUser({ register_way: this.hash.get(data.loginWay) });
}
this.store.setLoginInfo(data);
Expand Down
2 changes: 1 addition & 1 deletion upload.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ qiniu.conf.SECRET_KEY = SK;
const uptoken = (bucket, key) => new qiniu.rs.PutPolicy(bucket + ':' + key).token();

const toLatest = name => name.replace(/\d+\.\d+\.\d+/, 'latest');
const onlyName = name => name.replace(/build|release\//, '');
const onlyName = name => name.replace(/build\/|release\//, '');

// * 检测文件是否存在
const isExists = async filePath =>
Expand Down

0 comments on commit 3a2aab1

Please sign in to comment.