Skip to content

Commit 22ccc96

Browse files
committed
chore: update subproject commit and remove unused constants file from ten_manager
1 parent 1e1b8c5 commit 22ccc96

File tree

4 files changed

+44
-39
lines changed

4 files changed

+44
-39
lines changed

core/src/ten_manager/src/constants.rs renamed to core/src/ten_manager/src/constants/mod.rs

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -4,24 +4,9 @@
44
// Licensed under the Apache License, Version 2.0, with certain conditions.
55
// Refer to the "LICENSE" file in the root directory for more information.
66
//
7+
pub mod registry;
78

8-
// Go to https://ten-console.theten.ai/ to get user token.
9-
pub const DEFAULT_REGISTRY: &str =
10-
"https://ten-store.theten.ai/api/ten-cloud-store/v2/packages";
11-
12-
pub const CN_REGISTRY: &str =
13-
"https://registry-ten.rtcdeveloper.cn/api/ten-cloud-store/v2/packages";
14-
15-
pub const GITHUB_RELEASE_URL: &str =
16-
"https://api.github.com/repos/TEN-framework/ten_framework/releases/latest";
17-
18-
pub const GITHUB_RELEASE_PAGE: &str =
19-
"https://github.com/TEN-framework/ten_framework/releases/latest";
20-
21-
// This comment is just for reference.
22-
//
23-
// pub const ADMIN_TOKEN: &str =
24-
// "cnRlX3N0b3JlOjNjYzc2ODgxYjExNjQ0NTM4ZDQ5YmNmNmNlYjQ2Yjk0";
9+
pub use registry::*;
2510

2611
pub const DOT_TEN_DIR: &str = ".ten";
2712
pub const APP_DIR_IN_DOT_TEN_DIR: &str = "app";
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
//
2+
// Copyright © 2025 Agora
3+
// This file is part of TEN Framework, an open source project.
4+
// Licensed under the Apache License, Version 2.0, with certain conditions.
5+
// Refer to the "LICENSE" file in the root directory for more information.
6+
//
7+
8+
// Go to https://ten-console.theten.ai/ to get user token.
9+
pub const DEFAULT_REGISTRY: &str =
10+
"https://ten-store.theten.ai/api/ten-cloud-store/v3/packages";
11+
12+
pub const CN_REGISTRY: &str =
13+
"https://registry-ten.rtcdeveloper.cn/api/ten-cloud-store/v3/packages";
14+
15+
pub const GITHUB_RELEASE_URL: &str =
16+
"https://api.github.com/repos/TEN-framework/ten_framework/releases/latest";
17+
18+
pub const GITHUB_RELEASE_PAGE: &str =
19+
"https://github.com/TEN-framework/ten_framework/releases/latest";
20+
21+
pub const ADMIN_TOKEN: &str = "admin-token";

core/src/ten_manager/src/registry/remote.rs

Lines changed: 20 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ use ten_rust::pkg_info::PkgInfo;
2525
use super::pkg_cache::{find_in_package_cache, store_file_to_package_cache};
2626
use crate::config::is_verbose;
2727
use crate::constants::{
28-
DEFAULT_REGISTRY_PAGE_SIZE, REMOTE_REGISTRY_MAX_RETRIES,
28+
ADMIN_TOKEN, DEFAULT_REGISTRY_PAGE_SIZE, REMOTE_REGISTRY_MAX_RETRIES,
2929
REMOTE_REGISTRY_REQUEST_TIMEOUT_SECS, REMOTE_REGISTRY_RETRY_DELAY_MS,
3030
};
3131
use crate::http::create_http_client_with_proxies;
@@ -155,7 +155,7 @@ async fn get_package_upload_info(
155155
if let Some(admin_token) = &tman_config.read().await.admin_token {
156156
let basic_token = format!("Basic {}", admin_token);
157157
headers.insert(
158-
AUTHORIZATION,
158+
ADMIN_TOKEN,
159159
basic_token.parse().map_err(|e| {
160160
out.error_line(&format!(
161161
"Failed to parse authorization token: {}",
@@ -170,26 +170,25 @@ async fn get_package_upload_info(
170170
}
171171
return Err(anyhow!("Admin token is required for packages with 'ten:' tags but is missing"));
172172
}
173-
} else {
174-
// Use user_token as before for regular packages.
175-
if let Some(user_token) = &tman_config.read().await.user_token {
176-
let basic_token = format!("Basic {}", user_token);
177-
headers.insert(
178-
AUTHORIZATION,
179-
basic_token.parse().map_err(|e| {
180-
out.error_line(&format!(
181-
"Failed to parse authorization token: {}",
182-
e
183-
));
173+
}
174+
175+
if let Some(user_token) = &tman_config.read().await.user_token {
176+
let basic_token = format!("Basic {}", user_token);
177+
headers.insert(
178+
AUTHORIZATION,
179+
basic_token.parse().map_err(|e| {
180+
out.error_line(&format!(
181+
"Failed to parse authorization token: {}",
184182
e
185-
})?,
186-
);
187-
} else {
188-
if is_verbose(tman_config.clone()).await {
189-
out.normal_line("Authorization token is missing");
190-
}
191-
return Err(anyhow!("Authorization token is missing"));
183+
));
184+
e
185+
})?,
186+
);
187+
} else {
188+
if is_verbose(tman_config.clone()).await {
189+
out.normal_line("Authorization token is missing");
192190
}
191+
return Err(anyhow!("Authorization token is missing"));
193192
}
194193

195194
let response = client
@@ -850,7 +849,7 @@ pub async fn delete_package(
850849
{
851850
let basic_token = format!("Basic {}", admin_token);
852851
headers.insert(
853-
AUTHORIZATION,
852+
ADMIN_TOKEN,
854853
basic_token.parse().map_err(|e| {
855854
out.error_line(&format!(
856855
"Failed to parse authorization token: {}",

0 commit comments

Comments
 (0)