Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .env.development.example
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ ADMIN_PASSWORD=dev_admin_password

# ==================== CURRENCY CONFIGURATION ====================
# Base currency for the system (default: CNY)
# Supported: USD, EUR, GBP, CNY, JPY, CAD, AUD, TRY, HKD
# Supported: USD, EUR, GBP, CNY, JPY, CAD, AUD, TRY, HKD, INR
BASE_CURRENCY=CNY

# ==================== EXCHANGE RATE CONFIGURATION ====================
Expand Down
2 changes: 1 addition & 1 deletion .env.production.example
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ ADMIN_PASSWORD_HASH=
# PORT=3001

# Base currency for the system (default: CNY)
# Supported: USD, EUR, GBP, CNY, JPY, CAD, AUD, TRY, HKD
# Supported: USD, EUR, GBP, CNY, JPY, CAD, AUD, TRY, HKD, INR
# BASE_CURRENCY=CNY

# Database path (default: /app/data/database.sqlite in Docker)
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ A modern subscription management system that helps users easily manage and track

### Advanced Features
- ✅ **Automatic Renewal Processing** - Smart detection of expiring subscriptions with automatic updates
- ✅ **Multi-currency Support** - Real-time conversion for 9 major currencies (USD, EUR, GBP, CAD, AUD, JPY, CNY, TRY, HKD)
- ✅ **Multi-currency Support** - Real-time conversion for 9 major currencies (USD, EUR, GBP, CAD, AUD, JPY, CNY, TRY, HKD, INR)
- ✅ **Automatic Exchange Rate Updates** - Integrated with Tianapi for daily exchange rate updates
- ✅ **Expense Report Dashboard** - Comprehensive expense analysis and visualization
- ✅ **Payment History Tracking** - Complete payment records and historical analysis
Expand Down
2 changes: 1 addition & 1 deletion README.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@

### 高级功能
- ✅ **自动续费处理** - 智能检测到期订阅并自动更新
- ✅ **多币种支持** - 9种主要货币实时转换 (USD, EUR, GBP, CAD, AUD, JPY, CNY, TRY, HKD)
- ✅ **多币种支持** - 9种主要货币实时转换 (USD, EUR, GBP, CAD, AUD, JPY, CNY, TRY, HKD, INR)
- ✅ **汇率自动更新** - 集成天行数据API,每日更新汇率
- ✅ **费用报告仪表板** - 全面的费用分析和可视化
- ✅ **支付历史追踪** - 完整的支付记录和历史分析
Expand Down
44 changes: 33 additions & 11 deletions server/config/currencies.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
*/

// 所有支持的货币代码(固定不变)
const ALL_CURRENCY_CODES = ['USD', 'EUR', 'GBP', 'CAD', 'AUD', 'JPY', 'CNY', 'TRY', 'HKD'];
const ALL_CURRENCY_CODES = ['USD', 'EUR', 'GBP', 'CAD', 'AUD', 'JPY', 'CNY', 'TRY', 'HKD', 'INR'];

// 基础货币配置 - 从环境变量读取,默认为 CNY
let BASE_CURRENCY = process.env.BASE_CURRENCY || 'CNY';
Expand Down Expand Up @@ -34,7 +34,8 @@ const ALL_CURRENCIES = [
{ code: 'AUD', name: 'Australian Dollar', symbol: 'A$' },
{ code: 'JPY', name: 'Japanese Yen', symbol: '¥' },
{ code: 'TRY', name: 'Turkish Lira', symbol: '₺' },
{ code: 'HKD', name: 'Hong Kong Dollar', symbol: 'HK$' }
{ code: 'HKD', name: 'Hong Kong Dollar', symbol: 'HK$' },
{ code: 'HKD', name: 'Indian Rupee', symbol: '₹' }
];

/**
Expand All @@ -56,7 +57,8 @@ const BASE_RATES = {
AUD: 0.2077,
JPY: 16.9231,
TRY: 4.2000,
HKD: 1.1923
HKD: 1.1923,
INR: 12.4649
},
USD: {
USD: 1.0000,
Expand All @@ -67,7 +69,8 @@ const BASE_RATES = {
AUD: 1.3500,
JPY: 110.0000,
TRY: 27.0000,
HKD: 7.8000
HKD: 7.8000,
INR: 88.7520
},
EUR: {
EUR: 1.0000,
Expand All @@ -78,7 +81,8 @@ const BASE_RATES = {
AUD: 1.5882,
JPY: 129.4118,
TRY: 31.7647,
HKD: 9.1765
HKD: 9.1765,
INR: 104.0530
},
GBP: {
GBP: 1.0000,
Expand All @@ -89,7 +93,8 @@ const BASE_RATES = {
AUD: 1.8000,
JPY: 146.6667,
TRY: 36.0000,
HKD: 10.3333
HKD: 10.3333,
INR: 119.2906
},
CAD: {
CAD: 1.0000,
Expand All @@ -100,7 +105,8 @@ const BASE_RATES = {
AUD: 1.0800,
JPY: 88.0000,
TRY: 21.6000,
HKD: 6.2400
HKD: 6.2400,
INR: 63.7435
},
AUD: {
AUD: 1.0000,
Expand All @@ -111,7 +117,8 @@ const BASE_RATES = {
CAD: 0.9259,
JPY: 81.4815,
TRY: 20.0000,
HKD: 5.7778
HKD: 5.7778,
INR: 58.3085
},
JPY: {
JPY: 1.0000,
Expand All @@ -122,7 +129,8 @@ const BASE_RATES = {
CAD: 0.0114,
AUD: 0.0123,
TRY: 0.2455,
HKD: 0.0667
HKD: 0.0667,
INR: 0.5967
},
TRY: {
TRY: 1.0000,
Expand All @@ -133,7 +141,8 @@ const BASE_RATES = {
CAD: 0.0463,
AUD: 0.0500,
JPY: 4.0741,
HKD: 0.2889
HKD: 0.2889,
INR: 2.1348
},
HKD: {
HKD: 1.0000,
Expand All @@ -144,7 +153,20 @@ const BASE_RATES = {
CAD: 0.1603,
AUD: 0.1731,
JPY: 14.1026,
TRY: 3.4615
TRY: 3.4615,
INR: 11.4069
},
INR: {
INR: 1.0000,
USD: 0.0112,
CNY: 0.0802,
EUR: 0.0096,
GBP: 0.0083,
CAD: 0.0156,
AUD: 0.0171,
JPY: 1.6760,
TRY: 0.4683,
HKD: 0.0876
}
};

Expand Down
4 changes: 2 additions & 2 deletions server/db/schema.sql
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ INSERT OR IGNORE INTO payment_methods (value, label) VALUES

-- Insert default exchange rates (Base currency from application config)
-- Note: These rates should match BASE_CURRENCY configuration
-- Only supported currencies: USD, EUR, GBP, CAD, AUD, JPY, CNY, TRY, HKD
-- Only supported currencies: USD, EUR, GBP, CAD, AUD, JPY, CNY, TRY, HKD, INR
INSERT OR IGNORE INTO exchange_rates (from_currency, to_currency, rate) VALUES
('CNY', 'CNY', 1.0000),
('CNY', 'USD', 0.1538),
Expand All @@ -225,4 +225,4 @@ INSERT OR IGNORE INTO exchange_rates (from_currency, to_currency, rate) VALUES
('CNY', 'CAD', 0.1923),
('CNY', 'AUD', 0.2077),
('CNY', 'TRY', 4.2000),
('CNY', 'HKD', 1.1923);
('CNY', 'HKD', 1.1923);
1 change: 1 addition & 0 deletions src/components/ExchangeRateManager.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ export function ExchangeRateManager() {
<SelectItem value="JPY">JPY - {t('japaneseYen')}</SelectItem>
<SelectItem value="TRY">TRY - {t('turkishLira')}</SelectItem>
<SelectItem value="HKD">HKD - {t('hongKongDollar')}</SelectItem>
<SelectItem value="INR">INR - {t('indianRupee')}</SelectItem>
</SelectContent>
</Select>
<p className="text-sm text-muted-foreground mt-1">
Expand Down
4 changes: 2 additions & 2 deletions src/config/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ export const CURRENCY_NAMES: Record<CurrencyCode, string> = {
KRW: 'South Korean Won',
CAD: 'Canadian Dollar',
AUD: 'Australian Dollar',
INR: 'Indian Rupee',
TRY: 'Turkish Lira',
HKD: 'Hong Kong Dollar',
INR: 'Indian Rupee',
};

export const CURRENCY_SYMBOLS: Record<CurrencyCode, string> = {
Expand All @@ -24,9 +24,9 @@ export const CURRENCY_SYMBOLS: Record<CurrencyCode, string> = {
KRW: '₩',
CAD: 'C$',
AUD: 'A$',
INR: '₹',
TRY: '₺',
HKD: 'HK$',
INR: '₹',
};

// Chart colors
Expand Down
46 changes: 34 additions & 12 deletions src/config/currency.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
*/

// 支持的货币类型
export type CurrencyType = 'USD' | 'EUR' | 'GBP' | 'CAD' | 'AUD' | 'JPY' | 'CNY' | 'TRY' | 'HKD';
export type CurrencyType = 'USD' | 'EUR' | 'GBP' | 'CAD' | 'AUD' | 'JPY' | 'CNY' | 'TRY' | 'HKD' | 'INR';

// 所有支持的货币列表(固定不变)
const ALL_SUPPORTED_CURRENCIES: CurrencyType[] = ['USD', 'EUR', 'GBP', 'CAD', 'AUD', 'JPY', 'CNY', 'TRY', 'HKD'];
const ALL_SUPPORTED_CURRENCIES: CurrencyType[] = ['USD', 'EUR', 'GBP', 'CAD', 'AUD', 'JPY', 'CNY', 'TRY', 'HKD', 'INR'];

// 基础货币配置 - 修改这里就能改变整个系统的基础货币
export const BASE_CURRENCY: CurrencyType = 'CNY';
Expand All @@ -28,7 +28,8 @@ export const CURRENCY_INFO: Record<CurrencyType, { name: string; symbol: string
AUD: { name: 'Australian Dollar', symbol: 'A$' },
JPY: { name: 'Japanese Yen', symbol: '¥' },
TRY: { name: 'Turkish Lira', symbol: '₺' },
HKD: { name: 'Hong Kong Dollar', symbol: 'HK$' }
HKD: { name: 'Hong Kong Dollar', symbol: 'HK$' },
INR: { name: 'Indian Rupee', symbol: '₹' }
};

// 基础汇率配置 - 根据基础货币动态生成
Expand All @@ -42,7 +43,8 @@ const BASE_RATES: Record<CurrencyType, Record<CurrencyType, number>> = {
AUD: 0.2077,
JPY: 16.9231,
TRY: 4.2000,
HKD: 1.1923
HKD: 1.1923,
INR: 12.4649
},
USD: {
USD: 1,
Expand All @@ -53,7 +55,8 @@ const BASE_RATES: Record<CurrencyType, Record<CurrencyType, number>> = {
AUD: 1.3500,
JPY: 110.0000,
TRY: 27.0000,
HKD: 7.8000
HKD: 7.8000,
INR: 88.7520
},
EUR: {
EUR: 1,
Expand All @@ -64,7 +67,8 @@ const BASE_RATES: Record<CurrencyType, Record<CurrencyType, number>> = {
AUD: 1.5882,
JPY: 129.4118,
TRY: 31.7647,
HKD: 9.1765
HKD: 9.1765,
INR: 104.0530
},
GBP: {
GBP: 1,
Expand All @@ -75,7 +79,8 @@ const BASE_RATES: Record<CurrencyType, Record<CurrencyType, number>> = {
AUD: 1.8000,
JPY: 146.6667,
TRY: 36.0000,
HKD: 10.3333
HKD: 10.3333,
INR: 119.2906
},
CAD: {
CAD: 1,
Expand All @@ -86,7 +91,8 @@ const BASE_RATES: Record<CurrencyType, Record<CurrencyType, number>> = {
AUD: 1.0800,
JPY: 88.0000,
TRY: 21.6000,
HKD: 6.2400
HKD: 6.2400,
INR: 63.7435
},
AUD: {
AUD: 1,
Expand All @@ -97,7 +103,8 @@ const BASE_RATES: Record<CurrencyType, Record<CurrencyType, number>> = {
CAD: 0.9259,
JPY: 81.4815,
TRY: 20.0000,
HKD: 5.7778
HKD: 5.7778,
INR: 58.3085
},
JPY: {
JPY: 1,
Expand All @@ -108,7 +115,8 @@ const BASE_RATES: Record<CurrencyType, Record<CurrencyType, number>> = {
CAD: 0.0114,
AUD: 0.0123,
TRY: 0.2455,
HKD: 0.0667
HKD: 0.0667,
INR: 0.5967
},
TRY: {
TRY: 1,
Expand All @@ -119,7 +127,8 @@ const BASE_RATES: Record<CurrencyType, Record<CurrencyType, number>> = {
CAD: 0.0463,
AUD: 0.0500,
JPY: 4.0741,
HKD: 0.2889
HKD: 0.2889,
INR: 2.1348
},
HKD: {
HKD: 1,
Expand All @@ -130,7 +139,20 @@ const BASE_RATES: Record<CurrencyType, Record<CurrencyType, number>> = {
CAD: 0.1603,
AUD: 0.1731,
JPY: 14.1026,
TRY: 3.4615
TRY: 3.4615,
INR: 11.4069
},
INR: {
INR: 1.0000,
USD: 0.0112,
CNY: 0.0802,
EUR: 0.0096,
GBP: 0.0083,
CAD: 0.0156,
AUD: 0.0171,
JPY: 1.6760,
TRY: 0.4683,
HKD: 0.0876
}
};

Expand Down
1 change: 1 addition & 0 deletions src/i18n/locales/en/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@
"japaneseYen": "Japanese Yen",
"turkishLira": "Turkish Lira",
"hongKongDollar": "Hong Kong Dollar",
"indianRupee": "Indian Rupee",
"importSubscriptions": "Import Subscriptions",
"uploadCsvOrJson": "Upload a CSV or JSON file to import multiple subscriptions at once.",
"selectFile": "Select file",
Expand Down
1 change: 1 addition & 0 deletions src/i18n/locales/zh-CN/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@
"japaneseYen": "日元",
"turkishLira": "土耳其里拉",
"hongKongDollar": "港元",
"indianRupee": "印度盧比",
"importSubscriptions": "导入订阅",
"uploadCsvOrJson": "上传CSV或JSON文件以一次导入多个订阅。",
"selectFile": "选择文件",
Expand Down
2 changes: 1 addition & 1 deletion src/types/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ export interface DateRange {
}

// Currency types
export type CurrencyCode = 'USD' | 'EUR' | 'GBP' | 'CNY' | 'JPY' | 'KRW' | 'CAD' | 'AUD' | 'INR' | 'TRY' | 'HKD';
export type CurrencyCode = 'USD' | 'EUR' | 'GBP' | 'CNY' | 'JPY' | 'KRW' | 'CAD' | 'AUD' | 'TRY' | 'HKD' | 'INR';

// Chart data types
export interface ChartDataPoint {
Expand Down