首页 > 其他分享 >Github Dorisoy网盘项目

Github Dorisoy网盘项目

时间:2024-08-17 19:40:24浏览次数:6  
标签:Github Dorisoy 网盘 userId mysql using Microsoft Pan

相关github地址
https://github.com/dorisoy/Dorisoy.Pan?tab=readme-ov-file

mysql8

sudo rpm -ivh mysql80-community-release-el7-5.noarch.rpm
wget https://dev.mysql.com/get/mysql80-community-release-el7-5.noarch.rpm
sudo yum install mysql-community-server --nogpgcheck
systemctl start mysqld
[root@centos7init yum.repos.d]# sudo grep 'temporary password' /var/log/mysqld.log
2024-08-17T01:20:53.607313Z 6 [Note] [MY-010454] [Server] A temporary password is generated for root@localhost: TwpqzkbqG0)j
mysql_secure_installation
Huawei@123  密码设置高强度
mysql -uroot -pHuawei@123
mysql> CREATE USER 'root'@'%' IDENTIFIED BY 'Huawei@123';
Query OK, 0 rows affected (0.02 sec)

mysql> GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' WITH GRANT OPTION;
Query OK, 0 rows affected (0.00 sec)
赋权

npm相关操作

PS C:\Users\supermao\Desktop\Dorisoy.Pan-main\UI> npm config set registry https://registry.npmmirror.com/
PS C:\Users\supermao\Desktop\Dorisoy.Pan-main\UI> npm config get registry
https://registry.npmmirror.com/
npm install 有时候npm install --force 也会管用,在不想理会依赖的时候
若报node版本错误则使用nvm install 版本 -> nvm use 版本
来改变版本号
https://github.com/coreybutler/nvm-windows/releases
npm run start

visual studio 2022


必须安装此组件

"DocumentDbConnectionString": "Server=192.168.100.128;DataBase=dorisoy;User Id=root;Password=Huawei@123;"

无法找到回退包文件夹“D:\programme\share\NuGetPackages”
在此文件里更改对应路径
Microsoft.VisualStudio.FallbackLocation.config

需安装 PM> Install-Package Microsoft.EntityFrameworkCore.Tools

如果遇到重新生成解决方案出错,NET7.0不满足
则需要更新visual studio 使用 installer

将api设置为启动项,然后启动

修改源码,修改图标

上传失败 修改源码

using Microsoft.Extensions.DependencyInjection;
using Microsoft.IdentityModel.Tokens;
using Microsoft.AspNetCore.Authentication.JwtBearer;
using System;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.IdentityModel.JsonWebTokens;
using Dorisoy.Pan.Data;
using Dorisoy.Pan.Data.Dto;

namespace Dorisoy.Pan.API.Helpers
{
    public static class JwtAuthenticationConfigurationExtension
    {
        public static void AddJwtAutheticationConfiguration(
            this IServiceCollection services,
            JwtSettings settings)
        {
            // Register Jwt as the Authentication service
            services.AddAuthentication(options =>
            {
                options.DefaultAuthenticateScheme = "JwtBearer";
                options.DefaultChallengeScheme = "JwtBearer";
            })
            .AddJwtBearer("JwtBearer", jwtBearerOptions =>
            {
                jwtBearerOptions.TokenValidationParameters =
              new TokenValidationParameters
              {
                  ValidateIssuerSigningKey = true,
                  IssuerSigningKey = new SymmetricSecurityKey(
                  Encoding.UTF8.GetBytes(settings.Key)),
                  ValidateIssuer = true,
                  ValidIssuer = settings.Issuer,

                  ValidateAudience = true,
                  ValidAudience = settings.Audience,

                  ValidateLifetime = true,
                  ClockSkew = TimeSpan.FromMinutes(
                         settings.MinutesToExpiration)
              };
                jwtBearerOptions.Events = new JwtBearerEvents
                {
                    OnTokenValidated = context =>
                    {
                        if (context.SecurityToken is Microsoft.IdentityModel.JsonWebTokens.JsonWebToken accessToken)
                        {
                            // 提取 userId 和 email
                            var userId = accessToken.Claims.FirstOrDefault(a => a.Type == JwtRegisteredClaimNames.Sub)?.Value;
                            var email = accessToken.Claims.FirstOrDefault(a => a.Type == "Email")?.Value;

                            if (!string.IsNullOrEmpty(userId))
                            {
                                context.HttpContext.Items["Id"] = userId;
                                var userInfoToken = context.HttpContext.RequestServices.GetRequiredService<UserInfoToken>();

                                // 增加异常处理确保 userId 是有效的 Guid
                                if (Guid.TryParse(userId, out var parsedUserId))
                                {
                                    userInfoToken.Id = parsedUserId;
                                }
                                else
                                {
                                    throw new SecurityTokenException("Invalid userId in token.");
                                }

                                userInfoToken.Email = email;
                            }
                            else
                            {
                                throw new SecurityTokenException("userId is missing in token.");
                            }
                        }
                        return Task.CompletedTask;
                    }
                };
            });
            services.AddAuthorization();
        }
    }
}

修复错误图标



补充图标路径

标签:Github,Dorisoy,网盘,userId,mysql,using,Microsoft,Pan
From: https://www.cnblogs.com/supermao12/p/18364866

相关文章

  • Hexo-Github Actions 自动部署方案
    前阵子因为很久没有捡起来写博客,导致电脑的node环境各种版本问题,本地压根运行不起来,所以折腾了一下Hugo方案,感觉Hugo相较于Hexo还是有很多优势的,让我印象比较深的是:整个环境较为独立,不再像Hexo需要依赖电脑Node版本,各种插件需要独立版本,随着Hexo或者Node版本升......
  • 董宇辉英语课教学视频全套免费网盘分享
    真免费,无压缩,董宇辉英语课教学视频全套:链接:https://pan.quark.cn/s/e6ece6512361如果个别网盘账号空间不足,不要一次性保存,点进去单独保存下载。 董宇辉英语高一语法知识体系。很多在初中学习成绩不错的孩子,上了高一会出现下滑的情况。董宇辉老师在他的高一英语系统课程上,对......
  • 零成本 API 服务搭建,用 GitHub Actions 自动爬取文章?
    前言本着将成本降到最低,我目前做的应用或小程序都是单机的,也就是不用请求接口,只要一上架就没有任何支出。但是写死的数据毕竟有限,应用的内容单一无法紧跟时事热点,每次打开一个样,自然就没有留存。遇到有错字啥还要更新版本,那有没有方法既能丰富应用内容,又不用增加成本呢?既要又要,......
  • linux创建github仓库并用git上传本地仓库到github仓库
    1.创建github仓库(1)点击右上角的头像(2)点击Yourrepositories(3)点击New(4)填写好Owner和Repositoryname点击AddaREADMEfile选择license,再点击Createrepository2.用git上传本地仓库到github仓库git工作流:(1)点击Code再点击Local查看github仓库地址(2)将git......
  • 利用 Cloudflare workers 反代 github
    反代Github似乎会被认定为欺诈,严重的会封禁域名,不建议尝试首先绑定你的域名到cloudflare,然后创建一个Worker后写入以下代码并添加自定义域名//反代目标网站.constupstream='github.com';//反代目标网站的移动版.constupstream_mobile='github.com';//访问......
  • github 博客
    https://chirpy.cotes.page/posts/getting-started/#option-2-github-forksudoapt-getinstallruby-fullbuild-essentialzlib1g-devecho'#InstallRubyGemsto~/gems'>>~/.zshrcecho'exportGEM_HOME="\(HOME/gems"'>......
  • Ubuntu中编译使用ANTs(医学图像配准)含github无法访问问题解决
    目录第一步、修改hosts文件1.打开https://github.com.ipaddress.com/ 2.打开https://fastly.net.ipaddress.com/github.global.ssl.fastly.net#ipinfo3.打开hosts文件,并在文件末尾添加如下内容 第二步、编译ANTs1)首先安装git、cmake以及c++编译器2)编译3)配置bin目录,......
  • 使用Github Action来拉取docker镜像
    前提只需一个github账号即可注意:免费版Action每天能使用1小时,每个月33小时(基本上够用)国内网络访问github网速并不稳定,但是用来应急还是可以的拉取逻辑GitHubAction来拉取和打包镜像从github上下载压缩包上传到自己的服务器上解压加载镜像到自己的服务器上这种......
  • github.com/go-delve/delve
     对于delve在官方网站上有比较详细的说明,而且安装情况也是非常简单。我们只需要点击installation中的windows。注意:如果在模块模式下使用Go,则必须在模块目录之外执行此命令,否则Delve将作为依赖项添加到项目中。  然后我们只需要在goland中进行配置一下即可。然后添加相......
  • 发现敏感文件信息(web+google+github):网络安全案例研究
    第一部分:互联网第二部分:GitHub第三部分:GoogleDork结论作为一名安全研究人员,工作中最有意义的方面之一是发现和报告可能危及敏感信息的漏洞。在这篇博文中,将带大家了解最近在Web应用程序上发现的敏感文件信息、所使用的工具和技术以及保护敏感文件的重要性。免责声明:本博......