@be-link/cos 1.12.9 → 1.12.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/upload.js +13 -11
- package/package.json +1 -1
package/bin/upload.js
CHANGED
|
@@ -62,9 +62,11 @@ async function getTempCredentials(mode) {
|
|
|
62
62
|
|
|
63
63
|
try {
|
|
64
64
|
const response = await fetch(url, { method: 'POST' });
|
|
65
|
+
console.error('🔐 响应:', response);
|
|
65
66
|
const result = await response.json();
|
|
66
67
|
const data = result?.data || {};
|
|
67
68
|
const credentials = data?.credentials;
|
|
69
|
+
console.error('🔐 结果:', result);
|
|
68
70
|
|
|
69
71
|
if (!credentials) {
|
|
70
72
|
throw new Error('获取临时密钥失败:返回数据格式错误');
|
|
@@ -116,21 +118,21 @@ async function initCOS() {
|
|
|
116
118
|
console.warn('⚠️ 临时密钥获取失败:', err.message);
|
|
117
119
|
console.warn('⚠️ 尝试使用环境变量 COS_SECRET_ID 和 COS_SECRET_KEY');
|
|
118
120
|
|
|
119
|
-
const secretId = process.env.COS_SECRET_ID;
|
|
120
|
-
const secretKey = process.env.COS_SECRET_KEY;
|
|
121
|
+
// const secretId = process.env.COS_SECRET_ID;
|
|
122
|
+
// const secretKey = process.env.COS_SECRET_KEY;
|
|
121
123
|
|
|
122
|
-
if (!secretId || !secretKey) {
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
}
|
|
124
|
+
// if (!secretId || !secretKey) {
|
|
125
|
+
// console.error('❌ 错误:未找到 COS 密钥配置');
|
|
126
|
+
// console.error(' 请设置环境变量:');
|
|
127
|
+
// console.error(' - COS_SECRET_ID');
|
|
128
|
+
// console.error(' - COS_SECRET_KEY');
|
|
129
|
+
// process.exit(1);
|
|
130
|
+
// }
|
|
129
131
|
|
|
130
132
|
console.log('✅ 使用环境变量中的密钥');
|
|
131
133
|
cos = new COS({
|
|
132
|
-
SecretId:
|
|
133
|
-
SecretKey:
|
|
134
|
+
SecretId: 'AKIDx3wfJo5e4FAqHSOJ5cu2y3zh9MK2Uhy6',
|
|
135
|
+
SecretKey: '3sgW7V7W1PZWIqAKI8krpY3JL9j5C3e1',
|
|
134
136
|
});
|
|
135
137
|
|
|
136
138
|
return cos;
|