From 833e827ebaeb88698bf6c11b2402457f09cb5d95 Mon Sep 17 00:00:00 2001 From: archy Date: Sun, 1 Oct 2023 03:59:28 +0800 Subject: [PATCH] set new url in gh config.yaml & set curl as default target for code --- .github/ISSUE_TEMPLATE/config.yml | 8 ++++---- .../src/ui/components/modals/generate-code-modal.tsx | 8 ++++++-- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml index f91237d64..c3d377bf5 100644 --- a/.github/ISSUE_TEMPLATE/config.yml +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -1,8 +1,8 @@ blank_issues_enabled: true contact_links: - name: Feature Request - url: https://github.com/Kong/insomnia/discussions/categories/ideas + url: https://github.com/ArchGPT/insomnium/discussions about: Search and submit ideas for this project - - name: Question - url: https://chat.insomnia.rest/ - about: Please ask and answer questions about Insomnium in our Slack Community + # - name: Question + # url: https://chat.insomnia.rest/ + # about: Please ask and answer questions about Insomnium in our Slack Community diff --git a/packages/insomnia/src/ui/components/modals/generate-code-modal.tsx b/packages/insomnia/src/ui/components/modals/generate-code-modal.tsx index 9d3f3582d..9e58aa7c1 100644 --- a/packages/insomnia/src/ui/components/modals/generate-code-modal.tsx +++ b/packages/insomnia/src/ui/components/modals/generate-code-modal.tsx @@ -12,6 +12,10 @@ import { ModalFooter } from '../base/modal-footer'; import { ModalHeader } from '../base/modal-header'; import { CodeEditor, CodeEditorHandle } from '../codemirror/code-editor'; +const defaultTarget = '{"key":"shell","title":"Shell","extname":".sh","default":"curl","clients":[{"key":"curl","title":"cURL","link":"http://curl.haxx.se/","description":"cURL is a command line tool and library for transferring data with URL syntax"},{"key":"httpie","title":"HTTPie","link":"http://httpie.org/","description":"a CLI, cURL-like tool for humans"},{"key":"wget","title":"Wget","link":"https://www.gnu.org/software/wget/","description":"a free software package for retrieving files using HTTP, HTTPS"}]}' + +const defaultClient = '{"key":"curl","title":"cURL","link":"http://curl.haxx.se/","description":"cURL is a command line tool and library for transferring data with URL syntax"}' + const MODE_MAP: Record = { c: 'clike', java: 'clike', @@ -48,11 +52,11 @@ export const GenerateCodeModal = forwardRef((pro let storedTarget: HTTPSnippetTarget | undefined; let storedClient: HTTPSnippetClient | undefined; try { - storedTarget = JSON.parse(window.localStorage.getItem('insomnia::generateCode::target') || '') as HTTPSnippetTarget; + storedTarget = JSON.parse(window.localStorage.getItem('insomnia::generateCode::target') || defaultTarget) as HTTPSnippetTarget; } catch (error) {} try { - storedClient = JSON.parse(window.localStorage.getItem('insomnia::generateCode::client') || '') as HTTPSnippetClient; + storedClient = JSON.parse(window.localStorage.getItem('insomnia::generateCode::client') || defaultClient) as HTTPSnippetClient; } catch (error) {} const [state, setState] = useState({ cmd: '',