diff --git a/.github/workflows/alpha-server.yml b/.github/workflows/alpha-server.yml index 2b0ad9a..0ca25eb 100644 --- a/.github/workflows/alpha-server.yml +++ b/.github/workflows/alpha-server.yml @@ -4,6 +4,7 @@ on: push: branches: [ "alpha" ] paths: + - '.github/workflows/alpha-server.yml' - 'backend/**' - 'cli/**' - 'crypto-jvm/**' @@ -33,6 +34,11 @@ jobs: java-version: '21' distribution: 'temurin' cache: gradle - + - name: Cache Docker images. + uses: ScribeMD/docker-cache@0.5.0 + with: + key: docker-${{ runner.os }}-${{ hashFiles(paths) }} + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 - name: Build mini service run: ./scripts/build_scripts/build-service-on-ci.sh diff --git a/.github/workflows/alpha.yml b/.github/workflows/alpha.yml index ad5d544..e4a1251 100644 --- a/.github/workflows/alpha.yml +++ b/.github/workflows/alpha.yml @@ -4,6 +4,7 @@ on: push: branches: [ "alpha" ] paths: + - '.github/workflows/alpha.yml' - 'composeApp/**' - 'shared/**' - 'scripts/build_scripts/build-app-on-ci.sh' @@ -15,6 +16,12 @@ on: jobs: build: runs-on: ubuntu-latest + env: + # this will take the entire vars context configured in the repository > environments + # setting and convert it to JSON so we can automatically assign all the values to the + # runner's environment + VARS_CONTEXT: ${{ toJson(vars) }} + SECRETS_CONTEXT: ${{ toJson(secrets) }} steps: - uses: actions/checkout@v4 with: diff --git a/composeApp/src/commonMain/kotlin/com/storyteller_f/a/app/LoginPage.kt b/composeApp/src/commonMain/kotlin/com/storyteller_f/a/app/LoginPage.kt index 23b6ac9..7d3d409 100644 --- a/composeApp/src/commonMain/kotlin/com/storyteller_f/a/app/LoginPage.kt +++ b/composeApp/src/commonMain/kotlin/com/storyteller_f/a/app/LoginPage.kt @@ -138,25 +138,21 @@ fun InputPrivateKeyPage() { Button({ if (privateKey.isNotBlank()) { scope.launch { - globalDialogState.use(appNav::gotoHome) { - val data = client.getData() - val f = finalData(data) - val sig = signature(privateKey, f) - val publicKey = getDerPublicKeyFromPrivateKey(privateKey) - val ad = calcAddress(publicKey) - val u = when { - isSignUp -> client.signUp(publicKey, sig) - else -> client.signIn(ad, sig) - } - LoginViewModel.updateState(ClientSession.SignUpSuccess(privateKey, publicKey, ad)) - LoginViewModel.updateSession(data, sig) - LoginViewModel.updateUser(u) - storeToStorage() - } + signUpOrSignIn(appNav, privateKey, isSignUp) } } }) { - Text(if (isSignUp) stringResource(Res.string.start_sign_up) else stringResource(Res.string.start_sign_in)) + Text( + + stringResource( + if (isSignUp) { + Res.string.start_sign_up + } else { + Res.string.start_sign_in + } + ) + + ) } if (isSignUp) { Button({ @@ -172,6 +168,28 @@ fun InputPrivateKeyPage() { } } +private suspend fun signUpOrSignIn( + appNav: AppNav, + privateKey: String, + isSignUp: Boolean +) { + globalDialogState.use(appNav::gotoHome) { + val data = client.getData() + val f = finalData(data) + val sig = signature(privateKey, f) + val publicKey = getDerPublicKeyFromPrivateKey(privateKey) + val ad = calcAddress(publicKey) + val u = when { + isSignUp -> client.signUp(publicKey, sig) + else -> client.signIn(ad, sig) + } + LoginViewModel.updateState(ClientSession.SignUpSuccess(privateKey, publicKey, ad)) + LoginViewModel.updateSession(data, sig) + LoginViewModel.updateUser(u) + storeToStorage() + } +} + @OptIn(ExperimentalSerializationApi::class, ExperimentalSettingsApi::class) fun restoreFromStorage() { val loginUser = settings.decodeValueOrNull(LoginUser.serializer(), "login_user") ?: return diff --git a/composeApp/src/commonMain/kotlin/com/storyteller_f/a/app/community/CommunityPage.kt b/composeApp/src/commonMain/kotlin/com/storyteller_f/a/app/community/CommunityPage.kt index 3df2f3c..9e82198 100644 --- a/composeApp/src/commonMain/kotlin/com/storyteller_f/a/app/community/CommunityPage.kt +++ b/composeApp/src/commonMain/kotlin/com/storyteller_f/a/app/community/CommunityPage.kt @@ -241,7 +241,6 @@ private fun CommunityFloatingButton( if (community?.isJoined == true) { appNav.gotoTopicCompose(ObjectType.COMMUNITY, communityId) } else { - alertDialogState.showMessage(title, message) } }) { diff --git a/composeApp/src/commonMain/kotlin/com/storyteller_f/a/app/compontents/CommunityIcon.kt b/composeApp/src/commonMain/kotlin/com/storyteller_f/a/app/compontents/CommunityIcon.kt index f00fcc6..fe832f3 100644 --- a/composeApp/src/commonMain/kotlin/com/storyteller_f/a/app/compontents/CommunityIcon.kt +++ b/composeApp/src/commonMain/kotlin/com/storyteller_f/a/app/compontents/CommunityIcon.kt @@ -33,7 +33,7 @@ fun CommunityIcon( }) } else { Box( - modifier = Modifier.background(MaterialTheme.colorScheme.secondaryContainer, shape) + modifier = Modifier.background(MaterialTheme.colorScheme.tertiaryContainer, shape) .clip(shape) .size(iconSize) .clickable { diff --git a/composeApp/src/commonMain/kotlin/com/storyteller_f/a/app/search/CustomSearchBar.kt b/composeApp/src/commonMain/kotlin/com/storyteller_f/a/app/search/CustomSearchBar.kt index d5137d2..4c80ac3 100644 --- a/composeApp/src/commonMain/kotlin/com/storyteller_f/a/app/search/CustomSearchBar.kt +++ b/composeApp/src/commonMain/kotlin/com/storyteller_f/a/app/search/CustomSearchBar.kt @@ -113,18 +113,20 @@ fun CustomSearchBar(scope: SearchScope, leadingIcon: @Composable () -> Unit) { @Composable private fun SearchPlaceholder(scope: SearchScope) { Text( - stringResource(when (scope) { - SearchScope.World -> Res.string.input_search_topics_and_users - SearchScope.MyCommunity -> Res.string.input_search_community - SearchScope.MyRoom -> Res.string.input_search_topics - is SearchScope.CommunityTopic -> Res.string.input_search_topics - is SearchScope.CommunityRoom -> Res.string.input_search_room - is SearchScope.RoomTopic -> Res.string.input_search_topics - is SearchScope.TopicTopic -> Res.string.input_search_topics - is SearchScope.CommunityMember -> Res.string.input_search_members - is SearchScope.RoomMember -> Res.string.input_search_members - SearchScope.Member -> Res.string.input_search_members - }) + stringResource( + when (scope) { + SearchScope.World -> Res.string.input_search_topics_and_users + SearchScope.MyCommunity -> Res.string.input_search_community + SearchScope.MyRoom -> Res.string.input_search_topics + is SearchScope.CommunityTopic -> Res.string.input_search_topics + is SearchScope.CommunityRoom -> Res.string.input_search_room + is SearchScope.RoomTopic -> Res.string.input_search_topics + is SearchScope.TopicTopic -> Res.string.input_search_topics + is SearchScope.CommunityMember -> Res.string.input_search_members + is SearchScope.RoomMember -> Res.string.input_search_members + SearchScope.Member -> Res.string.input_search_members + } + ) ) } diff --git a/composeApp/src/commonMain/kotlin/com/storyteller_f/a/app/topic/TopicComposePage.kt b/composeApp/src/commonMain/kotlin/com/storyteller_f/a/app/topic/TopicComposePage.kt index d736f32..9d74576 100644 --- a/composeApp/src/commonMain/kotlin/com/storyteller_f/a/app/topic/TopicComposePage.kt +++ b/composeApp/src/commonMain/kotlin/com/storyteller_f/a/app/topic/TopicComposePage.kt @@ -69,7 +69,11 @@ private fun TopicComposeInternal( 3 } val state = rememberRichTextState() - val tabs = listOf(stringResource(Res.string.edit), stringResource(Res.string.preview), stringResource(Res.string.raw)) + val tabs = listOf( + stringResource(Res.string.edit), + stringResource(Res.string.preview), + stringResource(Res.string.raw) + ) val selected = pagerState.currentPage val coroutineScope = rememberCoroutineScope() diff --git a/scripts/build_scripts/build-app-on-ci.sh b/scripts/build_scripts/build-app-on-ci.sh index 39f4290..33e170f 100755 --- a/scripts/build_scripts/build-app-on-ci.sh +++ b/scripts/build_scripts/build-app-on-ci.sh @@ -27,7 +27,23 @@ EOF ./scripts/tool_scripts/modify-flavor.sh "$FLAVOR" "$IS_PROD" TEMP_FILE=./temp +# 解析SECRETS_CONTEXT 到文件 +# Pipe the JSON string into jq +echo "$SECRETS_CONTEXT" | +# Convert JSON object into an array of key-value pairs +jq -r 'to_entries | +# Map over each key-value pair +.[] | +# Format each pair as "KEY=VALUE" and append it all to the environment file +"\(.key)=\(.value)"' >> $TEMP_FILE +while IFS= read -r line; do + # Ignore empty lines and comments + [[ -z "$line" || "$line" =~ ^# ]] && continue + IFS='=' read -r key value <<< "$line" + export "$key"="$value" +done < $TEMP_FILE +#从文件写入环境变量 while IFS= read -r line; do # Ignore empty lines and comments [[ -z "$line" || "$line" =~ ^# ]] && continue