由于开源版的兰空图床API在获取Tonken时非常不方便,所以有大佬写了这个代码,在此转载记录.
直接在 /resources/views/common/api.blade.php 文件里合适的位置添加以下代码:

    <div>
                    <p class="text-lg text-gray-700 font-semibold">Tonken获取</p>
                    <script src="//lib.baomitu.com/jquery/1.12.4/jquery.min.js"></script>
                    <form id="token" action="{{ request()->getSchemeAndHttpHost() }}/api/v1/tokens" method="POST">
                        <div class="my-2 text-sm">
                            <div class="form-group qqlogin" style="display: none;">
                                <div class="input-group-addon">邮箱</div>
                                <input type="email" id="email" name="email" value="{{ Auth::user()->email }}">
                            </div>
                            <div style="display: inline-flex;position: relative;">
                                <div class="px-4 py-3 text-right sm:px-6" style="color: #555;background-color: #eee;border: 1px solid #ccc;">密码</div>
                                <input type="password" id="password" name="password" placeholder="输入你的密码">
                                <a href="javascript:;" class="button px-4 py-3 sm:px-6" style="color: #fff;background-color: #337ab7;border-color: #2e6da4;margin-left:10px;">
                                    <div>点击获取</div>
                                </a>
                            </div>
                            <div class="list-group">
                                <x-code>
                                    <span style="color:tomato;user-select: none;">token:</span><span id="tokenCode"></span>
                                </x-code>
                            </div>
                    </form>
                    <script>
                        $(document).ready(function() {
                            $("#token .button").click(function() {
                                var url = $("#token").attr("action");
                                var email = $("#email").val();
                                var password = $("#password").val();
                                $.ajax({
                                    type: 'post',
                                    url: url,
                                    data: {
                                        email: email,
                                        password: password
                                    },
                                    success: function(data) {
                                        if (data.status == true) {
                                            $("#tokenCode").html('Bearer ' + data.data.token)
                                        } else {
                                            if (data.message == "password 不能为空。") {
                                                $("#tokenCode").html("密码不能为空!")
                                            } else if (data.message == "The email address or password is incorrect.") {
                                                $("#tokenCode").html("请确认密码是否正确!")
                                            }
                                        }
                                    },
                                    error: function() {
                                        $("#tokenCode").html("请求过于频繁,请稍后再试!")
                                    }
                                });
    
                            });
                        });
                    </script>
                </div>

添加位置约如下图:

兰空图床API页面,添加自助获取Tonken功能