<commit_before>{% set settings = config.plugins['git-sync'] %}
{% set frontend_url = (uri.base ~ uri.rootUrl)|trim('/') %}

<div class="remodal" data-remodal-id="wizard" data-remodal-options="hashTracking: false">

    <h1>Git Sync - Wizard</h1>
    {% if git_sync.git_installed %}
    <div class="step-0">
        <div class="panel">
            <p>
                This wizard will guide you through a few simple steps that will help you set up the plugin and your <i class="fa fa-fw fa-git"></i> repository. When done you will have a bi-directional synchronization link between your site and the <i class="fa fa-fw fa-git"></i> repository.
            </p>

            <p>
                Press <strong>Next</strong> to continue.
            </p>
        </div>
    </div>

    <div class="step-1">
        {% set selectedRepo = 'allothers' in settings.repository ? 'allothers' : selectedRepo %}
        {% set selectedRepo = 'github.com' in settings.repository ? 'github' : selectedRepo %}
        {% set selectedRepo = 'bitbucket.com' in settings.repository ? 'bitbucket' : selectedRepo %}
        {% set selectedRepo = 'gitlab.com' in settings.repository ? 'gitlab' : selectedRepo %}

        <h1>Step 1 - Hosting Service</h1>
        <div class="panel hidden disabled">
            <p>
                Select the <i class="fa fa-fw fa-git"></i> repository-hosting service that you will be using to remotely store your data. Once you picked one, insert the username and password or token to access the service. Passwords are saved securely.
            </p>
            <div class="columns wizard-padding">
                <div class="column">
                    <label>
                        <input type="radio" value="github" name="gitsync[repository]" {{ selectedRepo == 'github' ? 'checked' : '' }} />
                        <img src="{{ url('plugin://git-sync/images/repos/github.svg') }}" />
                        <a href="https://github.com/join?source=header-home" target="_blank">(create account)</a>
                    </label>
                    <label>
                        <input type="radio" value="bitbucket" name="gitsync[repository]" {{ selectedRepo == 'bitbucket' ? 'checked' : '' }} />
                        <img src="{{ url('plugin://git-sync/images/repos/bitbucket.svg') }}" />
                        <a href="https://bitbucket.org/account/signup/" target="_blank">(create account)</a>
                    </label>
                    <label>
                        <input type="radio" value="gitlab" name="gitsync[repository]" {{ selectedRepo == 'gitlab' ? 'checked' : '' }} />
                        <img src="{{ url('plugin://git-sync/images/repos/gitlab.svg') }}" />
                        <a href="https://gitlab.com/users/sign_in" target="_blank">(create account)</a>
                    </label>
                     <label>
                        <input type="radio" value="allothers" name="gitsync[repository]" {{ selectedRepo == 'allothers' ? 'checked' : '' }} />
                        <img src="{{ url('plugin://git-sync/images/repos/gitlogo.svg') }}" />
                         <small>(any Git service with webhooks)</small>
                    </label>
                </div>
                <div class="column">
                    <label>
                        Git User
                        <input type="text" name="gitsync[repo_user]" placeholder="Username, not email" value="{{ settings.user|default('') }}" />
                    </label>
                    <label>
                        Git Password or Token
                        <input type="password" name="gitsync[repo_password]" placeholder="Password" value="" />
                    </label>
                </div>
            </div>

            <div class="access-tokens wizard-padding">
                <h3>Access Tokens and 2FA (Two-factor Authentication)</h3>
                <p>If you have never used Access Tokens or don't know what 2FA is, you most likely only need your <strong>regular password</strong> for the field above. You can then skip this step and press <strong>Next</strong> to continue.</p>

                <p><a href="#" class="button" data-access-tokens-details>More Details <i class="fa fa-fw fa-chevron-down"></i></a></p>

                <div class="access-tokens-details" style="display: none;">
                    <p>With GitSync you have the option to use an Access Token instead of your password, however if you have <strong>2FA (Two-factor authentication)</strong> enabled for your git service, you can use Access Tokens.</p>

                    <p>Using a token is more secure than using your password, because you can limit what can be done using it and it can be revoked without worrying about changing the password. As we are just syncing, we only need to give it read-and-write access to repositories and webhooks.
                    </p>

                    <div class="hidden-step-github hidden">
                        <h4>GitHub</h4>
                        <p>
                            With <a href="https://help.github.com/articles/creating-an-access-token-for-command-line-use/" target="_blank">GitHub's Personal Access Tokens</a>, select the following Scopes:
                        </p>

                        <ul>
                            <li><i class="fa fa-check-square-o"></i> <code>repo</code> (Full control of private repositories)</li>
                            <li><i class="fa fa-check-square-o"></i> <code>admin:repo_hook</code> (Full control of repository hooks)</li>
                        </ul>
                    </div>

                    <div class="hidden-step-bitbucket hidden">
                        <h4>Bitbucket</h4>
                        <p>
                            With <a href="https://confluence.atlassian.com/bitbucket/app-passwords-828781300.html" target="_blank">BitBucket's App Passwords</a>, select the following Permissions:
                        </p>

                        <ul>
                            <li>Repositories:
                                <ul>
                                    <li><i class="fa fa-check-square-o"></i> <code>Read</code></li>
                                    <li><i class="fa fa-check-square-o"></i> <code>Write</code></li>
                                </ul>
                            </li>
                            <li>Webhooks
                                <ul>
                                    <li><i class="fa fa-check-square-o"></i> <code>Read and write</code></li>
                                </ul>
                            </li>
                        </ul>
                    </div>

                    <div class="hidden-step-gitlab hidden">
                        <h4>GitLab</h4>
                        <p>
                            For <a href="https://docs.gitlab.com/ee/api/README.html#personal-access-tokens" target="_blank">GitLab's Personal Access Tokens</a> select the following Scopes:
                        </p>

                        <ul>
                            <li><i class="fa fa-check-square-o"></i> <code>API</code> (Access your API)</li>
                        </ul>
                    </div>

                    <div class="hidden-step-allothers hidden">
                        <h4>Other Git Repositories</h4>

                        <p>Usually under your profile settings is where you can generate a new Access Token. You want to ensure that you have enough read/write access for the repository as well as <code>webhook</code> access</p>
                    </div>
                </div>
            </div>

            <p>
                Press <strong>Next</strong> to continue.
            </p>
        </div>
    </div>

    <div class="step-2">
        <h1>Step 2 - Setting up the Repository</h1>
        <div class="panel hidden disabled">
            <p>
                If you already have a repository set up and ready to use, you can skip this step. Otherwise please continue reading.
            </p>

            <p>If you are going to set up the repository now, please ensure you also make a commit as the service provider offers to do when it is created (whether it's the README or .gitignore). GitSync won't work unless the repository has at least one commit.</p>

            <div class="hidden-step-github wizard-padding hidden">
                <h4>GitHub</h4>
                <p>
                    Follow the instructions on <a href="https://help.github.com/articles/creating-a-new-repository/" target="_blank">GitHub Help</a> to create a new GitHub repository.
                </p>
            </div>
            <div class="hidden-step-bitbucket wizard-padding hidden">
                <h4>Bitbucket</h4>
                <p>
                    Follow the instructions on <a href="https://confluence.atlassian.com/bitbucket/create-a-git-repository-759857290.html" target="_blank">Atlassian Documentation</a> to create a new Bitbucket repository. Make sure you select <strong>Git</strong> as repository type.
                </p>
            </div>
            <div class="hidden-step-gitlab wizard-padding hidden">
                <h4>GitLab</h4>
                <p>
                    Follow the instructions on <a href="https://docs.gitlab.com/ce/gitlab-basics/create-project.html" target="_blank">GitLab Documentation</a> to create a new GitLab repository.
                </p>
            </div>
            <div class="hidden-step-allothers wizard-padding hidden">
              <h4>Other Git Repositories</h4>

            </div>

            <p>
                Once you created your repository, insert below the full HTTPS URL for the repository you just created. This is the URL used to clone the repository. All services offer both SSH and HTTPS URLs but <strong>ONLY</strong> HTTPS is supported at this time.
            </p>

            <p class="hidden-step-bitbucket hidden">
                When you copy the HTTPS URL from Bitbucket, it also adds <code>your-user@</code> at the beginning of the URL which is not needed and should be removed. The URL be something like <code>https://bitbucket.org/your-user/your-repository.git</code>
            </p>

            <p>
                <label>
                    Git Repository (<strong>HTTPS only</strong>)

                    <input type="text" name="gitsync[repo_url]" placeholder="https://github.com/getgrav/grav.git" value="{{ settings.repository|default('') }}" />
                </label>

                <p class="info">
                    GitSync expects the repository to be your <strong>user/</strong> folder. At this time it is not possible to use a full Grav site repository as source for GitSync.
                </p>
            </p>

            <p class="center">
                <a href="#" class="button" data-gitsync-action="test"><i class="fa fa-fw fa-plug"></i> Test Connection</a>
            </p>

            <p><commit_msg>Moved informations about the repository source<commit_after>{% set settings = config.plugins['git-sync'] %}
{% set frontend_url = (uri.base ~ uri.rootUrl)|trim('/') %}

<div class="remodal" data-remodal-id="wizard" data-remodal-options="hashTracking: false">

    <h1>Git Sync - Wizard</h1>
    {% if git_sync.git_installed %}
    <div class="step-0">
        <div class="panel">
            <p>
                This wizard will guide you through a few simple steps that will help you set up the plugin and your <i class="fa fa-fw fa-git"></i> repository. When done you will have a bi-directional synchronization link between your site and the <i class="fa fa-fw fa-git"></i> repository.
            </p>

            <p>
                Press <strong>Next</strong> to continue.
            </p>
        </div>
    </div>

    <div class="step-1">
        {% set selectedRepo = 'allothers' in settings.repository ? 'allothers' : selectedRepo %}
        {% set selectedRepo = 'github.com' in settings.repository ? 'github' : selectedRepo %}
        {% set selectedRepo = 'bitbucket.com' in settings.repository ? 'bitbucket' : selectedRepo %}
        {% set selectedRepo = 'gitlab.com' in settings.repository ? 'gitlab' : selectedRepo %}

        <h1>Step 1 - Hosting Service</h1>
        <div class="panel hidden disabled">
            <p>
                Select the <i class="fa fa-fw fa-git"></i> repository-hosting service that you will be using to remotely store your data. Once you picked one, insert the username and password or token to access the service. Passwords are saved securely.
            </p>
            <div class="columns wizard-padding">
                <div class="column">
                    <label>
                        <input type="radio" value="github" name="gitsync[repository]" {{ selectedRepo == 'github' ? 'checked' : '' }} />
                        <img src="{{ url('plugin://git-sync/images/repos/github.svg') }}" />
                        <a href="https://github.com/join?source=header-home" target="_blank">(create account)</a>
                    </label>
                    <label>
                        <input type="radio" value="bitbucket" name="gitsync[repository]" {{ selectedRepo == 'bitbucket' ? 'checked' : '' }} />
                        <img src="{{ url('plugin://git-sync/images/repos/bitbucket.svg') }}" />
                        <a href="https://bitbucket.org/account/signup/" target="_blank">(create account)</a>
                    </label>
                    <label>
                        <input type="radio" value="gitlab" name="gitsync[repository]" {{ selectedRepo == 'gitlab' ? 'checked' : '' }} />
                        <img src="{{ url('plugin://git-sync/images/repos/gitlab.svg') }}" />
                        <a href="https://gitlab.com/users/sign_in" target="_blank">(create account)</a>
                    </label>
                     <label>
                        <input type="radio" value="allothers" name="gitsync[repository]" {{ selectedRepo == 'allothers' ? 'checked' : '' }} />
                        <img src="{{ url('plugin://git-sync/images/repos/gitlogo.svg') }}" />
                         <small>(any Git service with webhooks)</small>
                    </label>
                </div>
                <div class="column">
                    <label>
                        Git User
                        <input type="text" name="gitsync[repo_user]" placeholder="Username, not email" value="{{ settings.user|default('') }}" />
                    </label>
                    <label>
                        Git Password or Token
                        <input type="password" name="gitsync[repo_password]" placeholder="Password" value="" />
                    </label>
                </div>
            </div>

            <div class="access-tokens wizard-padding">
                <h3>Access Tokens and 2FA (Two-factor Authentication)</h3>
                <p>If you have never used Access Tokens or don't know what 2FA is, you most likely only need your <strong>regular password</strong> for the field above. You can then skip this step and press <strong>Next</strong> to continue.</p>

                <p><a href="#" class="button" data-access-tokens-details>More Details <i class="fa fa-fw fa-chevron-down"></i></a></p>

                <div class="access-tokens-details" style="display: none;">
                    <p>With GitSync you have the option to use an Access Token instead of your password, however if you have <strong>2FA (Two-factor authentication)</strong> enabled for your git service, you can use Access Tokens.</p>

                    <p>Using a token is more secure than using your password, because you can limit what can be done using it and it can be revoked without worrying about changing the password. As we are just syncing, we only need to give it read-and-write access to repositories and webhooks.
                    </p>

                    <div class="hidden-step-github hidden">
                        <h4>GitHub</h4>
                        <p>
                            With <a href="https://help.github.com/articles/creating-an-access-token-for-command-line-use/" target="_blank">GitHub's Personal Access Tokens</a>, select the following Scopes:
                        </p>

                        <ul>
                            <li><i class="fa fa-check-square-o"></i> <code>repo</code> (Full control of private repositories)</li>
                            <li><i class="fa fa-check-square-o"></i> <code>admin:repo_hook</code> (Full control of repository hooks)</li>
                        </ul>
                    </div>

                    <div class="hidden-step-bitbucket hidden">
                        <h4>Bitbucket</h4>
                        <p>
                            With <a href="https://confluence.atlassian.com/bitbucket/app-passwords-828781300.html" target="_blank">BitBucket's App Passwords</a>, select the following Permissions:
                        </p>

                        <ul>
                            <li>Repositories:
                                <ul>
                                    <li><i class="fa fa-check-square-o"></i> <code>Read</code></li>
                                    <li><i class="fa fa-check-square-o"></i> <code>Write</code></li>
                                </ul>
                            </li>
                            <li>Webhooks
                                <ul>
                                    <li><i class="fa fa-check-square-o"></i> <code>Read and write</code></li>
                                </ul>
                            </li>
                        </ul>
                    </div>

                    <div class="hidden-step-gitlab hidden">
                        <h4>GitLab</h4>
                        <p>
                            For <a href="https://docs.gitlab.com/ee/api/README.html#personal-access-tokens" target="_blank">GitLab's Personal Access Tokens</a> select the following Scopes:
                        </p>

                        <ul>
                            <li><i class="fa fa-check-square-o"></i> <code>API</code> (Access your API)</li>
                        </ul>
                    </div>

                    <div class="hidden-step-allothers hidden">
                        <h4>Other Git Repositories</h4>

                        <p>Usually under your profile settings is where you can generate a new Access Token. You want to ensure that you have enough read/write access for the repository as well as <code>webhook</code> access</p>
                    </div>
                </div>
            </div>

            <p>
                Press <strong>Next</strong> to continue.
            </p>
        </div>
    </div>

    <div class="step-2">
        <h1>Step 2 - Setting up the Repository</h1>
        <div class="panel hidden disabled">
            <p>
                If you already have a repository set up and ready to use, you can skip this step. Otherwise please continue reading.
            </p>

            <p>If you are going to set up the repository now, please ensure you also make a commit as the service provider offers to do when it is created (whether it's the README or .gitignore). GitSync won't work unless the repository has at least one commit.</p>

            <div class="hidden-step-github wizard-padding hidden">
                <h4>GitHub</h4>
                <p>
                    Follow the instructions on <a href="https://help.github.com/articles/creating-a-new-repository/" target="_blank">GitHub Help</a> to create a new GitHub repository.
                </p>
            </div>
            <div class="hidden-step-bitbucket wizard-padding hidden">
                <h4>Bitbucket</h4>
                <p>
                    Follow the instructions on <a href="https://confluence.atlassian.com/bitbucket/create-a-git-repository-759857290.html" target="_blank">Atlassian Documentation</a> to create a new Bitbucket repository. Make sure you select <strong>Git</strong> as repository type.
                </p>
            </div>
            <div class="hidden-step-gitlab wizard-padding hidden">
                <h4>GitLab</h4>
                <p>
                    Follow the instructions on <a href="https://docs.gitlab.com/ce/gitlab-basics/create-project.html" target="_blank">GitLab Documentation</a> to create a new GitLab repository.
                </p>
            </div>
            <div class="hidden-step-allothers wizard-padding hidden">
              <h4>Other Git Repositories</h4>

            </div>

            <p>
                Once you created your repository, insert below the full HTTPS URL for the repository you just created. This is the URL used to clone the repository. All services offer both SSH and HTTPS URLs but <strong>ONLY</strong> HTTPS is supported at this time.
            </p>

            <p class="hidden-step-bitbucket hidden">
                When you copy the HTTPS URL from Bitbucket, it also adds <code>your-user@</code> at the beginning of the URL which is not needed and should be removed. The URL be something like <code>https://bitbucket.org/your-user/your-repository.git</code>
            </p>

            <p>
                <label>
                    Git Repository (<strong>HTTPS only</strong>)

                    <input type="text" name="gitsync[repo_url]" placeholder="https://github.com/getgrav/grav.git" value="{{ settings.repository|default('') }}" />
                </label>
                <span>
                    GitSync will use the above repository to store the <strong>user/</strong> folder items selected in Step 4.
                </span>
            </p>

            <p class="center">
                <a href="#" class="button" data-gitsync-action="test"><i class="fa fa-fw fa-plug"></i> Test Connection</a>
            </p>

            <p>
{'fraction_non_alphanumeric': 0.12492596473643446, 'fraction_numerical': 0.004601576381611919, 'mean_word_length': 1.6180820610687023, 'pattern_counts': {'":': 0, '<': 481, '<?xml version=': 0, '>': 481, 'https://': 22, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 6, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6803686', 'n_tokens_mistral': 5928, 'n_tokens_neox': 5524, 'n_words': 1680}