小编Car*_*pon的帖子

在商业软件中分发jquery许可证

我正在构建一个使用jquery的商业Web应用程序.我认为我需要将MIT许可证用于jquery,因为该应用程序是商业的.当我在维基百科看到麻省理工学院的许可证时,它说:

"这是一个许可许可,意味着它允许在专有软件中重复使用,条件是许可证随软件一起分发 "

我的问题是你如何在Web应用程序中分发许可证?用户第一次使用网站时是否必须接受许可?或者我是否将许可证包含在关于页面中?

jquery

6
推荐指数
2
解决办法
6613
查看次数

VSCode 调试器在 Jest 测试中不起作用

我正在努力让 Visual Studio Code 调试器与 Jest 测试一起工作。

这是我的launch.json:

{
  "version": "0.2.0",
  "configurations": [
    {
      "type": "node",
      "request": "launch",
      "name": "Jest All",
      "program": "${workspaceFolder}/node_modules/jest/bin/jest",
      "args": ["--runInBand"],
      "console": "integratedTerminal",
      "internalConsoleOptions": "neverOpen",
      "sourceMaps": true
    }
  ]
}
Run Code Online (Sandbox Code Playgroud)

这是我的带有几个断点的 Jest 测试:

在此处输入图片说明

当我点击绿色播放按钮使用调试器运行测试时,断点永远不会被击中。

任何帮助,将不胜感激

jestjs visual-studio-code stenciljs

6
推荐指数
2
解决办法
4637
查看次数

通过 AddIdentityServer 向 IdentityServer 设置添加声明

我有一个 SPA,它有一个 ASP.NET Core Web API 以及内置身份服务器AddIdentityServer,然后使用AddIdentityServerJwt

services.AddIdentityServer()
   .AddApiAuthorization<User, UserDataContext>();
services.AddAuthentication()
   .AddIdentityServerJwt();
Run Code Online (Sandbox Code Playgroud)

我还有一个需要“管理员”角色声明的授权策略设置:

services.AddAuthorization(options =>
{
    options.AddPolicy("IsAdmin", policy => policy.RequireClaim(ClaimTypes.Role, "Admin")); 
});
Run Code Online (Sandbox Code Playgroud)

我有一个使用此策略的控制器操作

[Authorize(Policy = "IsAdmin")]
[HttpDelete("{id}")]
public IActionResult Deleten(int id)
{
    ...
}
Run Code Online (Sandbox Code Playgroud)

经过身份验证的用户确实具有“管理员”角色声明:

在此处输入图片说明

此身份验证用户的访问令牌似乎不包含 admin 声明:

在此处输入图片说明

尝试向管理员用户请求此资源时,我收到了 403:

在此处输入图片说明

所以,如果我理解正确的话,IdentityServer 不包括管理员角色声明,因此用户无权访问资源。

是否可以配置 IdentityServer 使用的声明AddIdentityServerJwt?或者我误解了为什么这不起作用。

jwt openid-connect asp.net-core identityserver4

6
推荐指数
2
解决办法
4837
查看次数

VSTO和Office 2010

VSTO 2008是否适用于Office 2010,还是仅限VSTO 2010?如果它是VSTO 2010那么这是否意味着我必须将我的所有客户端更新到.NET 4.0?

.net vb.net outlook vsto ms-office

5
推荐指数
1
解决办法
682
查看次数

Stenciljs @Method不工作

我正努力让stenciljs的@Method工作 - 任何帮助都会受到赞赏.

这是我的组件代码,其中包含一个名为setName的函数,我希望在我的组件上公开:

import { Component, Prop, Method, State } from "@stencil/core";

@Component({
  tag: "my-name",
  shadow: true
})
export class MyComponent {

  @Prop() first: string;
  @Prop() last: string;
  @State() dummy: string;

  @Method() setName(first: string, last: string): void {
    this.first = first;
    this.last = last;
    this.dummy = first + last;
  }
  render(): JSX.Element {
    return (
      <div>
        Hello, World! I'm {this.first} {this.last}
      </div>
    );
  }
}
Run Code Online (Sandbox Code Playgroud)

这是引用该组件的html和脚本:

<!DOCTYPE html>
<html dir="ltr" lang="en">
<head>
  <meta charset="utf-8">
  <meta …
Run Code Online (Sandbox Code Playgroud)

javascript web-component stenciljs stencil-component

5
推荐指数
2
解决办法
1145
查看次数

web.config重写规则在Blob存储中的Azure静态网站中不起作用

我在Azure Blob存储中托管了一个页面的React应用程序,但正在获取所请求的内容不存在。深入链接到页面时出错:

在此处输入图片说明

我已在存储帐户中启用了静态网站选项

在此处输入图片说明

这些文件都放在$ web容器中:

在此处输入图片说明

这包括以下带有重写规则的web.config,该规则应让index.html处理所有路由:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <system.webServer>
    <rewrite>
      <rules>
        <rule name="React Routes" stopProcessing="true">
          <match url=".*" />
          <conditions logicalGrouping="MatchAll">
            <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
            <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
          </conditions>
          <action type="Rewrite" url="/" appendQueryString="true" />
        </rule>
      </rules>
    </rewrite>
  </system.webServer>
</configuration>
Run Code Online (Sandbox Code Playgroud)

谁能看到我哪里出问题了?

asp.net azure azure-storage reactjs

5
推荐指数
2
解决办法
908
查看次数

身份服务器注册不会重定向回 React 应用程序

我有一个 ASP.NET Core 后端,其中一个 React 前端托管在不同的来源。

ASP.NET 核心后端配置为使用内置身份服务器:

// Startup
public void ConfigureServices(IServiceCollection services)
{
  ...
  services.AddIdentityServer()
    .AddApiAuthorization<ApplicationUser, ApplicationDbContext>();
  ...
}
Run Code Online (Sandbox Code Playgroud)

我添加了OidcConfigurationController身份服务器期望的:

public class OidcConfigurationController : Controller
{
    public OidcConfigurationController(IClientRequestParametersProvider clientRequestParametersProvider)
    {
        ClientRequestParametersProvider = clientRequestParametersProvider;
    }

    public IClientRequestParametersProvider ClientRequestParametersProvider { get; }

    [HttpGet("_configuration/{clientId}")]
    public IActionResult GetClientRequestParameters([FromRoute]string clientId)
    {
        var parameters = ClientRequestParametersProvider.GetClientParameters(HttpContext, clientId);
        return Ok(parameters);
    }
}
Run Code Online (Sandbox Code Playgroud)

我还添加了以下设置,appsettings.json以便身份服务器读取:

...
"IdentityServer": {
  "Clients": {
    "WebApplication1": {
      "Profile": "SPA",
      "RedirectUri": "http://localhost:3000/authentication/login-callback",
      "LogoutUri": "http://localhost:3000/authentication/logout-callback"
    }
  }
},
...
Run Code Online (Sandbox Code Playgroud)

React …

reactjs openid-connect asp.net-core identityserver4

5
推荐指数
1
解决办法
2194
查看次数

使用INotifyPropertyChanged绑定到Silverlight中的字典

在Silverlight中,我无法让INotifyPropertyChanged在绑定到字典时像我想要的那样工作.在下面的示例中,页面可以正常绑定到字典,但是当我更改其中一个文本框的内容时,不会调用CustomProperties属性setter.CustomProperties属性设置器仅在设置CustomProperties时调用,而不是在设置其中的值时调用.我试图对字典值进行一些验证,所以我希望在字典中的每个值都改变时运行一些代码.我能在这做什么吗?

C#

public partial class MainPage : UserControl
{

    public MainPage()
    {
        InitializeComponent();

        MyEntity ent = new MyEntity();
        ent.CustomProperties.Add("Title", "Mr");
        ent.CustomProperties.Add("FirstName", "John");
        ent.CustomProperties.Add("Name", "Smith");

        this.DataContext = ent;
    }

}

public class MyEntity : INotifyPropertyChanged
{

    public event PropertyChangedEventHandler System.ComponentModel.INotifyPropertyChanged.PropertyChanged;
    public delegate void PropertyChangedEventHandler(object sender, System.ComponentModel.PropertyChangedEventArgs e);

    private Dictionary<string, object> _customProps;
    public Dictionary<string, object> CustomProperties {
        get {
            if (_customProps == null) {
                _customProps = new Dictionary<string, object>();
            }
            return _customProps;
        }
        set {
            _customProps = value;
            if (PropertyChanged != null) …
Run Code Online (Sandbox Code Playgroud)

.net c# data-binding silverlight inotifypropertychanged

4
推荐指数
2
解决办法
8556
查看次数

Kendo UI图表颜色

我在配置Kendo UI柱形图的条形颜色时遇到问题.这是代码:

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title></title>
</head>
<body>
    <div id="chart"></div>
    <script src="js/thirdParty/jquery.js"></script>
    <script src="js/thirdParty/kendo.all.min.js"></script>
    <script>
        $(function () {
            var data,
                dataSource;
            data = [{
                type: "C1",
                amount: 100,
                year: 2008,
                color: "red"
            }, {
                type: "C2",
                amount: 120,
                year: 2008,
                color: "blue"
            }, {
                type: "C2",
                amount: 50,
                year: 2009,
                color: "blue"
            }, {
                type: "C1",
                amount: 10,
                year: 2010,
                color: "red"
            }, {
                type: "C1",
                amount: 120,
                year: 2011,
                color: "red"
            }, {
                type: "C2",
                amount: 50, …
Run Code Online (Sandbox Code Playgroud)

javascript jquery telerik kendo-ui

4
推荐指数
1
解决办法
2万
查看次数

React 应用程序中的 addEventListener 不起作用

一些背景: 我正在尝试在 React 应用程序中使用自定义 Web 组件并尝试侦听来自 Web 组件的事件。我相信您不能只在自定义 Web 组件上以通常的反应方式处理事件。

IE

<custom-button onClick={this.clickHandler}></custom-button>.  
Run Code Online (Sandbox Code Playgroud)

我试过这个,但没有用。

问题: 所以,我正在尝试通过addEventListener监听事件,就像在 vanilla js 中所做的那样,但事件处理程序永远不会被调用。

下面是一个例子。我知道<button/>这不是自定义 Web 组件,但它说明了问题:

import React, { Component } from "react";

class App extends Component {
  constructor(props) {
    super(props);
    this.buttonRef = React.createRef();
  }
  componentDidMount() {
    // there are no errors attaching the handler
    this.buttonRef.current.addEventListener("onClick", e => {
      // this point is never reached
      debugger;
      console.log("onClick", e);
    });
  }
  render() {
    return <button ref={this.buttonRef}>click me</button>;
  }
} …
Run Code Online (Sandbox Code Playgroud)

javascript web-component reactjs

4
推荐指数
1
解决办法
1万
查看次数