From ff27108a2ec967577a2a1fe5b5d6eade9b6bb3ee Mon Sep 17 00:00:00 2001 From: Steven Nguyen Date: Thu, 19 Sep 2024 12:58:48 -0700 Subject: [PATCH 1/5] fix(cli): use `||` instead of `??` because `getEndpoint()` can return "" Since the `??` operator only returns the right side if the left side is null or undefined, it will not work if `getEndpoint()` returns an empty string. `||`, however, will return the right side if the left side is an empty string. --- templates/cli/lib/commands/generic.js.twig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/cli/lib/commands/generic.js.twig b/templates/cli/lib/commands/generic.js.twig index c5abdebe3..0f9f9e225 100644 --- a/templates/cli/lib/commands/generic.js.twig +++ b/templates/cli/lib/commands/generic.js.twig @@ -14,7 +14,7 @@ const DEFAULT_ENDPOINT = 'https://cloud.appwrite.io/v1'; const loginCommand = async ({ email, password, endpoint, mfa, code }) => { const oldCurrent = globalConfig.getCurrentSession(); - const configEndpoint = endpoint ?? globalConfig.getEndpoint() ?? DEFAULT_ENDPOINT; + const configEndpoint = (endpoint ?? globalConfig.getEndpoint()) || DEFAULT_ENDPOINT; if (globalConfig.getCurrentSession() !== '') { log('You are currently signed in as ' + globalConfig.getEmail()); From e193223eaa76ba4174ce24810f69df6b886fa4b1 Mon Sep 17 00:00:00 2001 From: Evan Date: Tue, 24 Sep 2024 15:14:48 -0700 Subject: [PATCH 2/5] Adding autoclose workflow --- templates/android/.github/workflows/autoclose.yml | 11 +++++++++++ templates/apple/.github/workflows/autoclose.yml | 11 +++++++++++ templates/cli/.github/workflows/autoclose.yml | 11 +++++++++++ templates/dart/.github/workflows/autoclose.yml | 11 +++++++++++ templates/deno/.github/workflows/autoclose.yml | 11 +++++++++++ templates/dotnet/.github/workflows/autoclose.yml | 11 +++++++++++ templates/flutter/.github/workflows/autoclose.yml | 11 +++++++++++ templates/go/.github/workflows/autoclose.yml | 11 +++++++++++ templates/graphql/.github/workflows/autoclose.yml | 11 +++++++++++ templates/kotlin/.github/workflows/autoclose.yml | 11 +++++++++++ templates/node/.github/workflows/autoclose.yml | 11 +++++++++++ templates/php/.github/workflows/autoclose.yml | 11 +++++++++++ templates/python/.github/workflows/autoclose.yml | 11 +++++++++++ .../react-native/.github/workflows/autoclose.yml | 11 +++++++++++ templates/rest/.github/workflows/autoclose.yml | 11 +++++++++++ templates/ruby/.github/workflows/autoclose.yml | 11 +++++++++++ templates/swift/.github/workflows/autoclose.yml | 11 +++++++++++ templates/web/.github/workflows/autoclose.yml | 11 +++++++++++ 18 files changed, 198 insertions(+) create mode 100644 templates/android/.github/workflows/autoclose.yml create mode 100644 templates/apple/.github/workflows/autoclose.yml create mode 100644 templates/cli/.github/workflows/autoclose.yml create mode 100644 templates/dart/.github/workflows/autoclose.yml create mode 100644 templates/deno/.github/workflows/autoclose.yml create mode 100644 templates/dotnet/.github/workflows/autoclose.yml create mode 100644 templates/flutter/.github/workflows/autoclose.yml create mode 100644 templates/go/.github/workflows/autoclose.yml create mode 100644 templates/graphql/.github/workflows/autoclose.yml create mode 100644 templates/kotlin/.github/workflows/autoclose.yml create mode 100644 templates/node/.github/workflows/autoclose.yml create mode 100644 templates/php/.github/workflows/autoclose.yml create mode 100644 templates/python/.github/workflows/autoclose.yml create mode 100644 templates/react-native/.github/workflows/autoclose.yml create mode 100644 templates/rest/.github/workflows/autoclose.yml create mode 100644 templates/ruby/.github/workflows/autoclose.yml create mode 100644 templates/swift/.github/workflows/autoclose.yml create mode 100644 templates/web/.github/workflows/autoclose.yml diff --git a/templates/android/.github/workflows/autoclose.yml b/templates/android/.github/workflows/autoclose.yml new file mode 100644 index 000000000..4f2a8eedb --- /dev/null +++ b/templates/android/.github/workflows/autoclose.yml @@ -0,0 +1,11 @@ +name: Auto-close External Pull Requests + +on: + pull_request_target: + types: [opened, reopened] + +jobs: + auto_close: + uses: appwrite/.github/.github/workflows/autoclose.yml@main + secrets: + GH_AUTO_CLOSE_PR_TOKEN: ${{ secrets.GH_AUTO_CLOSE_PR_TOKEN }} \ No newline at end of file diff --git a/templates/apple/.github/workflows/autoclose.yml b/templates/apple/.github/workflows/autoclose.yml new file mode 100644 index 000000000..4f2a8eedb --- /dev/null +++ b/templates/apple/.github/workflows/autoclose.yml @@ -0,0 +1,11 @@ +name: Auto-close External Pull Requests + +on: + pull_request_target: + types: [opened, reopened] + +jobs: + auto_close: + uses: appwrite/.github/.github/workflows/autoclose.yml@main + secrets: + GH_AUTO_CLOSE_PR_TOKEN: ${{ secrets.GH_AUTO_CLOSE_PR_TOKEN }} \ No newline at end of file diff --git a/templates/cli/.github/workflows/autoclose.yml b/templates/cli/.github/workflows/autoclose.yml new file mode 100644 index 000000000..4f2a8eedb --- /dev/null +++ b/templates/cli/.github/workflows/autoclose.yml @@ -0,0 +1,11 @@ +name: Auto-close External Pull Requests + +on: + pull_request_target: + types: [opened, reopened] + +jobs: + auto_close: + uses: appwrite/.github/.github/workflows/autoclose.yml@main + secrets: + GH_AUTO_CLOSE_PR_TOKEN: ${{ secrets.GH_AUTO_CLOSE_PR_TOKEN }} \ No newline at end of file diff --git a/templates/dart/.github/workflows/autoclose.yml b/templates/dart/.github/workflows/autoclose.yml new file mode 100644 index 000000000..4f2a8eedb --- /dev/null +++ b/templates/dart/.github/workflows/autoclose.yml @@ -0,0 +1,11 @@ +name: Auto-close External Pull Requests + +on: + pull_request_target: + types: [opened, reopened] + +jobs: + auto_close: + uses: appwrite/.github/.github/workflows/autoclose.yml@main + secrets: + GH_AUTO_CLOSE_PR_TOKEN: ${{ secrets.GH_AUTO_CLOSE_PR_TOKEN }} \ No newline at end of file diff --git a/templates/deno/.github/workflows/autoclose.yml b/templates/deno/.github/workflows/autoclose.yml new file mode 100644 index 000000000..4f2a8eedb --- /dev/null +++ b/templates/deno/.github/workflows/autoclose.yml @@ -0,0 +1,11 @@ +name: Auto-close External Pull Requests + +on: + pull_request_target: + types: [opened, reopened] + +jobs: + auto_close: + uses: appwrite/.github/.github/workflows/autoclose.yml@main + secrets: + GH_AUTO_CLOSE_PR_TOKEN: ${{ secrets.GH_AUTO_CLOSE_PR_TOKEN }} \ No newline at end of file diff --git a/templates/dotnet/.github/workflows/autoclose.yml b/templates/dotnet/.github/workflows/autoclose.yml new file mode 100644 index 000000000..4f2a8eedb --- /dev/null +++ b/templates/dotnet/.github/workflows/autoclose.yml @@ -0,0 +1,11 @@ +name: Auto-close External Pull Requests + +on: + pull_request_target: + types: [opened, reopened] + +jobs: + auto_close: + uses: appwrite/.github/.github/workflows/autoclose.yml@main + secrets: + GH_AUTO_CLOSE_PR_TOKEN: ${{ secrets.GH_AUTO_CLOSE_PR_TOKEN }} \ No newline at end of file diff --git a/templates/flutter/.github/workflows/autoclose.yml b/templates/flutter/.github/workflows/autoclose.yml new file mode 100644 index 000000000..4f2a8eedb --- /dev/null +++ b/templates/flutter/.github/workflows/autoclose.yml @@ -0,0 +1,11 @@ +name: Auto-close External Pull Requests + +on: + pull_request_target: + types: [opened, reopened] + +jobs: + auto_close: + uses: appwrite/.github/.github/workflows/autoclose.yml@main + secrets: + GH_AUTO_CLOSE_PR_TOKEN: ${{ secrets.GH_AUTO_CLOSE_PR_TOKEN }} \ No newline at end of file diff --git a/templates/go/.github/workflows/autoclose.yml b/templates/go/.github/workflows/autoclose.yml new file mode 100644 index 000000000..4f2a8eedb --- /dev/null +++ b/templates/go/.github/workflows/autoclose.yml @@ -0,0 +1,11 @@ +name: Auto-close External Pull Requests + +on: + pull_request_target: + types: [opened, reopened] + +jobs: + auto_close: + uses: appwrite/.github/.github/workflows/autoclose.yml@main + secrets: + GH_AUTO_CLOSE_PR_TOKEN: ${{ secrets.GH_AUTO_CLOSE_PR_TOKEN }} \ No newline at end of file diff --git a/templates/graphql/.github/workflows/autoclose.yml b/templates/graphql/.github/workflows/autoclose.yml new file mode 100644 index 000000000..4f2a8eedb --- /dev/null +++ b/templates/graphql/.github/workflows/autoclose.yml @@ -0,0 +1,11 @@ +name: Auto-close External Pull Requests + +on: + pull_request_target: + types: [opened, reopened] + +jobs: + auto_close: + uses: appwrite/.github/.github/workflows/autoclose.yml@main + secrets: + GH_AUTO_CLOSE_PR_TOKEN: ${{ secrets.GH_AUTO_CLOSE_PR_TOKEN }} \ No newline at end of file diff --git a/templates/kotlin/.github/workflows/autoclose.yml b/templates/kotlin/.github/workflows/autoclose.yml new file mode 100644 index 000000000..4f2a8eedb --- /dev/null +++ b/templates/kotlin/.github/workflows/autoclose.yml @@ -0,0 +1,11 @@ +name: Auto-close External Pull Requests + +on: + pull_request_target: + types: [opened, reopened] + +jobs: + auto_close: + uses: appwrite/.github/.github/workflows/autoclose.yml@main + secrets: + GH_AUTO_CLOSE_PR_TOKEN: ${{ secrets.GH_AUTO_CLOSE_PR_TOKEN }} \ No newline at end of file diff --git a/templates/node/.github/workflows/autoclose.yml b/templates/node/.github/workflows/autoclose.yml new file mode 100644 index 000000000..4f2a8eedb --- /dev/null +++ b/templates/node/.github/workflows/autoclose.yml @@ -0,0 +1,11 @@ +name: Auto-close External Pull Requests + +on: + pull_request_target: + types: [opened, reopened] + +jobs: + auto_close: + uses: appwrite/.github/.github/workflows/autoclose.yml@main + secrets: + GH_AUTO_CLOSE_PR_TOKEN: ${{ secrets.GH_AUTO_CLOSE_PR_TOKEN }} \ No newline at end of file diff --git a/templates/php/.github/workflows/autoclose.yml b/templates/php/.github/workflows/autoclose.yml new file mode 100644 index 000000000..4f2a8eedb --- /dev/null +++ b/templates/php/.github/workflows/autoclose.yml @@ -0,0 +1,11 @@ +name: Auto-close External Pull Requests + +on: + pull_request_target: + types: [opened, reopened] + +jobs: + auto_close: + uses: appwrite/.github/.github/workflows/autoclose.yml@main + secrets: + GH_AUTO_CLOSE_PR_TOKEN: ${{ secrets.GH_AUTO_CLOSE_PR_TOKEN }} \ No newline at end of file diff --git a/templates/python/.github/workflows/autoclose.yml b/templates/python/.github/workflows/autoclose.yml new file mode 100644 index 000000000..4f2a8eedb --- /dev/null +++ b/templates/python/.github/workflows/autoclose.yml @@ -0,0 +1,11 @@ +name: Auto-close External Pull Requests + +on: + pull_request_target: + types: [opened, reopened] + +jobs: + auto_close: + uses: appwrite/.github/.github/workflows/autoclose.yml@main + secrets: + GH_AUTO_CLOSE_PR_TOKEN: ${{ secrets.GH_AUTO_CLOSE_PR_TOKEN }} \ No newline at end of file diff --git a/templates/react-native/.github/workflows/autoclose.yml b/templates/react-native/.github/workflows/autoclose.yml new file mode 100644 index 000000000..4f2a8eedb --- /dev/null +++ b/templates/react-native/.github/workflows/autoclose.yml @@ -0,0 +1,11 @@ +name: Auto-close External Pull Requests + +on: + pull_request_target: + types: [opened, reopened] + +jobs: + auto_close: + uses: appwrite/.github/.github/workflows/autoclose.yml@main + secrets: + GH_AUTO_CLOSE_PR_TOKEN: ${{ secrets.GH_AUTO_CLOSE_PR_TOKEN }} \ No newline at end of file diff --git a/templates/rest/.github/workflows/autoclose.yml b/templates/rest/.github/workflows/autoclose.yml new file mode 100644 index 000000000..4f2a8eedb --- /dev/null +++ b/templates/rest/.github/workflows/autoclose.yml @@ -0,0 +1,11 @@ +name: Auto-close External Pull Requests + +on: + pull_request_target: + types: [opened, reopened] + +jobs: + auto_close: + uses: appwrite/.github/.github/workflows/autoclose.yml@main + secrets: + GH_AUTO_CLOSE_PR_TOKEN: ${{ secrets.GH_AUTO_CLOSE_PR_TOKEN }} \ No newline at end of file diff --git a/templates/ruby/.github/workflows/autoclose.yml b/templates/ruby/.github/workflows/autoclose.yml new file mode 100644 index 000000000..4f2a8eedb --- /dev/null +++ b/templates/ruby/.github/workflows/autoclose.yml @@ -0,0 +1,11 @@ +name: Auto-close External Pull Requests + +on: + pull_request_target: + types: [opened, reopened] + +jobs: + auto_close: + uses: appwrite/.github/.github/workflows/autoclose.yml@main + secrets: + GH_AUTO_CLOSE_PR_TOKEN: ${{ secrets.GH_AUTO_CLOSE_PR_TOKEN }} \ No newline at end of file diff --git a/templates/swift/.github/workflows/autoclose.yml b/templates/swift/.github/workflows/autoclose.yml new file mode 100644 index 000000000..4f2a8eedb --- /dev/null +++ b/templates/swift/.github/workflows/autoclose.yml @@ -0,0 +1,11 @@ +name: Auto-close External Pull Requests + +on: + pull_request_target: + types: [opened, reopened] + +jobs: + auto_close: + uses: appwrite/.github/.github/workflows/autoclose.yml@main + secrets: + GH_AUTO_CLOSE_PR_TOKEN: ${{ secrets.GH_AUTO_CLOSE_PR_TOKEN }} \ No newline at end of file diff --git a/templates/web/.github/workflows/autoclose.yml b/templates/web/.github/workflows/autoclose.yml new file mode 100644 index 000000000..4f2a8eedb --- /dev/null +++ b/templates/web/.github/workflows/autoclose.yml @@ -0,0 +1,11 @@ +name: Auto-close External Pull Requests + +on: + pull_request_target: + types: [opened, reopened] + +jobs: + auto_close: + uses: appwrite/.github/.github/workflows/autoclose.yml@main + secrets: + GH_AUTO_CLOSE_PR_TOKEN: ${{ secrets.GH_AUTO_CLOSE_PR_TOKEN }} \ No newline at end of file From d023f3586a77c23402bfa26fec5dfe73b4da4888 Mon Sep 17 00:00:00 2001 From: Binyamin Yawitz <316103+byawitz@users.noreply.github.com> Date: Tue, 1 Oct 2024 09:38:49 -0400 Subject: [PATCH 3/5] fix(dotnet): chunk upload --- templates/dotnet/Package/Client.cs.twig | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/templates/dotnet/Package/Client.cs.twig b/templates/dotnet/Package/Client.cs.twig index 685cf0bd7..fb6a3f50c 100644 --- a/templates/dotnet/Package/Client.cs.twig +++ b/templates/dotnet/Package/Client.cs.twig @@ -60,7 +60,7 @@ namespace {{ spec.title | caseUcfirst }} { _endpoint = endpoint; _http = http ?? new HttpClient(); - + _httpForRedirect = httpForRedirect ?? new HttpClient( new HttpClientHandler(){ AllowAutoRedirect = false @@ -220,7 +220,7 @@ namespace {{ spec.title | caseUcfirst }} public async Task Redirect( string method, - string path, + string path, Dictionary headers, Dictionary parameters) { @@ -269,7 +269,7 @@ namespace {{ spec.title | caseUcfirst }} var response = await _http.SendAsync(request); var code = (int)response.StatusCode; - if (response.Headers.TryGetValues("x-{{ spec.title | lower }}-warning", out var warnings)) + if (response.Headers.TryGetValues("x-{{ spec.title | lower }}-warning", out var warnings)) { foreach (var warning in warnings) { @@ -376,16 +376,23 @@ namespace {{ spec.title | caseUcfirst }} if (!string.IsNullOrEmpty(idParamName) && (string)parameters[idParamName] != "unique()") { + try + { // Make a request to check if a file already exists var current = await Call>( method: "GET", - path: "$path/${params[idParamName]}", - headers, - parameters = new Dictionary() + path: $"{path}/{parameters[idParamName]}", + new Dictionary { { "content-type", "application/json" } }, + parameters: new Dictionary() ); var chunksUploaded = (long)current["chunksUploaded"]; offset = chunksUploaded * ChunkSize; } + catch (Exception ex) + { + // ignored as it mostly means file not found + } + } while (offset < size) { From f84b8e7b55ac11763486aa3822069db9ee6b80ce Mon Sep 17 00:00:00 2001 From: loks0n <22452787+loks0n@users.noreply.github.com> Date: Wed, 2 Oct 2024 22:16:05 +0100 Subject: [PATCH 4/5] fix(web): credentials include --- templates/web/src/client.ts.twig | 1 + 1 file changed, 1 insertion(+) diff --git a/templates/web/src/client.ts.twig b/templates/web/src/client.ts.twig index 51f0ac7a7..6828abb0f 100644 --- a/templates/web/src/client.ts.twig +++ b/templates/web/src/client.ts.twig @@ -554,6 +554,7 @@ class Client { let options: RequestInit = { method, headers, + credentials: 'include', }; if (method === 'GET') { From d4acfa890cc16d83b0c769284ee1927ca3433b8c Mon Sep 17 00:00:00 2001 From: Jake Barnby Date: Tue, 8 Oct 2024 13:11:09 +1300 Subject: [PATCH 5/5] Fix Ruby publish --- templates/ruby/.github/workflows/publish.yml.twig | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/templates/ruby/.github/workflows/publish.yml.twig b/templates/ruby/.github/workflows/publish.yml.twig index 3e8f6b8c5..e1897396f 100644 --- a/templates/ruby/.github/workflows/publish.yml.twig +++ b/templates/ruby/.github/workflows/publish.yml.twig @@ -19,8 +19,10 @@ jobs: - name: Set up RubyGems run: | - cat "---\n:rubygems_api_key: {{ '${{ secrets.RUBYGEMS_TOKEN }}' }}\n" > ~/.gem/credentials + echo -e "---\n:rubygems_api_key: $RUBYGEMS_TOKEN\n" > ~/.gem/credentials chmod 0600 ~/.gem/credentials + env: + RUBYGEMS_TOKEN: ${{ secrets.RUBYGEMS_TOKEN }} - name: Build gem run: gem build {{ spec.title | caseLower }}.gemspec