'; notify_content = null; notify_options = {}; alertTip = ''; $error_box = $(".flash_error.flash_error_box"); if (notify_options.type === 'error' && $error_box.length > 0 && !$.isEmptyObject(notify_content.message)) { if (notify_content.message === 'captcha_fail') { alertTip = "验证码不正确"; } else if (notify_content.message === 'captcha_expired') { alertTip = "验证码已过期,请点击刷新"; } else if (notify_content.message === 'not_found_in_database') { alertTip = "帐号或者密码错误"; } else if (notify_content.message === 'not_found_and_show_captcha') { alertTip = "帐号或者密码错误"; } else if (notify_content.message === 'phone_captcha_fail') { alertTip = "手机验证码不通过"; } else { alertTip = notify_content.message; } return $error_box.html(alertTip).show(); } else if (notify_content) { if ("show" === 'third_party_binding') { return $('#third_party_binding-message').html(notify_content.message).addClass('ui message red'); } notify_options.delay = 3000; notify_options.template = template; notify_options.offset = { x: 10, y: 30 }; notify_options.element = '#messages-container'; return $.notify(notify_content, notify_options); } }); }).call(this);
40 Star 198 Fork 58

廖曾波/APIJSON.NET

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
'); const offset = $(this).offset(); $wrapper.css({ position: 'absolute', top: offset.top, left: offset.left, marginTop: '1rem', zIndex: 1000 }); if (this.loaded) return; // destroy prev dropdown document.querySelectorAll('.ui.dropdown[data-prev-dropdown]').forEach(function(el) { el.parentNode.removeChild(el); }); const $menu = $(this).find('.menu'); $menu.css({ display: 'block', border: '1px solid rgba(34,36,38,0.15)', borderRadius: '4px', boxShadow: '0px 2px 3px 0px rgba(34, 36, 38, 0.15)' }); // 移动到 body $wrapper.append($menu); $wrapper.appendTo('body'); $wrapper.attr('data-prev-dropdown', ''); this.$menuWrapper = $wrapper; this.loaded = true; } }); })(); $('#git-project-root-actions #git-tree-file').on('click', function() { $('#git-project-root-actions .plus-box').addClass('click-active') $('#git-project-root-actions .repo-dropdown-box').addClass('transition visible') }) $('.disabled-upload-readonly').popup({ content: "只读目录不允许上传文件", className: { popup: 'ui popup', }, position: 'bottom center', }) $('.disabled-create-folder').popup({ content: "只读目录不允许创建目录", className: { popup: 'ui popup', }, position: 'bottom center', }) $('.disabled-create-file').popup({ content: "只读目录不允许创建文件", className: { popup: 'ui popup', }, position: 'bottom center', }) $('.disabled-create-submodule').popup({ content: "只读目录不允许创建子模块", className: { popup: 'ui popup', }, position: 'bottom center', }) $('.disabled-upload-readonly, .disabled-create-folder, .disabled-create-file, .disabled-create-submodule').click(function() { return false })
`   $popPanel.append(no_data_html) } var debounceLoadMoreBranches = window.globalUtils.debouce(function () { if (concurrentRequestLock) return; branch_page_number += 1; if (branch_page_number > branch_total_pager) return; loadData(search_text, branch_page_number); }, 350); function loadData(search, page) { if (concurrentRequestLock) { return; } concurrentRequestLock = true; var searchParams = search || ""; var pageParams = page || 1; $.ajax({ url: "/" + gon.user_project + "/branches/names.json", type: 'GET', data: { search: searchParams, page: pageParams, }, dataType: 'json', success: function (data) { branch_total_pager = data.total_pages; var html = ''; if (pageParams === 1) { $branchesDropdown.empty(); } data.branches.forEach(function (branch) { var protectRule = ''; var branchName = filterXSS(branch.name); var icon = 'gitee:branch' if(branch.branch_type.value === 1) { var rule = filterXSS(branch.protection_rule.wildcard); protectRule = ` ` icon ='gitee:pen-lock' }else if(branch.branch_type.value === 2) { icon ='gitee:pen-ban' } var branchIcon = `` html += `
${branchIcon} ${branchName} ${protectRule}
` }); $branchesDropdown.append(html); $('.protected-branch-popup').popup() if (pageParams === 1 && data.count === 0) { toggleNoResultView($branchesDropdown); } }, complete: function () { concurrentRequestLock = false; } }); } $tagsDropdown.scroll(function() { var tagsPanel = document.getElementById('tags_panel'); var numOfTags = $tagsDropdown.children().length; if (tagsPanel.clientHeight + tagsPanel.scrollTop + 37 > tagsPanel.scrollHeight && numOfTags < 0) { debounceLoadMore.call(); } }); var debounceLoadMore = window.globalUtils.debouce(function () { if (flag_is_loading) return; flag_page_number += 1; if (flag_page_number > flag_total_pager) return; fetchTags(search_text, flag_page_number); }, 350); function fetchTags(search, page) { var searchParams = search || ""; var pageParams = page || 1; if (flag_is_loading) return; flag_is_loading = true; $.ajax({ url: "/" + gon.user_project + "/tags/names.json", data: { search: searchParams, page: pageParams, }, type: "GET", xhrFields: { withCredentials: true, }, success: function (data) { flag_total_pager = data.total_pages; if (pageParams === 1) { $tagsDropdown.html(''); } data.tags.forEach((tag) => { const itemDiv = document.createElement('div'); itemDiv.classList.add('item'); itemDiv.setAttribute('data-value', tag.name); itemDiv.innerText = window.filterXSS(tag.name); $tagsDropdown.append(itemDiv) }); if (pageParams === 1 && data.count === 0) { toggleNoResultView($tagsDropdown); } }, error: function () { }, complete: function () { flag_is_loading = false; }, }); } $('.project-branch-tab-menu').on('click','.tab-menu-item', function (e) { var $currentTab = $(this).data('tab') if($currentTab === 'branches') { $searchNameInput.val('') search_text = ''; loadData() } if($currentTab === 'tags') { $searchNameInput.val('') search_text = ''; fetchTags(); } })
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
'); const offset = $(this).offset(); $wrapper.css({ position: 'absolute', top: offset.top, left: offset.left, marginTop: '1rem', zIndex: 1000 }); if (this.loaded) return; // destroy prev dropdown document.querySelectorAll('.ui.dropdown[data-prev-dropdown]').forEach(function(el) { el.parentNode.removeChild(el); }); const $menu = $(this).find('.menu'); $menu.css({ display: 'block', border: '1px solid rgba(34,36,38,0.15)', borderRadius: '4px', boxShadow: '0px 2px 3px 0px rgba(34, 36, 38, 0.15)' }); // 移动到 body $wrapper.append($menu); $wrapper.appendTo('body'); $wrapper.attr('data-prev-dropdown', ''); this.$menuWrapper = $wrapper; this.loaded = true; } }); })(); $('#git-project-root-actions #git-tree-file').on('click', function() { $('#git-project-root-actions .plus-box').addClass('click-active') $('#git-project-root-actions .repo-dropdown-box').addClass('transition visible') }) $('.disabled-upload-readonly').popup({ content: "只读目录不允许上传文件", className: { popup: 'ui popup', }, position: 'bottom center', }) $('.disabled-create-folder').popup({ content: "只读目录不允许创建目录", className: { popup: 'ui popup', }, position: 'bottom center', }) $('.disabled-create-file').popup({ content: "只读目录不允许创建文件", className: { popup: 'ui popup', }, position: 'bottom center', }) $('.disabled-create-submodule').popup({ content: "只读目录不允许创建子模块", className: { popup: 'ui popup', }, position: 'bottom center', }) $('.disabled-upload-readonly, .disabled-create-folder, .disabled-create-file, .disabled-create-submodule').click(function() { return false })
AppModule.cs 4.36 KB
一键复制 编辑 原始数据 按行查看 历史
廖曾波 提交于 2024-02-04 15:51 +08:00 . #升级到.NET8#
using APIJSON.Data;
using APIJSON.Data.Models;
using APIJSON.NET.Data;
using APIJSON.NET.Data.Models;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Cors;
using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using Microsoft.IdentityModel.Tokens;
using Microsoft.OpenApi.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.Json;
using Volo.Abp;
using Volo.Abp.AspNetCore.Mvc;
using Volo.Abp.AspNetCore.Serilog;
using Volo.Abp.Autofac;
using Volo.Abp.Modularity;
using Volo.Abp.Swashbuckle;
namespace APIJSON.NET;
[DependsOn(
typeof(AbpAspNetCoreMvcModule),
typeof(AbpAutofacModule),
typeof(AbpAspNetCoreSerilogModule),
typeof(AbpSwashbuckleModule),
typeof(ApiJsonNetDataModule))]
public class AppModule : AbpModule
{
public override void ConfigureServices(ServiceConfigurationContext context)
{
var configuration = context.Services.GetConfiguration();
var hostingEnvironment = context.Services.GetHostingEnvironment();
PreConfigure<JsonSerializerOptions>(options =>
{
options.PropertyNamingPolicy = JsonNamingPolicy.CamelCase;
});
ConfigureCors(context, configuration);
ConfigureSwaggerServices(context, configuration);
context.Services.Configure<List<Role>>(configuration.GetSection("RoleList"));
context.Services.Configure<Dictionary<string, string>>(configuration.GetSection("tablempper"));
context.Services.Configure<TokenAuthConfiguration>(tokenAuthConfig =>
{
tokenAuthConfig.SecurityKey = new SymmetricSecurityKey(Encoding.ASCII.GetBytes(configuration["Authentication:JwtBearer:SecurityKey"]));
tokenAuthConfig.Issuer = configuration["Authentication:JwtBearer:Issuer"];
tokenAuthConfig.Audience = configuration["Authentication:JwtBearer:Audience"];
tokenAuthConfig.SigningCredentials = new SigningCredentials(tokenAuthConfig.SecurityKey, SecurityAlgorithms.HmacSha256);
tokenAuthConfig.Expiration = TimeSpan.FromDays(1);
});
AuthConfigurer.Configure(context.Services,configuration);
context.Services.AddSingleton<IHttpContextAccessor, HttpContextAccessor>();
}
private static void ConfigureSwaggerServices(ServiceConfigurationContext context, IConfiguration configuration)
{
context.Services.AddAbpSwaggerGen(
options =>
{
options.SwaggerDoc("v1", new OpenApiInfo { Title = "APIJSON.NET API", Version = "v1" });
options.DocInclusionPredicate((docName, description) => true);
options.CustomSchemaIds(type => type.FullName);
});
}
private void ConfigureCors(ServiceConfigurationContext context, IConfiguration configuration)
{
context.Services.AddCors(options =>
{
options.AddDefaultPolicy(builder =>
{
builder
.WithOrigins(configuration["CorsUrls"]?
.Split(",", StringSplitOptions.RemoveEmptyEntries)
.Select(o => o.RemovePostFix("/"))
.ToArray() ?? Array.Empty<string>())
.WithAbpExposedHeaders()
.SetIsOriginAllowedToAllowWildcardSubdomains()
.AllowAnyHeader()
.AllowAnyMethod()
.AllowCredentials();
});
});
}
public override void OnApplicationInitialization(ApplicationInitializationContext context)
{
var app = context.GetApplicationBuilder();
var env = context.GetEnvironment();
if (env.IsDevelopment())
{
app.UseDeveloperExceptionPage();
}
app.UseAbpRequestLocalization();
app.UseCorrelationId();
app.UseStaticFiles();
app.UseRouting();
app.UseCors();
app.UseAuthentication();
app.UseAuthorization();
app.UseSwagger();
app.UseAbpSwaggerUI(options =>
{
options.SwaggerEndpoint("/swagger/v1/swagger.json", "MyProjectName API");
});
app.UseAbpSerilogEnrichers();
app.UseConfiguredEndpoints();
app.UseJwtTokenMiddleware();
DbInit.Initialize(app);
}
}
Loading...
"; } $complainCommentType.find('.menu').html(result); } }); $complainCommentType.dropdown({showOnFocus: false}); initedCommentsType = true; } } $complainCommentType.on('click', function() { $complaintCommentsModal.modal({ autofocus: false, onApprove: function() { return false; }, onHidden: function() { restoreCommonentDefault(); } }).modal('show'); }); $complaintCommentsContent.on('change keyup', function(e) { var content = $(this).val(); if ($.trim(content).length > 0 && $complainCommentType.dropdown('get value').length > 0 ) { $complaintCommentBtn.removeClass('disabled'); return; } $complaintCommentBtn.addClass('disabled'); }); $complainCommentType.dropdown({ showOnFocus: false, onChange: function(value, text, $selectedItem) { if (value.length > 0 && $.trim($complaintCommentsContent.val()).length > 0) { $complaintCommentBtn.removeClass('disabled'); return } $complaintCommentBtn.addClass('disabled'); } }); function restoreCommonentDefault() { $complainCommentType.dropdown('restore defaults'); $complaintCommentsContent.val(''); $('.exceeded-size-tip').text('').hide(); $complaintModalTip.text('').hide(); setTimeout(function() { setCommentSendTip(false); }, 1500); } $complaintCommentBtn.on('click',function(e){ var reason = $complaintCommentsContent.val(); var appealableId = $('#landing-comments-complaint-modal').attr('data-id'); if (complaintSending) { return; } var appealType = $complainCommentType.dropdown('get value'); var formData = new FormData(); formData.append('appeal_type_id', appealType); formData.append('reason', reason); formData.append('appeal_type','Note'); formData.append('target_id',appealableId); $.ajax({ type: 'POST', url: "/appeals", cache: false, contentType: false, processData: false, data: formData, beforeSend: function() { setCommentSendStatus(true); }, success: function(res) { if (res.status == 200) { setCommentSendTip(true); setTimeout(function() { $complaintCommentsModal.modal('hide'); restoreCommonentDefault(); }, 3000); } setCommentSendStatus(false); }, error: function(err) { showCommonTips(err.responseJSON.message, 'error'); setCommentSendStatus(false); } }) }); function showCommonTips(text, type) { $complaintModalTip.text(text).show(); if (type == 'error') { $complaintModalTip.removeClass('success').addClass('error'); } else { $complaintModalTip.removeClass('error').addClass('success'); } } function setCommentSendStatus(value) { complaintSending = value; if (complaintSending) { $complaintCommentBtn.addClass('loading'); $complaintCommentsContent.attr('readonly', true); $complainCommentType.attr('readonly', true); } else { $complaintCommentBtn.removeClass('loading'); $complaintCommentsContent.attr('readonly', false); $complainCommentType.attr('readonly', false); } } function setCommentSendTip(value) { if (value) { $('.appeal-success-tip').removeClass('hide'); $('.appeal-tip').addClass('hide'); $('.appeal-form').addClass('hide'); $('#landing-comments-complaint-modal .actions').addClass('hide'); } else { $('.appeal-success-tip').addClass('hide'); $('.appeal-tip').removeClass('hide'); $('.appeal-form').removeClass('hide'); $('#landing-comments-complaint-modal .actions').removeClass('hide'); } }
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
C#
1
https://gitee.com/liaozb/APIJSON.NET.git
[email protected]:liaozb/APIJSON.NET.git
liaozb
APIJSON.NET
APIJSON.NET
master

搜索帮助