mirror of
https://github.com/microsoft/monaco-editor.git
synced 2025-12-22 05:50:11 +01:00
CRLF -> LF
This commit is contained in:
parent
d7ac67dbf8
commit
aa75ddccbb
42 changed files with 41762 additions and 41762 deletions
|
|
@ -1,33 +1,33 @@
|
|||
|
||||
"use strict";
|
||||
function Person(age) {
|
||||
if (age) {
|
||||
this.age = age;
|
||||
}
|
||||
}
|
||||
Person.prototype.getAge = function () {
|
||||
return this.age;
|
||||
};
|
||||
|
||||
function Student(age, grade) {
|
||||
Person.call(this, age);
|
||||
this.grade = grade;
|
||||
}
|
||||
Student.prototype = new Person();
|
||||
Student.prototype.getGrade = function () {
|
||||
return this.grade;
|
||||
};
|
||||
|
||||
var s = new Student(24, 5.75);
|
||||
//var age = s.
|
||||
|
||||
//delete s.age;
|
||||
//s.getAge = function() { return {foo:"bar"}; };
|
||||
//s.
|
||||
//s.getAge().
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
"use strict";
|
||||
function Person(age) {
|
||||
if (age) {
|
||||
this.age = age;
|
||||
}
|
||||
}
|
||||
Person.prototype.getAge = function () {
|
||||
return this.age;
|
||||
};
|
||||
|
||||
function Student(age, grade) {
|
||||
Person.call(this, age);
|
||||
this.grade = grade;
|
||||
}
|
||||
Student.prototype = new Person();
|
||||
Student.prototype.getGrade = function () {
|
||||
return this.grade;
|
||||
};
|
||||
|
||||
var s = new Student(24, 5.75);
|
||||
//var age = s.
|
||||
|
||||
//delete s.age;
|
||||
//s.getAge = function() { return {foo:"bar"}; };
|
||||
//s.
|
||||
//s.getAge().
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
|
|
@ -1,10 +1,10 @@
|
|||
/*
|
||||
|
||||
전문
|
||||
유구한 역사와 전통에 빛나는 우리 대한 국민은 3·1 운동으로 건립된 대한민국 임시 정부의 법통과 불의에 항거한 4·19 민주 이념을 계승하고, 조국의 민주 개혁과 평화적 통일의 사명에 입각하여 정의·인도와 동포애로써 민족의 단결을 공고히 하고, 모든 사회적 폐습과 불의를 타파하며, 자율과 조화를 바탕으로 자유 민주적 기본 질서를 더욱 확고히 하여 정치·경제·사회·문화의 모든 영역에 있어서 각인의 기회를 균등히 하고, 능력을 최고도로 발휘하게 하며, 자유와 권리에 따르는 책임과 의무를 완수하게 하여, 안으로는 국민 생활의 균등한 향상을 기하고 밖으로는 항구적인 세계 평화와 인류 공영에 이바지함으로써 우리들과 우리들의 자손의 안전과 자유와 행복을 영원히 확보할 것을 다짐하면서 1948년 7월 12일에 제정되고 8차에 걸쳐 개정된 헌법을 이제 국회의 의결을 거쳐 국민 투표에 의하여 개정한다.
|
||||
1987년 10월 29일
|
||||
前文
|
||||
悠久한 歷史와 傳統에 빛나는 우리 大韓國民은 3·1 運動으로 建立된 大韓民國臨時政府의 法統과 不義에 抗拒한 4·19 民主理念을 繼承하고, 祖國의 民主改革과 平和的統一의 使命에 立脚하여 正義·人道와 同胞愛로써 民族의 團結을 鞏固히 하고, 모든 社會的弊習과 不義를 打破하며, 自律과 調和를 바탕으로 自由民主的基本秩序를 더욱 確固히 하여 政治·經濟·社會·文化의 모든 領域에 있어서 各人의 機會를 均等히 하고, 能力을 最高度로 發揮하게 하며, 自由와 權利에 따르는 責任과 義務를 完遂하게 하여, 안으로는 國民生活의 均等한 向上을 基하고 밖으로는 恒久的인 世界平和와 人類共榮에 이바지함으로써 우리들과 우리들의 子孫의 安全과 自由와 幸福을 永遠히 確保할 것을 다짐하면서 1948年 7月 12日에 制定되고 8次에 걸쳐 改正된 憲法을 이제 國會의 議決을 거쳐 國民投票에 依하여 改正한다.
|
||||
1987年 10月 29日
|
||||
|
||||
/*
|
||||
|
||||
전문
|
||||
유구한 역사와 전통에 빛나는 우리 대한 국민은 3·1 운동으로 건립된 대한민국 임시 정부의 법통과 불의에 항거한 4·19 민주 이념을 계승하고, 조국의 민주 개혁과 평화적 통일의 사명에 입각하여 정의·인도와 동포애로써 민족의 단결을 공고히 하고, 모든 사회적 폐습과 불의를 타파하며, 자율과 조화를 바탕으로 자유 민주적 기본 질서를 더욱 확고히 하여 정치·경제·사회·문화의 모든 영역에 있어서 각인의 기회를 균등히 하고, 능력을 최고도로 발휘하게 하며, 자유와 권리에 따르는 책임과 의무를 완수하게 하여, 안으로는 국민 생활의 균등한 향상을 기하고 밖으로는 항구적인 세계 평화와 인류 공영에 이바지함으로써 우리들과 우리들의 자손의 안전과 자유와 행복을 영원히 확보할 것을 다짐하면서 1948년 7월 12일에 제정되고 8차에 걸쳐 개정된 헌법을 이제 국회의 의결을 거쳐 국민 투표에 의하여 개정한다.
|
||||
1987년 10월 29일
|
||||
前文
|
||||
悠久한 歷史와 傳統에 빛나는 우리 大韓國民은 3·1 運動으로 建立된 大韓民國臨時政府의 法統과 不義에 抗拒한 4·19 民主理念을 繼承하고, 祖國의 民主改革과 平和的統一의 使命에 立脚하여 正義·人道와 同胞愛로써 民族의 團結을 鞏固히 하고, 모든 社會的弊習과 不義를 打破하며, 自律과 調和를 바탕으로 自由民主的基本秩序를 더욱 確固히 하여 政治·經濟·社會·文化의 모든 領域에 있어서 各人의 機會를 均等히 하고, 能力을 最高度로 發揮하게 하며, 自由와 權利에 따르는 責任과 義務를 完遂하게 하여, 안으로는 國民生活의 均等한 向上을 基하고 밖으로는 恒久的인 世界平和와 人類共榮에 이바지함으로써 우리들과 우리들의 子孫의 安全과 自由와 幸福을 永遠히 確保할 것을 다짐하면서 1948年 7月 12日에 制定되고 8次에 걸쳐 改正된 憲法을 이제 國會의 議決을 거쳐 國民投票에 依하여 改正한다.
|
||||
1987年 10月 29日
|
||||
|
||||
*/
|
||||
|
|
@ -1,493 +1,493 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Net.Http;
|
||||
using System.Security.Claims;
|
||||
using System.Security.Cryptography;
|
||||
using System.Threading.Tasks;
|
||||
using System.Web;
|
||||
using System.Web.Http;
|
||||
using System.Web.Http.ModelBinding;
|
||||
using Microsoft.AspNet.Identity;
|
||||
using Microsoft.AspNet.Identity.EntityFramework;
|
||||
using Microsoft.AspNet.Identity.Owin;
|
||||
using Microsoft.Owin.Security;
|
||||
using Microsoft.Owin.Security.Cookies;
|
||||
using Microsoft.Owin.Security.OAuth;
|
||||
using WebApplication.Models;
|
||||
using WebApplication.Providers;
|
||||
using WebApplication.Results;
|
||||
|
||||
namespace WebApplication.Controllers
|
||||
{
|
||||
[Authorize]
|
||||
[RoutePrefix("api/Account")]
|
||||
public class AccountController : ApiController
|
||||
{
|
||||
private const string LocalLoginProvider = "Local";
|
||||
private ApplicationUserManager _userManager;
|
||||
|
||||
public AccountController()
|
||||
{
|
||||
}
|
||||
|
||||
public AccountController(ApplicationUserManager userManager,
|
||||
ISecureDataFormat<AuthenticationTicket> accessTokenFormat)
|
||||
{
|
||||
UserManager = userManager;
|
||||
AccessTokenFormat = accessTokenFormat;
|
||||
}
|
||||
|
||||
public ApplicationUserManager UserManager
|
||||
{
|
||||
get
|
||||
{
|
||||
return _userManager ?? Request.GetOwinContext().GetUserManager<ApplicationUserManager>();
|
||||
}
|
||||
private set
|
||||
{
|
||||
_userManager = value;
|
||||
}
|
||||
}
|
||||
|
||||
public ISecureDataFormat<AuthenticationTicket> AccessTokenFormat { get; private set; }
|
||||
|
||||
// GET api/Account/UserInfo
|
||||
[HostAuthentication(DefaultAuthenticationTypes.ExternalBearer)]
|
||||
[Route("UserInfo")]
|
||||
public UserInfoViewModel GetUserInfo()
|
||||
{
|
||||
ExternalLoginData externalLogin = ExternalLoginData.FromIdentity(User.Identity as ClaimsIdentity);
|
||||
|
||||
return new UserInfoViewModel
|
||||
{
|
||||
Email = User.Identity.GetUserName(),
|
||||
HasRegistered = externalLogin == null,
|
||||
LoginProvider = externalLogin != null ? externalLogin.LoginProvider : null
|
||||
};
|
||||
}
|
||||
|
||||
// POST api/Account/Logout
|
||||
[Route("Logout")]
|
||||
public IHttpActionResult Logout()
|
||||
{
|
||||
Authentication.SignOut(CookieAuthenticationDefaults.AuthenticationType);
|
||||
return Ok();
|
||||
}
|
||||
|
||||
// GET api/Account/ManageInfo?returnUrl=%2F&generateState=true
|
||||
[Route("ManageInfo")]
|
||||
public async Task<ManageInfoViewModel> GetManageInfo(string returnUrl, bool generateState = false)
|
||||
{
|
||||
IdentityUser user = await UserManager.FindByIdAsync(User.Identity.GetUserId());
|
||||
|
||||
if (user == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
List<UserLoginInfoViewModel> logins = new List<UserLoginInfoViewModel>();
|
||||
|
||||
foreach (IdentityUserLogin linkedAccount in user.Logins)
|
||||
{
|
||||
logins.Add(new UserLoginInfoViewModel
|
||||
{
|
||||
LoginProvider = linkedAccount.LoginProvider,
|
||||
ProviderKey = linkedAccount.ProviderKey
|
||||
});
|
||||
}
|
||||
|
||||
if (user.PasswordHash != null)
|
||||
{
|
||||
logins.Add(new UserLoginInfoViewModel
|
||||
{
|
||||
LoginProvider = LocalLoginProvider,
|
||||
ProviderKey = user.UserName,
|
||||
});
|
||||
}
|
||||
|
||||
return new ManageInfoViewModel
|
||||
{
|
||||
LocalLoginProvider = LocalLoginProvider,
|
||||
Email = user.UserName,
|
||||
Logins = logins,
|
||||
ExternalLoginProviders = GetExternalLogins(returnUrl, generateState)
|
||||
};
|
||||
}
|
||||
|
||||
// POST api/Account/ChangePassword
|
||||
[Route("ChangePassword")]
|
||||
public async Task<IHttpActionResult> ChangePassword(ChangePasswordBindingModel model)
|
||||
{
|
||||
if (!ModelState.IsValid)
|
||||
{
|
||||
return BadRequest(ModelState);
|
||||
}
|
||||
|
||||
IdentityResult result = await UserManager.ChangePasswordAsync(User.Identity.GetUserId(), model.OldPassword,
|
||||
model.NewPassword);
|
||||
|
||||
if (!result.Succeeded)
|
||||
{
|
||||
return GetErrorResult(result);
|
||||
}
|
||||
|
||||
return Ok();
|
||||
}
|
||||
|
||||
// POST api/Account/SetPassword
|
||||
[Route("SetPassword")]
|
||||
public async Task<IHttpActionResult> SetPassword(SetPasswordBindingModel model)
|
||||
{
|
||||
if (!ModelState.IsValid)
|
||||
{
|
||||
return BadRequest(ModelState);
|
||||
}
|
||||
|
||||
IdentityResult result = await UserManager.AddPasswordAsync(User.Identity.GetUserId(), model.NewPassword);
|
||||
|
||||
if (!result.Succeeded)
|
||||
{
|
||||
return GetErrorResult(result);
|
||||
}
|
||||
|
||||
return Ok();
|
||||
}
|
||||
|
||||
// POST api/Account/AddExternalLogin
|
||||
[Route("AddExternalLogin")]
|
||||
public async Task<IHttpActionResult> AddExternalLogin(AddExternalLoginBindingModel model)
|
||||
{
|
||||
if (!ModelState.IsValid)
|
||||
{
|
||||
return BadRequest(ModelState);
|
||||
}
|
||||
|
||||
Authentication.SignOut(DefaultAuthenticationTypes.ExternalCookie);
|
||||
|
||||
AuthenticationTicket ticket = AccessTokenFormat.Unprotect(model.ExternalAccessToken);
|
||||
|
||||
if (ticket == null || ticket.Identity == null || (ticket.Properties != null
|
||||
&& ticket.Properties.ExpiresUtc.HasValue
|
||||
&& ticket.Properties.ExpiresUtc.Value < DateTimeOffset.UtcNow))
|
||||
{
|
||||
return BadRequest("External login failure.");
|
||||
}
|
||||
|
||||
ExternalLoginData externalData = ExternalLoginData.FromIdentity(ticket.Identity);
|
||||
|
||||
if (externalData == null)
|
||||
{
|
||||
return BadRequest("The external login is already associated with an account.");
|
||||
}
|
||||
|
||||
IdentityResult result = await UserManager.AddLoginAsync(User.Identity.GetUserId(),
|
||||
new UserLoginInfo(externalData.LoginProvider, externalData.ProviderKey));
|
||||
|
||||
if (!result.Succeeded)
|
||||
{
|
||||
return GetErrorResult(result);
|
||||
}
|
||||
|
||||
return Ok();
|
||||
}
|
||||
|
||||
// POST api/Account/RemoveLogin
|
||||
[Route("RemoveLogin")]
|
||||
public async Task<IHttpActionResult> RemoveLogin(RemoveLoginBindingModel model)
|
||||
{
|
||||
if (!ModelState.IsValid)
|
||||
{
|
||||
return BadRequest(ModelState);
|
||||
}
|
||||
|
||||
IdentityResult result;
|
||||
|
||||
if (model.LoginProvider == LocalLoginProvider)
|
||||
{
|
||||
result = await UserManager.RemovePasswordAsync(User.Identity.GetUserId());
|
||||
}
|
||||
else
|
||||
{
|
||||
result = await UserManager.RemoveLoginAsync(User.Identity.GetUserId(),
|
||||
new UserLoginInfo(model.LoginProvider, model.ProviderKey));
|
||||
}
|
||||
|
||||
if (!result.Succeeded)
|
||||
{
|
||||
return GetErrorResult(result);
|
||||
}
|
||||
|
||||
return Ok();
|
||||
}
|
||||
|
||||
// GET api/Account/ExternalLogin
|
||||
[OverrideAuthentication]
|
||||
[HostAuthentication(DefaultAuthenticationTypes.ExternalCookie)]
|
||||
[AllowAnonymous]
|
||||
[Route("ExternalLogin", Name = "ExternalLogin")]
|
||||
public async Task<IHttpActionResult> GetExternalLogin(string provider, string error = null)
|
||||
{
|
||||
if (error != null)
|
||||
{
|
||||
return Redirect(Url.Content("~/") + "#error=" + Uri.EscapeDataString(error));
|
||||
}
|
||||
|
||||
if (!User.Identity.IsAuthenticated)
|
||||
{
|
||||
return new ChallengeResult(provider, this);
|
||||
}
|
||||
|
||||
ExternalLoginData externalLogin = ExternalLoginData.FromIdentity(User.Identity as ClaimsIdentity);
|
||||
|
||||
if (externalLogin == null)
|
||||
{
|
||||
return InternalServerError();
|
||||
}
|
||||
|
||||
if (externalLogin.LoginProvider != provider)
|
||||
{
|
||||
Authentication.SignOut(DefaultAuthenticationTypes.ExternalCookie);
|
||||
return new ChallengeResult(provider, this);
|
||||
}
|
||||
|
||||
ApplicationUser user = await UserManager.FindAsync(new UserLoginInfo(externalLogin.LoginProvider,
|
||||
externalLogin.ProviderKey));
|
||||
|
||||
bool hasRegistered = user != null;
|
||||
|
||||
if (hasRegistered)
|
||||
{
|
||||
Authentication.SignOut(DefaultAuthenticationTypes.ExternalCookie);
|
||||
|
||||
ClaimsIdentity oAuthIdentity = await user.GenerateUserIdentityAsync(UserManager,
|
||||
OAuthDefaults.AuthenticationType);
|
||||
ClaimsIdentity cookieIdentity = await user.GenerateUserIdentityAsync(UserManager,
|
||||
CookieAuthenticationDefaults.AuthenticationType);
|
||||
|
||||
AuthenticationProperties properties = ApplicationOAuthProvider.CreateProperties(user.UserName);
|
||||
Authentication.SignIn(properties, oAuthIdentity, cookieIdentity);
|
||||
}
|
||||
else
|
||||
{
|
||||
IEnumerable<Claim> claims = externalLogin.GetClaims();
|
||||
ClaimsIdentity identity = new ClaimsIdentity(claims, OAuthDefaults.AuthenticationType);
|
||||
Authentication.SignIn(identity);
|
||||
}
|
||||
|
||||
return Ok();
|
||||
}
|
||||
|
||||
// GET api/Account/ExternalLogins?returnUrl=%2F&generateState=true
|
||||
[AllowAnonymous]
|
||||
[Route("ExternalLogins")]
|
||||
public IEnumerable<ExternalLoginViewModel> GetExternalLogins(string returnUrl, bool generateState = false)
|
||||
{
|
||||
IEnumerable<AuthenticationDescription> descriptions = Authentication.GetExternalAuthenticationTypes();
|
||||
List<ExternalLoginViewModel> logins = new List<ExternalLoginViewModel>();
|
||||
|
||||
string state;
|
||||
|
||||
if (generateState)
|
||||
{
|
||||
const int strengthInBits = 256;
|
||||
state = RandomOAuthStateGenerator.Generate(strengthInBits);
|
||||
}
|
||||
else
|
||||
{
|
||||
state = null;
|
||||
}
|
||||
|
||||
foreach (AuthenticationDescription description in descriptions)
|
||||
{
|
||||
ExternalLoginViewModel login = new ExternalLoginViewModel
|
||||
{
|
||||
Name = description.Caption,
|
||||
Url = Url.Route("ExternalLogin", new
|
||||
{
|
||||
provider = description.AuthenticationType,
|
||||
response_type = "token",
|
||||
client_id = Startup.PublicClientId,
|
||||
redirect_uri = new Uri(Request.RequestUri, returnUrl).AbsoluteUri,
|
||||
state = state
|
||||
}),
|
||||
State = state
|
||||
};
|
||||
logins.Add(login);
|
||||
}
|
||||
|
||||
return logins;
|
||||
}
|
||||
|
||||
// POST api/Account/Register
|
||||
[AllowAnonymous]
|
||||
[Route("Register")]
|
||||
public async Task<IHttpActionResult> Register(RegisterBindingModel model)
|
||||
{
|
||||
if (!ModelState.IsValid)
|
||||
{
|
||||
return BadRequest(ModelState);
|
||||
}
|
||||
|
||||
var user = new ApplicationUser() { UserName = model.Email, Email = model.Email };
|
||||
|
||||
IdentityResult result = await UserManager.CreateAsync(user, model.Password);
|
||||
|
||||
if (!result.Succeeded)
|
||||
{
|
||||
return GetErrorResult(result);
|
||||
}
|
||||
|
||||
return Ok();
|
||||
}
|
||||
|
||||
// POST api/Account/RegisterExternal
|
||||
[OverrideAuthentication]
|
||||
[HostAuthentication(DefaultAuthenticationTypes.ExternalBearer)]
|
||||
[Route("RegisterExternal")]
|
||||
public async Task<IHttpActionResult> RegisterExternal(RegisterExternalBindingModel model)
|
||||
{
|
||||
if (!ModelState.IsValid)
|
||||
{
|
||||
return BadRequest(ModelState);
|
||||
}
|
||||
|
||||
var info = await Authentication.GetExternalLoginInfoAsync();
|
||||
if (info == null)
|
||||
{
|
||||
return InternalServerError();
|
||||
}
|
||||
|
||||
var user = new ApplicationUser() { UserName = model.Email, Email = model.Email };
|
||||
|
||||
IdentityResult result = await UserManager.CreateAsync(user);
|
||||
if (!result.Succeeded)
|
||||
{
|
||||
return GetErrorResult(result);
|
||||
}
|
||||
|
||||
result = await UserManager.AddLoginAsync(user.Id, info.Login);
|
||||
if (!result.Succeeded)
|
||||
{
|
||||
return GetErrorResult(result);
|
||||
}
|
||||
return Ok();
|
||||
}
|
||||
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing)
|
||||
{
|
||||
UserManager.Dispose();
|
||||
}
|
||||
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Helpers
|
||||
|
||||
private IAuthenticationManager Authentication
|
||||
{
|
||||
get { return Request.GetOwinContext().Authentication; }
|
||||
}
|
||||
|
||||
private IHttpActionResult GetErrorResult(IdentityResult result)
|
||||
{
|
||||
if (result == null)
|
||||
{
|
||||
return InternalServerError();
|
||||
}
|
||||
|
||||
if (!result.Succeeded)
|
||||
{
|
||||
if (result.Errors != null)
|
||||
{
|
||||
foreach (string error in result.Errors)
|
||||
{
|
||||
ModelState.AddModelError("", error);
|
||||
}
|
||||
}
|
||||
|
||||
if (ModelState.IsValid)
|
||||
{
|
||||
// No ModelState errors are available to send, so just return an empty BadRequest.
|
||||
return BadRequest();
|
||||
}
|
||||
|
||||
return BadRequest(ModelState);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private class ExternalLoginData
|
||||
{
|
||||
public string LoginProvider { get; set; }
|
||||
public string ProviderKey { get; set; }
|
||||
public string UserName { get; set; }
|
||||
|
||||
public IList<Claim> GetClaims()
|
||||
{
|
||||
IList<Claim> claims = new List<Claim>();
|
||||
claims.Add(new Claim(ClaimTypes.NameIdentifier, ProviderKey, null, LoginProvider));
|
||||
|
||||
if (UserName != null)
|
||||
{
|
||||
claims.Add(new Claim(ClaimTypes.Name, UserName, null, LoginProvider));
|
||||
}
|
||||
|
||||
return claims;
|
||||
}
|
||||
|
||||
public static ExternalLoginData FromIdentity(ClaimsIdentity identity)
|
||||
{
|
||||
if (identity == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
Claim providerKeyClaim = identity.FindFirst(ClaimTypes.NameIdentifier);
|
||||
|
||||
if (providerKeyClaim == null || String.IsNullOrEmpty(providerKeyClaim.Issuer)
|
||||
|| String.IsNullOrEmpty(providerKeyClaim.Value))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
if (providerKeyClaim.Issuer == ClaimsIdentity.DefaultIssuer)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return new ExternalLoginData
|
||||
{
|
||||
LoginProvider = providerKeyClaim.Issuer,
|
||||
ProviderKey = providerKeyClaim.Value,
|
||||
UserName = identity.FindFirstValue(ClaimTypes.Name)
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
private static class RandomOAuthStateGenerator
|
||||
{
|
||||
private static RandomNumberGenerator _random = new RNGCryptoServiceProvider();
|
||||
|
||||
public static string Generate(int strengthInBits)
|
||||
{
|
||||
const int bitsPerByte = 8;
|
||||
|
||||
if (strengthInBits % bitsPerByte != 0)
|
||||
{
|
||||
throw new ArgumentException("strengthInBits must be evenly divisible by 8.", "strengthInBits");
|
||||
}
|
||||
|
||||
int strengthInBytes = strengthInBits / bitsPerByte;
|
||||
|
||||
byte[] data = new byte[strengthInBytes];
|
||||
_random.GetBytes(data);
|
||||
return HttpServerUtility.UrlTokenEncode(data);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Net.Http;
|
||||
using System.Security.Claims;
|
||||
using System.Security.Cryptography;
|
||||
using System.Threading.Tasks;
|
||||
using System.Web;
|
||||
using System.Web.Http;
|
||||
using System.Web.Http.ModelBinding;
|
||||
using Microsoft.AspNet.Identity;
|
||||
using Microsoft.AspNet.Identity.EntityFramework;
|
||||
using Microsoft.AspNet.Identity.Owin;
|
||||
using Microsoft.Owin.Security;
|
||||
using Microsoft.Owin.Security.Cookies;
|
||||
using Microsoft.Owin.Security.OAuth;
|
||||
using WebApplication.Models;
|
||||
using WebApplication.Providers;
|
||||
using WebApplication.Results;
|
||||
|
||||
namespace WebApplication.Controllers
|
||||
{
|
||||
[Authorize]
|
||||
[RoutePrefix("api/Account")]
|
||||
public class AccountController : ApiController
|
||||
{
|
||||
private const string LocalLoginProvider = "Local";
|
||||
private ApplicationUserManager _userManager;
|
||||
|
||||
public AccountController()
|
||||
{
|
||||
}
|
||||
|
||||
public AccountController(ApplicationUserManager userManager,
|
||||
ISecureDataFormat<AuthenticationTicket> accessTokenFormat)
|
||||
{
|
||||
UserManager = userManager;
|
||||
AccessTokenFormat = accessTokenFormat;
|
||||
}
|
||||
|
||||
public ApplicationUserManager UserManager
|
||||
{
|
||||
get
|
||||
{
|
||||
return _userManager ?? Request.GetOwinContext().GetUserManager<ApplicationUserManager>();
|
||||
}
|
||||
private set
|
||||
{
|
||||
_userManager = value;
|
||||
}
|
||||
}
|
||||
|
||||
public ISecureDataFormat<AuthenticationTicket> AccessTokenFormat { get; private set; }
|
||||
|
||||
// GET api/Account/UserInfo
|
||||
[HostAuthentication(DefaultAuthenticationTypes.ExternalBearer)]
|
||||
[Route("UserInfo")]
|
||||
public UserInfoViewModel GetUserInfo()
|
||||
{
|
||||
ExternalLoginData externalLogin = ExternalLoginData.FromIdentity(User.Identity as ClaimsIdentity);
|
||||
|
||||
return new UserInfoViewModel
|
||||
{
|
||||
Email = User.Identity.GetUserName(),
|
||||
HasRegistered = externalLogin == null,
|
||||
LoginProvider = externalLogin != null ? externalLogin.LoginProvider : null
|
||||
};
|
||||
}
|
||||
|
||||
// POST api/Account/Logout
|
||||
[Route("Logout")]
|
||||
public IHttpActionResult Logout()
|
||||
{
|
||||
Authentication.SignOut(CookieAuthenticationDefaults.AuthenticationType);
|
||||
return Ok();
|
||||
}
|
||||
|
||||
// GET api/Account/ManageInfo?returnUrl=%2F&generateState=true
|
||||
[Route("ManageInfo")]
|
||||
public async Task<ManageInfoViewModel> GetManageInfo(string returnUrl, bool generateState = false)
|
||||
{
|
||||
IdentityUser user = await UserManager.FindByIdAsync(User.Identity.GetUserId());
|
||||
|
||||
if (user == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
List<UserLoginInfoViewModel> logins = new List<UserLoginInfoViewModel>();
|
||||
|
||||
foreach (IdentityUserLogin linkedAccount in user.Logins)
|
||||
{
|
||||
logins.Add(new UserLoginInfoViewModel
|
||||
{
|
||||
LoginProvider = linkedAccount.LoginProvider,
|
||||
ProviderKey = linkedAccount.ProviderKey
|
||||
});
|
||||
}
|
||||
|
||||
if (user.PasswordHash != null)
|
||||
{
|
||||
logins.Add(new UserLoginInfoViewModel
|
||||
{
|
||||
LoginProvider = LocalLoginProvider,
|
||||
ProviderKey = user.UserName,
|
||||
});
|
||||
}
|
||||
|
||||
return new ManageInfoViewModel
|
||||
{
|
||||
LocalLoginProvider = LocalLoginProvider,
|
||||
Email = user.UserName,
|
||||
Logins = logins,
|
||||
ExternalLoginProviders = GetExternalLogins(returnUrl, generateState)
|
||||
};
|
||||
}
|
||||
|
||||
// POST api/Account/ChangePassword
|
||||
[Route("ChangePassword")]
|
||||
public async Task<IHttpActionResult> ChangePassword(ChangePasswordBindingModel model)
|
||||
{
|
||||
if (!ModelState.IsValid)
|
||||
{
|
||||
return BadRequest(ModelState);
|
||||
}
|
||||
|
||||
IdentityResult result = await UserManager.ChangePasswordAsync(User.Identity.GetUserId(), model.OldPassword,
|
||||
model.NewPassword);
|
||||
|
||||
if (!result.Succeeded)
|
||||
{
|
||||
return GetErrorResult(result);
|
||||
}
|
||||
|
||||
return Ok();
|
||||
}
|
||||
|
||||
// POST api/Account/SetPassword
|
||||
[Route("SetPassword")]
|
||||
public async Task<IHttpActionResult> SetPassword(SetPasswordBindingModel model)
|
||||
{
|
||||
if (!ModelState.IsValid)
|
||||
{
|
||||
return BadRequest(ModelState);
|
||||
}
|
||||
|
||||
IdentityResult result = await UserManager.AddPasswordAsync(User.Identity.GetUserId(), model.NewPassword);
|
||||
|
||||
if (!result.Succeeded)
|
||||
{
|
||||
return GetErrorResult(result);
|
||||
}
|
||||
|
||||
return Ok();
|
||||
}
|
||||
|
||||
// POST api/Account/AddExternalLogin
|
||||
[Route("AddExternalLogin")]
|
||||
public async Task<IHttpActionResult> AddExternalLogin(AddExternalLoginBindingModel model)
|
||||
{
|
||||
if (!ModelState.IsValid)
|
||||
{
|
||||
return BadRequest(ModelState);
|
||||
}
|
||||
|
||||
Authentication.SignOut(DefaultAuthenticationTypes.ExternalCookie);
|
||||
|
||||
AuthenticationTicket ticket = AccessTokenFormat.Unprotect(model.ExternalAccessToken);
|
||||
|
||||
if (ticket == null || ticket.Identity == null || (ticket.Properties != null
|
||||
&& ticket.Properties.ExpiresUtc.HasValue
|
||||
&& ticket.Properties.ExpiresUtc.Value < DateTimeOffset.UtcNow))
|
||||
{
|
||||
return BadRequest("External login failure.");
|
||||
}
|
||||
|
||||
ExternalLoginData externalData = ExternalLoginData.FromIdentity(ticket.Identity);
|
||||
|
||||
if (externalData == null)
|
||||
{
|
||||
return BadRequest("The external login is already associated with an account.");
|
||||
}
|
||||
|
||||
IdentityResult result = await UserManager.AddLoginAsync(User.Identity.GetUserId(),
|
||||
new UserLoginInfo(externalData.LoginProvider, externalData.ProviderKey));
|
||||
|
||||
if (!result.Succeeded)
|
||||
{
|
||||
return GetErrorResult(result);
|
||||
}
|
||||
|
||||
return Ok();
|
||||
}
|
||||
|
||||
// POST api/Account/RemoveLogin
|
||||
[Route("RemoveLogin")]
|
||||
public async Task<IHttpActionResult> RemoveLogin(RemoveLoginBindingModel model)
|
||||
{
|
||||
if (!ModelState.IsValid)
|
||||
{
|
||||
return BadRequest(ModelState);
|
||||
}
|
||||
|
||||
IdentityResult result;
|
||||
|
||||
if (model.LoginProvider == LocalLoginProvider)
|
||||
{
|
||||
result = await UserManager.RemovePasswordAsync(User.Identity.GetUserId());
|
||||
}
|
||||
else
|
||||
{
|
||||
result = await UserManager.RemoveLoginAsync(User.Identity.GetUserId(),
|
||||
new UserLoginInfo(model.LoginProvider, model.ProviderKey));
|
||||
}
|
||||
|
||||
if (!result.Succeeded)
|
||||
{
|
||||
return GetErrorResult(result);
|
||||
}
|
||||
|
||||
return Ok();
|
||||
}
|
||||
|
||||
// GET api/Account/ExternalLogin
|
||||
[OverrideAuthentication]
|
||||
[HostAuthentication(DefaultAuthenticationTypes.ExternalCookie)]
|
||||
[AllowAnonymous]
|
||||
[Route("ExternalLogin", Name = "ExternalLogin")]
|
||||
public async Task<IHttpActionResult> GetExternalLogin(string provider, string error = null)
|
||||
{
|
||||
if (error != null)
|
||||
{
|
||||
return Redirect(Url.Content("~/") + "#error=" + Uri.EscapeDataString(error));
|
||||
}
|
||||
|
||||
if (!User.Identity.IsAuthenticated)
|
||||
{
|
||||
return new ChallengeResult(provider, this);
|
||||
}
|
||||
|
||||
ExternalLoginData externalLogin = ExternalLoginData.FromIdentity(User.Identity as ClaimsIdentity);
|
||||
|
||||
if (externalLogin == null)
|
||||
{
|
||||
return InternalServerError();
|
||||
}
|
||||
|
||||
if (externalLogin.LoginProvider != provider)
|
||||
{
|
||||
Authentication.SignOut(DefaultAuthenticationTypes.ExternalCookie);
|
||||
return new ChallengeResult(provider, this);
|
||||
}
|
||||
|
||||
ApplicationUser user = await UserManager.FindAsync(new UserLoginInfo(externalLogin.LoginProvider,
|
||||
externalLogin.ProviderKey));
|
||||
|
||||
bool hasRegistered = user != null;
|
||||
|
||||
if (hasRegistered)
|
||||
{
|
||||
Authentication.SignOut(DefaultAuthenticationTypes.ExternalCookie);
|
||||
|
||||
ClaimsIdentity oAuthIdentity = await user.GenerateUserIdentityAsync(UserManager,
|
||||
OAuthDefaults.AuthenticationType);
|
||||
ClaimsIdentity cookieIdentity = await user.GenerateUserIdentityAsync(UserManager,
|
||||
CookieAuthenticationDefaults.AuthenticationType);
|
||||
|
||||
AuthenticationProperties properties = ApplicationOAuthProvider.CreateProperties(user.UserName);
|
||||
Authentication.SignIn(properties, oAuthIdentity, cookieIdentity);
|
||||
}
|
||||
else
|
||||
{
|
||||
IEnumerable<Claim> claims = externalLogin.GetClaims();
|
||||
ClaimsIdentity identity = new ClaimsIdentity(claims, OAuthDefaults.AuthenticationType);
|
||||
Authentication.SignIn(identity);
|
||||
}
|
||||
|
||||
return Ok();
|
||||
}
|
||||
|
||||
// GET api/Account/ExternalLogins?returnUrl=%2F&generateState=true
|
||||
[AllowAnonymous]
|
||||
[Route("ExternalLogins")]
|
||||
public IEnumerable<ExternalLoginViewModel> GetExternalLogins(string returnUrl, bool generateState = false)
|
||||
{
|
||||
IEnumerable<AuthenticationDescription> descriptions = Authentication.GetExternalAuthenticationTypes();
|
||||
List<ExternalLoginViewModel> logins = new List<ExternalLoginViewModel>();
|
||||
|
||||
string state;
|
||||
|
||||
if (generateState)
|
||||
{
|
||||
const int strengthInBits = 256;
|
||||
state = RandomOAuthStateGenerator.Generate(strengthInBits);
|
||||
}
|
||||
else
|
||||
{
|
||||
state = null;
|
||||
}
|
||||
|
||||
foreach (AuthenticationDescription description in descriptions)
|
||||
{
|
||||
ExternalLoginViewModel login = new ExternalLoginViewModel
|
||||
{
|
||||
Name = description.Caption,
|
||||
Url = Url.Route("ExternalLogin", new
|
||||
{
|
||||
provider = description.AuthenticationType,
|
||||
response_type = "token",
|
||||
client_id = Startup.PublicClientId,
|
||||
redirect_uri = new Uri(Request.RequestUri, returnUrl).AbsoluteUri,
|
||||
state = state
|
||||
}),
|
||||
State = state
|
||||
};
|
||||
logins.Add(login);
|
||||
}
|
||||
|
||||
return logins;
|
||||
}
|
||||
|
||||
// POST api/Account/Register
|
||||
[AllowAnonymous]
|
||||
[Route("Register")]
|
||||
public async Task<IHttpActionResult> Register(RegisterBindingModel model)
|
||||
{
|
||||
if (!ModelState.IsValid)
|
||||
{
|
||||
return BadRequest(ModelState);
|
||||
}
|
||||
|
||||
var user = new ApplicationUser() { UserName = model.Email, Email = model.Email };
|
||||
|
||||
IdentityResult result = await UserManager.CreateAsync(user, model.Password);
|
||||
|
||||
if (!result.Succeeded)
|
||||
{
|
||||
return GetErrorResult(result);
|
||||
}
|
||||
|
||||
return Ok();
|
||||
}
|
||||
|
||||
// POST api/Account/RegisterExternal
|
||||
[OverrideAuthentication]
|
||||
[HostAuthentication(DefaultAuthenticationTypes.ExternalBearer)]
|
||||
[Route("RegisterExternal")]
|
||||
public async Task<IHttpActionResult> RegisterExternal(RegisterExternalBindingModel model)
|
||||
{
|
||||
if (!ModelState.IsValid)
|
||||
{
|
||||
return BadRequest(ModelState);
|
||||
}
|
||||
|
||||
var info = await Authentication.GetExternalLoginInfoAsync();
|
||||
if (info == null)
|
||||
{
|
||||
return InternalServerError();
|
||||
}
|
||||
|
||||
var user = new ApplicationUser() { UserName = model.Email, Email = model.Email };
|
||||
|
||||
IdentityResult result = await UserManager.CreateAsync(user);
|
||||
if (!result.Succeeded)
|
||||
{
|
||||
return GetErrorResult(result);
|
||||
}
|
||||
|
||||
result = await UserManager.AddLoginAsync(user.Id, info.Login);
|
||||
if (!result.Succeeded)
|
||||
{
|
||||
return GetErrorResult(result);
|
||||
}
|
||||
return Ok();
|
||||
}
|
||||
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing)
|
||||
{
|
||||
UserManager.Dispose();
|
||||
}
|
||||
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Helpers
|
||||
|
||||
private IAuthenticationManager Authentication
|
||||
{
|
||||
get { return Request.GetOwinContext().Authentication; }
|
||||
}
|
||||
|
||||
private IHttpActionResult GetErrorResult(IdentityResult result)
|
||||
{
|
||||
if (result == null)
|
||||
{
|
||||
return InternalServerError();
|
||||
}
|
||||
|
||||
if (!result.Succeeded)
|
||||
{
|
||||
if (result.Errors != null)
|
||||
{
|
||||
foreach (string error in result.Errors)
|
||||
{
|
||||
ModelState.AddModelError("", error);
|
||||
}
|
||||
}
|
||||
|
||||
if (ModelState.IsValid)
|
||||
{
|
||||
// No ModelState errors are available to send, so just return an empty BadRequest.
|
||||
return BadRequest();
|
||||
}
|
||||
|
||||
return BadRequest(ModelState);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private class ExternalLoginData
|
||||
{
|
||||
public string LoginProvider { get; set; }
|
||||
public string ProviderKey { get; set; }
|
||||
public string UserName { get; set; }
|
||||
|
||||
public IList<Claim> GetClaims()
|
||||
{
|
||||
IList<Claim> claims = new List<Claim>();
|
||||
claims.Add(new Claim(ClaimTypes.NameIdentifier, ProviderKey, null, LoginProvider));
|
||||
|
||||
if (UserName != null)
|
||||
{
|
||||
claims.Add(new Claim(ClaimTypes.Name, UserName, null, LoginProvider));
|
||||
}
|
||||
|
||||
return claims;
|
||||
}
|
||||
|
||||
public static ExternalLoginData FromIdentity(ClaimsIdentity identity)
|
||||
{
|
||||
if (identity == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
Claim providerKeyClaim = identity.FindFirst(ClaimTypes.NameIdentifier);
|
||||
|
||||
if (providerKeyClaim == null || String.IsNullOrEmpty(providerKeyClaim.Issuer)
|
||||
|| String.IsNullOrEmpty(providerKeyClaim.Value))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
if (providerKeyClaim.Issuer == ClaimsIdentity.DefaultIssuer)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return new ExternalLoginData
|
||||
{
|
||||
LoginProvider = providerKeyClaim.Issuer,
|
||||
ProviderKey = providerKeyClaim.Value,
|
||||
UserName = identity.FindFirstValue(ClaimTypes.Name)
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
private static class RandomOAuthStateGenerator
|
||||
{
|
||||
private static RandomNumberGenerator _random = new RNGCryptoServiceProvider();
|
||||
|
||||
public static string Generate(int strengthInBits)
|
||||
{
|
||||
const int bitsPerByte = 8;
|
||||
|
||||
if (strengthInBits % bitsPerByte != 0)
|
||||
{
|
||||
throw new ArgumentException("strengthInBits must be evenly divisible by 8.", "strengthInBits");
|
||||
}
|
||||
|
||||
int strengthInBytes = strengthInBits / bitsPerByte;
|
||||
|
||||
byte[] data = new byte[strengthInBytes];
|
||||
_random.GetBytes(data);
|
||||
return HttpServerUtility.UrlTokenEncode(data);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,50 +1,50 @@
|
|||
[Sun Mar 7 16:02:00 2004] [notice] Apache/1.3.29 (Unix) configured -- resuming normal operations
|
||||
[Sun Mar 7 16:02:00 2004] [info] Server built: Feb 27 2004 13:56:37
|
||||
[Sun Mar 7 16:02:00 2004] [notice] Accept mutex: sysvsem (Default: sysvsem)
|
||||
[Sun Mar 7 16:05:49 2004] [info] [client xx.xx.xx.xx] (104)Connection reset by peer: client stopped connection before send body completed
|
||||
[Sun Mar 7 16:45:56 2004] [info] [client xx.xx.xx.xx] (104)Connection reset by peer: client stopped connection before send body completed
|
||||
[Sun Mar 7 17:13:50 2004] [info] [client xx.xx.xx.xx] (104)Connection reset by peer: client stopped connection before send body completed
|
||||
[Sun Mar 7 17:21:44 2004] [info] [client xx.xx.xx.xx] (104)Connection reset by peer: client stopped connection before send body completed
|
||||
[Sun Mar 7 17:23:53 2004] statistics: Use of uninitialized value in concatenation (.) or string at /home/httpd/twiki/lib/TWiki.pm line 528.
|
||||
[Sun Mar 7 17:23:53 2004] statistics: Can't create file /home/httpd/twiki/data/Main/WebStatistics.txt - Permission denied
|
||||
[Sun Mar 7 17:27:37 2004] [info] [client xx.xx.xx.xx] (104)Connection reset by peer: client stopped connection before send body completed
|
||||
[Sun Mar 7 17:31:39 2004] [info] [client xx.xx.xx.xx] (104)Connection reset by peer: client stopped connection before send body completed
|
||||
[Sun Mar 7 17:58:00 2004] [info] [client xx.xx.xx.xx] (104)Connection reset by peer: client stopped connection before send body completed
|
||||
[Sun Mar 7 18:00:09 2004] [info] [client xx.xx.xx.xx] (104)Connection reset by peer: client stopped connection before send body completed
|
||||
[Sun Mar 7 18:10:09 2004] [info] [client xx.xx.xx.xx] (104)Connection reset by peer: client stopped connection before send body completed
|
||||
[Sun Mar 7 18:19:01 2004] [info] [client xx.xx.xx.xx] (104)Connection reset by peer: client stopped connection before send body completed
|
||||
[Sun Mar 7 18:42:29 2004] [info] [client xx.xx.xx.xx] (104)Connection reset by peer: client stopped connection before send body completed
|
||||
[Sun Mar 7 18:52:30 2004] [info] [client xx.xx.xx.xx] (104)Connection reset by peer: client stopped connection before send body completed
|
||||
[Sun Mar 7 18:58:52 2004] [info] [client xx.xx.xx.xx] (104)Connection reset by peer: client stopped connection before send body completed
|
||||
[Sun Mar 7 19:03:58 2004] [info] [client xx.xx.xx.xx] (104)Connection reset by peer: client stopped connection before send body completed
|
||||
[Sun Mar 7 19:08:55 2004] [info] [client xx.xx.xx.xx] (104)Connection reset by peer: client stopped connection before send body completed
|
||||
[Sun Mar 7 20:04:35 2004] [info] [client xx.xx.xx.xx] (104)Connection reset by peer: client stopped connection before send body completed
|
||||
[Sun Mar 7 20:11:33 2004] [info] [client xx.xx.xx.xx] (104)Connection reset by peer: client stopped connection before send body completed
|
||||
[Sun Mar 7 20:12:55 2004] [info] [client xx.xx.xx.xx] (104)Connection reset by peer: client stopped connection before send body completed
|
||||
[Sun Mar 7 20:25:31 2004] [info] [client xx.xx.xx.xx] (104)Connection reset by peer: client stopped connection before send body completed
|
||||
[Sun Mar 7 20:44:48 2004] [info] [client xx.xx.xx.xx] (104)Connection reset by peer: client stopped connection before send body completed
|
||||
[Sun Mar 7 20:58:27 2004] [info] [client xx.xx.xx.xx] (104)Connection reset by peer: client stopped connection before send body completed
|
||||
[Sun Mar 7 21:16:17 2004] [error] [client xx.xx.xx.xx] File does not exist: /home/httpd/twiki/view/Main/WebHome
|
||||
[Sun Mar 7 21:20:14 2004] [info] [client xx.xx.xx.xx] (104)Connection reset by peer: client stopped connection before send body completed
|
||||
[Sun Mar 7 21:31:12 2004] [info] [client xx.xx.xx.xx] (104)Connection reset by peer: client stopped connection before send body completed
|
||||
[Sun Mar 7 21:39:55 2004] [info] [client xx.xx.xx.xx] (104)Connection reset by peer: client stopped connection before send body completed
|
||||
[Sun Mar 7 21:44:10 2004] [info] [client xx.xx.xx.xx] (104)Connection reset by peer: client stopped connection before send body completed
|
||||
[Mon Mar 8 01:35:13 2004] [info] [client xx.xx.xx.xx] (104)Connection reset by peer: client stopped connection before send body completed
|
||||
[Mon Mar 8 01:47:06 2004] [info] [client xx.xx.xx.xx] (104)Connection reset by peer: client stopped connection before send body completed
|
||||
[Mon Mar 8 01:59:13 2004] [info] [client xx.xx.xx.xx] (104)Connection reset by peer: client stopped connection before send body completed
|
||||
[Mon Mar 8 02:12:24 2004] [info] [client xx.xx.xx.xx] (104)Connection reset by peer: client stopped connection before send body completed
|
||||
[Mon Mar 8 02:54:54 2004] [info] [client xx.xx.xx.xx] (104)Connection reset by peer: client stopped connection before send body completed
|
||||
[Mon Mar 8 03:46:27 2004] [info] [client xx.xx.xx.xx] (104)Connection reset by peer: client stopped connection before send body completed
|
||||
[Mon Mar 8 03:48:18 2004] [info] [client xx.xx.xx.xx] (104)Connection reset by peer: client stopped connection before send body completed
|
||||
[Mon Mar 8 03:52:17 2004] [info] [client xx.xx.xx.xx] (104)Connection reset by peer: client stopped connection before send body completed
|
||||
[Mon Mar 8 03:55:09 2004] [info] [client xx.xx.xx.xx] (104)Connection reset by peer: client stopped connection before send body completed
|
||||
[Mon Mar 8 04:22:55 2004] [info] [client xx.xx.xx.xx] (104)Connection reset by peer: client stopped connection before send body completed
|
||||
[Mon Mar 8 04:24:47 2004] [info] [client xx.xx.xx.xx] (104)Connection reset by peer: client stopped connection before send body completed
|
||||
[Mon Mar 8 04:40:32 2004] [info] [client xx.xx.xx.xx] (104)Connection reset by peer: client stopped connection before send body completed
|
||||
[Mon Mar 8 04:55:40 2004] [info] [client xx.xx.xx.xx] (104)Connection reset by peer: client stopped connection before send body completed
|
||||
[Mon Mar 8 04:59:13 2004] [info] [client xx.xx.xx.xx] (104)Connection reset by peer: client stopped connection before send body completed
|
||||
[Mon Mar 8 05:22:57 2004] [info] [client xx.xx.xx.xx] (104)Connection reset by peer: client stopped connection before send body completed
|
||||
[Mon Mar 8 05:24:29 2004] [info] [client xx.xx.xx.xx] (104)Connection reset by peer: client stopped connection before send body completed
|
||||
[Mon Mar 8 05:31:47 2004] [info] [client xx.xx.xx.xx] (104)Connection reset by peer: client stopped connection before send body completed
|
||||
<11>httpd[31628]: [error] [client xx.xx.xx.xx] File does not exist: /usr/local/installed/apache/htdocs/squirrelmail/_vti_inf.html in 29-Mar 15:18:20.50 from xx.xx.xx.xx
|
||||
[Sun Mar 7 16:02:00 2004] [notice] Apache/1.3.29 (Unix) configured -- resuming normal operations
|
||||
[Sun Mar 7 16:02:00 2004] [info] Server built: Feb 27 2004 13:56:37
|
||||
[Sun Mar 7 16:02:00 2004] [notice] Accept mutex: sysvsem (Default: sysvsem)
|
||||
[Sun Mar 7 16:05:49 2004] [info] [client xx.xx.xx.xx] (104)Connection reset by peer: client stopped connection before send body completed
|
||||
[Sun Mar 7 16:45:56 2004] [info] [client xx.xx.xx.xx] (104)Connection reset by peer: client stopped connection before send body completed
|
||||
[Sun Mar 7 17:13:50 2004] [info] [client xx.xx.xx.xx] (104)Connection reset by peer: client stopped connection before send body completed
|
||||
[Sun Mar 7 17:21:44 2004] [info] [client xx.xx.xx.xx] (104)Connection reset by peer: client stopped connection before send body completed
|
||||
[Sun Mar 7 17:23:53 2004] statistics: Use of uninitialized value in concatenation (.) or string at /home/httpd/twiki/lib/TWiki.pm line 528.
|
||||
[Sun Mar 7 17:23:53 2004] statistics: Can't create file /home/httpd/twiki/data/Main/WebStatistics.txt - Permission denied
|
||||
[Sun Mar 7 17:27:37 2004] [info] [client xx.xx.xx.xx] (104)Connection reset by peer: client stopped connection before send body completed
|
||||
[Sun Mar 7 17:31:39 2004] [info] [client xx.xx.xx.xx] (104)Connection reset by peer: client stopped connection before send body completed
|
||||
[Sun Mar 7 17:58:00 2004] [info] [client xx.xx.xx.xx] (104)Connection reset by peer: client stopped connection before send body completed
|
||||
[Sun Mar 7 18:00:09 2004] [info] [client xx.xx.xx.xx] (104)Connection reset by peer: client stopped connection before send body completed
|
||||
[Sun Mar 7 18:10:09 2004] [info] [client xx.xx.xx.xx] (104)Connection reset by peer: client stopped connection before send body completed
|
||||
[Sun Mar 7 18:19:01 2004] [info] [client xx.xx.xx.xx] (104)Connection reset by peer: client stopped connection before send body completed
|
||||
[Sun Mar 7 18:42:29 2004] [info] [client xx.xx.xx.xx] (104)Connection reset by peer: client stopped connection before send body completed
|
||||
[Sun Mar 7 18:52:30 2004] [info] [client xx.xx.xx.xx] (104)Connection reset by peer: client stopped connection before send body completed
|
||||
[Sun Mar 7 18:58:52 2004] [info] [client xx.xx.xx.xx] (104)Connection reset by peer: client stopped connection before send body completed
|
||||
[Sun Mar 7 19:03:58 2004] [info] [client xx.xx.xx.xx] (104)Connection reset by peer: client stopped connection before send body completed
|
||||
[Sun Mar 7 19:08:55 2004] [info] [client xx.xx.xx.xx] (104)Connection reset by peer: client stopped connection before send body completed
|
||||
[Sun Mar 7 20:04:35 2004] [info] [client xx.xx.xx.xx] (104)Connection reset by peer: client stopped connection before send body completed
|
||||
[Sun Mar 7 20:11:33 2004] [info] [client xx.xx.xx.xx] (104)Connection reset by peer: client stopped connection before send body completed
|
||||
[Sun Mar 7 20:12:55 2004] [info] [client xx.xx.xx.xx] (104)Connection reset by peer: client stopped connection before send body completed
|
||||
[Sun Mar 7 20:25:31 2004] [info] [client xx.xx.xx.xx] (104)Connection reset by peer: client stopped connection before send body completed
|
||||
[Sun Mar 7 20:44:48 2004] [info] [client xx.xx.xx.xx] (104)Connection reset by peer: client stopped connection before send body completed
|
||||
[Sun Mar 7 20:58:27 2004] [info] [client xx.xx.xx.xx] (104)Connection reset by peer: client stopped connection before send body completed
|
||||
[Sun Mar 7 21:16:17 2004] [error] [client xx.xx.xx.xx] File does not exist: /home/httpd/twiki/view/Main/WebHome
|
||||
[Sun Mar 7 21:20:14 2004] [info] [client xx.xx.xx.xx] (104)Connection reset by peer: client stopped connection before send body completed
|
||||
[Sun Mar 7 21:31:12 2004] [info] [client xx.xx.xx.xx] (104)Connection reset by peer: client stopped connection before send body completed
|
||||
[Sun Mar 7 21:39:55 2004] [info] [client xx.xx.xx.xx] (104)Connection reset by peer: client stopped connection before send body completed
|
||||
[Sun Mar 7 21:44:10 2004] [info] [client xx.xx.xx.xx] (104)Connection reset by peer: client stopped connection before send body completed
|
||||
[Mon Mar 8 01:35:13 2004] [info] [client xx.xx.xx.xx] (104)Connection reset by peer: client stopped connection before send body completed
|
||||
[Mon Mar 8 01:47:06 2004] [info] [client xx.xx.xx.xx] (104)Connection reset by peer: client stopped connection before send body completed
|
||||
[Mon Mar 8 01:59:13 2004] [info] [client xx.xx.xx.xx] (104)Connection reset by peer: client stopped connection before send body completed
|
||||
[Mon Mar 8 02:12:24 2004] [info] [client xx.xx.xx.xx] (104)Connection reset by peer: client stopped connection before send body completed
|
||||
[Mon Mar 8 02:54:54 2004] [info] [client xx.xx.xx.xx] (104)Connection reset by peer: client stopped connection before send body completed
|
||||
[Mon Mar 8 03:46:27 2004] [info] [client xx.xx.xx.xx] (104)Connection reset by peer: client stopped connection before send body completed
|
||||
[Mon Mar 8 03:48:18 2004] [info] [client xx.xx.xx.xx] (104)Connection reset by peer: client stopped connection before send body completed
|
||||
[Mon Mar 8 03:52:17 2004] [info] [client xx.xx.xx.xx] (104)Connection reset by peer: client stopped connection before send body completed
|
||||
[Mon Mar 8 03:55:09 2004] [info] [client xx.xx.xx.xx] (104)Connection reset by peer: client stopped connection before send body completed
|
||||
[Mon Mar 8 04:22:55 2004] [info] [client xx.xx.xx.xx] (104)Connection reset by peer: client stopped connection before send body completed
|
||||
[Mon Mar 8 04:24:47 2004] [info] [client xx.xx.xx.xx] (104)Connection reset by peer: client stopped connection before send body completed
|
||||
[Mon Mar 8 04:40:32 2004] [info] [client xx.xx.xx.xx] (104)Connection reset by peer: client stopped connection before send body completed
|
||||
[Mon Mar 8 04:55:40 2004] [info] [client xx.xx.xx.xx] (104)Connection reset by peer: client stopped connection before send body completed
|
||||
[Mon Mar 8 04:59:13 2004] [info] [client xx.xx.xx.xx] (104)Connection reset by peer: client stopped connection before send body completed
|
||||
[Mon Mar 8 05:22:57 2004] [info] [client xx.xx.xx.xx] (104)Connection reset by peer: client stopped connection before send body completed
|
||||
[Mon Mar 8 05:24:29 2004] [info] [client xx.xx.xx.xx] (104)Connection reset by peer: client stopped connection before send body completed
|
||||
[Mon Mar 8 05:31:47 2004] [info] [client xx.xx.xx.xx] (104)Connection reset by peer: client stopped connection before send body completed
|
||||
<11>httpd[31628]: [error] [client xx.xx.xx.xx] File does not exist: /usr/local/installed/apache/htdocs/squirrelmail/_vti_inf.html in 29-Mar 15:18:20.50 from xx.xx.xx.xx
|
||||
<11>httpd[25859]: [error] [client xx.xx.xx.xx] File does not exist: /usr/local/installed/apache/htdocs/squirrelmail/_vti_bin/shtml.exe/_vti_rpc in 29-Mar 15:18:20.54 from xx.xx.xx.xx
|
||||
File diff suppressed because it is too large
Load diff
|
|
@ -1,23 +1,23 @@
|
|||
<!DOCTYPE HTML>
|
||||
<!--
|
||||
Comments are overrated
|
||||
-->
|
||||
<html>
|
||||
<head>
|
||||
<title>HTML Sample</title>
|
||||
<style type="text/css">
|
||||
h1 {
|
||||
color: #CCA3A3;
|
||||
}
|
||||
body {
|
||||
}
|
||||
</style>
|
||||
<script type="text/javascript">
|
||||
window.alert("I am a sample...");
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Heading No.1</h1>
|
||||
<input disabled type="button" value="Click me" />
|
||||
</body>
|
||||
</html>
|
||||
<!DOCTYPE HTML>
|
||||
<!--
|
||||
Comments are overrated
|
||||
-->
|
||||
<html>
|
||||
<head>
|
||||
<title>HTML Sample</title>
|
||||
<style type="text/css">
|
||||
h1 {
|
||||
color: #CCA3A3;
|
||||
}
|
||||
body {
|
||||
}
|
||||
</style>
|
||||
<script type="text/javascript">
|
||||
window.alert("I am a sample...");
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Heading No.1</h1>
|
||||
<input disabled type="button" value="Click me" />
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
|||
|
|
@ -1,222 +1,222 @@
|
|||
/*
|
||||
© Microsoft. All rights reserved.
|
||||
|
||||
https://microsoft.com
|
||||
blablahttp://en.wikipedia.org/wiki/Timisoara bla bla
|
||||
blabla http://en.wikipedia.org/wiki/Timisoara bla bla
|
||||
|
||||
This library is supported for use in Windows Tailored Apps only.
|
||||
|
||||
Build: 6.2.8100.0
|
||||
Version: 0.5
|
||||
*/
|
||||
|
||||
var קודמות = "מיותר קודמות צ'ט של, אם לשון העברית שינויים ויש, אם";
|
||||
|
||||
'a string\
|
||||
on multiple lines';
|
||||
(function (global, undefined) {
|
||||
"use strict";
|
||||
undefinedVariable = {}; undefinedVariable.bar = 5;
|
||||
undefinedVariable.foo = 5; undefinedVariable.baz = 10;
|
||||
|
||||
function initializeProperties(target, members) {
|
||||
var keys = Object.keys(members);
|
||||
var properties;
|
||||
var i, len;
|
||||
for (i = 0, len = keys.length; i < len; i++) {
|
||||
var key = keys[i];
|
||||
var enumerable = key.charCodeAt(0) !== /*_*/95;
|
||||
var member = members[key];
|
||||
if (member && typeof member === 'object') {
|
||||
if (member.value !== undefined || typeof member.get === 'function' || typeof member.set === 'function') {
|
||||
if (member.enumerable === undefined) {
|
||||
member.enumerable = enumerable;
|
||||
}
|
||||
properties = properties || {};
|
||||
properties[key] = member;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if (!enumerable) {
|
||||
properties = properties || {};
|
||||
properties[key] = { value: member, enumerable: enumerable, configurable: true, writable: true }
|
||||
continue;
|
||||
}
|
||||
target[key] = member;
|
||||
}
|
||||
if (properties) {
|
||||
Object.defineProperties(target, properties);
|
||||
}
|
||||
}
|
||||
|
||||
(function (rootNamespace) {
|
||||
|
||||
// Create the rootNamespace in the global namespace
|
||||
if (!global[rootNamespace]) {
|
||||
global[rootNamespace] = Object.create(Object.prototype);
|
||||
}
|
||||
|
||||
// Cache the rootNamespace we just created in a local variable
|
||||
var _rootNamespace = global[rootNamespace];
|
||||
if (!_rootNamespace.Namespace) {
|
||||
_rootNamespace.Namespace = Object.create(Object.prototype);
|
||||
}
|
||||
|
||||
function defineWithParent(parentNamespace, name, members) {
|
||||
/// <summary locid="1">
|
||||
/// Defines a new namespace with the specified name, under the specified parent namespace.
|
||||
/// </summary>
|
||||
/// <param name="parentNamespace" type="Object" locid="2">
|
||||
/// The parent namespace which will contain the new namespace.
|
||||
/// </param>
|
||||
/// <param name="name" type="String" locid="3">
|
||||
/// Name of the new namespace.
|
||||
/// </param>
|
||||
/// <param name="members" type="Object" locid="4">
|
||||
/// Members in the new namespace.
|
||||
/// </param>
|
||||
/// <returns locid="5">
|
||||
/// The newly defined namespace.
|
||||
/// </returns>
|
||||
var currentNamespace = parentNamespace,
|
||||
namespaceFragments = name.split(".");
|
||||
|
||||
for (var i = 0, len = namespaceFragments.length; i < len; i++) {
|
||||
var namespaceName = namespaceFragments[i];
|
||||
if (!currentNamespace[namespaceName]) {
|
||||
Object.defineProperty(currentNamespace, namespaceName,
|
||||
{ value: {}, writable: false, enumerable: true, configurable: true }
|
||||
);
|
||||
}
|
||||
currentNamespace = currentNamespace[namespaceName];
|
||||
}
|
||||
|
||||
if (members) {
|
||||
initializeProperties(currentNamespace, members);
|
||||
}
|
||||
|
||||
return currentNamespace;
|
||||
};
|
||||
|
||||
function define(name, members) {
|
||||
/// <summary locid="6">
|
||||
/// Defines a new namespace with the specified name.
|
||||
/// </summary>
|
||||
/// <param name="name" type="String" locid="7">
|
||||
/// Name of the namespace. This could be a dot-separated nested name.
|
||||
/// </param>
|
||||
/// <param name="members" type="Object" locid="4">
|
||||
/// Members in the new namespace.
|
||||
/// </param>
|
||||
/// <returns locid="5">
|
||||
/// The newly defined namespace.
|
||||
/// </returns>
|
||||
return defineWithParent(global, name, members);
|
||||
}
|
||||
|
||||
// Establish members of the "WinJS.Namespace" namespace
|
||||
Object.defineProperties(_rootNamespace.Namespace, {
|
||||
|
||||
defineWithParent: { value: defineWithParent, writable: true, enumerable: true },
|
||||
|
||||
define: { value: define, writable: true, enumerable: true }
|
||||
|
||||
});
|
||||
|
||||
})("WinJS");
|
||||
|
||||
(function (WinJS) {
|
||||
|
||||
function define(constructor, instanceMembers, staticMembers) {
|
||||
/// <summary locid="8">
|
||||
/// Defines a class using the given constructor and with the specified instance members.
|
||||
/// </summary>
|
||||
/// <param name="constructor" type="Function" locid="9">
|
||||
/// A constructor function that will be used to instantiate this class.
|
||||
/// </param>
|
||||
/// <param name="instanceMembers" type="Object" locid="10">
|
||||
/// The set of instance fields, properties and methods to be made available on the class.
|
||||
/// </param>
|
||||
/// <param name="staticMembers" type="Object" locid="11">
|
||||
/// The set of static fields, properties and methods to be made available on the class.
|
||||
/// </param>
|
||||
/// <returns type="Function" locid="12">
|
||||
/// The newly defined class.
|
||||
/// </returns>
|
||||
constructor = constructor || function () { };
|
||||
if (instanceMembers) {
|
||||
initializeProperties(constructor.prototype, instanceMembers);
|
||||
}
|
||||
if (staticMembers) {
|
||||
initializeProperties(constructor, staticMembers);
|
||||
}
|
||||
return constructor;
|
||||
}
|
||||
|
||||
function derive(baseClass, constructor, instanceMembers, staticMembers) {
|
||||
/// <summary locid="13">
|
||||
/// Uses prototypal inheritance to create a sub-class based on the supplied baseClass parameter.
|
||||
/// </summary>
|
||||
/// <param name="baseClass" type="Function" locid="14">
|
||||
/// The class to inherit from.
|
||||
/// </param>
|
||||
/// <param name="constructor" type="Function" locid="9">
|
||||
/// A constructor function that will be used to instantiate this class.
|
||||
/// </param>
|
||||
/// <param name="instanceMembers" type="Object" locid="10">
|
||||
/// The set of instance fields, properties and methods to be made available on the class.
|
||||
/// </param>
|
||||
/// <param name="staticMembers" type="Object" locid="11">
|
||||
/// The set of static fields, properties and methods to be made available on the class.
|
||||
/// </param>
|
||||
/// <returns type="Function" locid="12">
|
||||
/// The newly defined class.
|
||||
/// </returns>
|
||||
if (baseClass) {
|
||||
constructor = constructor || function () { };
|
||||
var basePrototype = baseClass.prototype;
|
||||
constructor.prototype = Object.create(basePrototype);
|
||||
Object.defineProperty(constructor.prototype, "_super", { value: basePrototype });
|
||||
Object.defineProperty(constructor.prototype, "constructor", { value: constructor });
|
||||
if (instanceMembers) {
|
||||
initializeProperties(constructor.prototype, instanceMembers);
|
||||
}
|
||||
if (staticMembers) {
|
||||
initializeProperties(constructor, staticMembers);
|
||||
}
|
||||
return constructor;
|
||||
} else {
|
||||
return define(constructor, instanceMembers, staticMembers);
|
||||
}
|
||||
}
|
||||
|
||||
function mix(constructor) {
|
||||
/// <summary locid="15">
|
||||
/// Defines a class using the given constructor and the union of the set of instance members
|
||||
/// specified by all the mixin objects. The mixin parameter list can be of variable length.
|
||||
/// </summary>
|
||||
/// <param name="constructor" locid="9">
|
||||
/// A constructor function that will be used to instantiate this class.
|
||||
/// </param>
|
||||
/// <returns locid="12">
|
||||
/// The newly defined class.
|
||||
/// </returns>
|
||||
constructor = constructor || function () { };
|
||||
var i, len;
|
||||
for (i = 0, len = arguments.length; i < len; i++) {
|
||||
initializeProperties(constructor.prototype, arguments[i]);
|
||||
}
|
||||
return constructor;
|
||||
}
|
||||
|
||||
// Establish members of "WinJS.Class" namespace
|
||||
WinJS.Namespace.define("WinJS.Class", {
|
||||
define: define,
|
||||
derive: derive,
|
||||
mix: mix
|
||||
});
|
||||
|
||||
})(WinJS);
|
||||
|
||||
/*
|
||||
© Microsoft. All rights reserved.
|
||||
|
||||
https://microsoft.com
|
||||
blablahttp://en.wikipedia.org/wiki/Timisoara bla bla
|
||||
blabla http://en.wikipedia.org/wiki/Timisoara bla bla
|
||||
|
||||
This library is supported for use in Windows Tailored Apps only.
|
||||
|
||||
Build: 6.2.8100.0
|
||||
Version: 0.5
|
||||
*/
|
||||
|
||||
var קודמות = "מיותר קודמות צ'ט של, אם לשון העברית שינויים ויש, אם";
|
||||
|
||||
'a string\
|
||||
on multiple lines';
|
||||
(function (global, undefined) {
|
||||
"use strict";
|
||||
undefinedVariable = {}; undefinedVariable.bar = 5;
|
||||
undefinedVariable.foo = 5; undefinedVariable.baz = 10;
|
||||
|
||||
function initializeProperties(target, members) {
|
||||
var keys = Object.keys(members);
|
||||
var properties;
|
||||
var i, len;
|
||||
for (i = 0, len = keys.length; i < len; i++) {
|
||||
var key = keys[i];
|
||||
var enumerable = key.charCodeAt(0) !== /*_*/95;
|
||||
var member = members[key];
|
||||
if (member && typeof member === 'object') {
|
||||
if (member.value !== undefined || typeof member.get === 'function' || typeof member.set === 'function') {
|
||||
if (member.enumerable === undefined) {
|
||||
member.enumerable = enumerable;
|
||||
}
|
||||
properties = properties || {};
|
||||
properties[key] = member;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if (!enumerable) {
|
||||
properties = properties || {};
|
||||
properties[key] = { value: member, enumerable: enumerable, configurable: true, writable: true }
|
||||
continue;
|
||||
}
|
||||
target[key] = member;
|
||||
}
|
||||
if (properties) {
|
||||
Object.defineProperties(target, properties);
|
||||
}
|
||||
}
|
||||
|
||||
(function (rootNamespace) {
|
||||
|
||||
// Create the rootNamespace in the global namespace
|
||||
if (!global[rootNamespace]) {
|
||||
global[rootNamespace] = Object.create(Object.prototype);
|
||||
}
|
||||
|
||||
// Cache the rootNamespace we just created in a local variable
|
||||
var _rootNamespace = global[rootNamespace];
|
||||
if (!_rootNamespace.Namespace) {
|
||||
_rootNamespace.Namespace = Object.create(Object.prototype);
|
||||
}
|
||||
|
||||
function defineWithParent(parentNamespace, name, members) {
|
||||
/// <summary locid="1">
|
||||
/// Defines a new namespace with the specified name, under the specified parent namespace.
|
||||
/// </summary>
|
||||
/// <param name="parentNamespace" type="Object" locid="2">
|
||||
/// The parent namespace which will contain the new namespace.
|
||||
/// </param>
|
||||
/// <param name="name" type="String" locid="3">
|
||||
/// Name of the new namespace.
|
||||
/// </param>
|
||||
/// <param name="members" type="Object" locid="4">
|
||||
/// Members in the new namespace.
|
||||
/// </param>
|
||||
/// <returns locid="5">
|
||||
/// The newly defined namespace.
|
||||
/// </returns>
|
||||
var currentNamespace = parentNamespace,
|
||||
namespaceFragments = name.split(".");
|
||||
|
||||
for (var i = 0, len = namespaceFragments.length; i < len; i++) {
|
||||
var namespaceName = namespaceFragments[i];
|
||||
if (!currentNamespace[namespaceName]) {
|
||||
Object.defineProperty(currentNamespace, namespaceName,
|
||||
{ value: {}, writable: false, enumerable: true, configurable: true }
|
||||
);
|
||||
}
|
||||
currentNamespace = currentNamespace[namespaceName];
|
||||
}
|
||||
|
||||
if (members) {
|
||||
initializeProperties(currentNamespace, members);
|
||||
}
|
||||
|
||||
return currentNamespace;
|
||||
};
|
||||
|
||||
function define(name, members) {
|
||||
/// <summary locid="6">
|
||||
/// Defines a new namespace with the specified name.
|
||||
/// </summary>
|
||||
/// <param name="name" type="String" locid="7">
|
||||
/// Name of the namespace. This could be a dot-separated nested name.
|
||||
/// </param>
|
||||
/// <param name="members" type="Object" locid="4">
|
||||
/// Members in the new namespace.
|
||||
/// </param>
|
||||
/// <returns locid="5">
|
||||
/// The newly defined namespace.
|
||||
/// </returns>
|
||||
return defineWithParent(global, name, members);
|
||||
}
|
||||
|
||||
// Establish members of the "WinJS.Namespace" namespace
|
||||
Object.defineProperties(_rootNamespace.Namespace, {
|
||||
|
||||
defineWithParent: { value: defineWithParent, writable: true, enumerable: true },
|
||||
|
||||
define: { value: define, writable: true, enumerable: true }
|
||||
|
||||
});
|
||||
|
||||
})("WinJS");
|
||||
|
||||
(function (WinJS) {
|
||||
|
||||
function define(constructor, instanceMembers, staticMembers) {
|
||||
/// <summary locid="8">
|
||||
/// Defines a class using the given constructor and with the specified instance members.
|
||||
/// </summary>
|
||||
/// <param name="constructor" type="Function" locid="9">
|
||||
/// A constructor function that will be used to instantiate this class.
|
||||
/// </param>
|
||||
/// <param name="instanceMembers" type="Object" locid="10">
|
||||
/// The set of instance fields, properties and methods to be made available on the class.
|
||||
/// </param>
|
||||
/// <param name="staticMembers" type="Object" locid="11">
|
||||
/// The set of static fields, properties and methods to be made available on the class.
|
||||
/// </param>
|
||||
/// <returns type="Function" locid="12">
|
||||
/// The newly defined class.
|
||||
/// </returns>
|
||||
constructor = constructor || function () { };
|
||||
if (instanceMembers) {
|
||||
initializeProperties(constructor.prototype, instanceMembers);
|
||||
}
|
||||
if (staticMembers) {
|
||||
initializeProperties(constructor, staticMembers);
|
||||
}
|
||||
return constructor;
|
||||
}
|
||||
|
||||
function derive(baseClass, constructor, instanceMembers, staticMembers) {
|
||||
/// <summary locid="13">
|
||||
/// Uses prototypal inheritance to create a sub-class based on the supplied baseClass parameter.
|
||||
/// </summary>
|
||||
/// <param name="baseClass" type="Function" locid="14">
|
||||
/// The class to inherit from.
|
||||
/// </param>
|
||||
/// <param name="constructor" type="Function" locid="9">
|
||||
/// A constructor function that will be used to instantiate this class.
|
||||
/// </param>
|
||||
/// <param name="instanceMembers" type="Object" locid="10">
|
||||
/// The set of instance fields, properties and methods to be made available on the class.
|
||||
/// </param>
|
||||
/// <param name="staticMembers" type="Object" locid="11">
|
||||
/// The set of static fields, properties and methods to be made available on the class.
|
||||
/// </param>
|
||||
/// <returns type="Function" locid="12">
|
||||
/// The newly defined class.
|
||||
/// </returns>
|
||||
if (baseClass) {
|
||||
constructor = constructor || function () { };
|
||||
var basePrototype = baseClass.prototype;
|
||||
constructor.prototype = Object.create(basePrototype);
|
||||
Object.defineProperty(constructor.prototype, "_super", { value: basePrototype });
|
||||
Object.defineProperty(constructor.prototype, "constructor", { value: constructor });
|
||||
if (instanceMembers) {
|
||||
initializeProperties(constructor.prototype, instanceMembers);
|
||||
}
|
||||
if (staticMembers) {
|
||||
initializeProperties(constructor, staticMembers);
|
||||
}
|
||||
return constructor;
|
||||
} else {
|
||||
return define(constructor, instanceMembers, staticMembers);
|
||||
}
|
||||
}
|
||||
|
||||
function mix(constructor) {
|
||||
/// <summary locid="15">
|
||||
/// Defines a class using the given constructor and the union of the set of instance members
|
||||
/// specified by all the mixin objects. The mixin parameter list can be of variable length.
|
||||
/// </summary>
|
||||
/// <param name="constructor" locid="9">
|
||||
/// A constructor function that will be used to instantiate this class.
|
||||
/// </param>
|
||||
/// <returns locid="12">
|
||||
/// The newly defined class.
|
||||
/// </returns>
|
||||
constructor = constructor || function () { };
|
||||
var i, len;
|
||||
for (i = 0, len = arguments.length; i < len; i++) {
|
||||
initializeProperties(constructor.prototype, arguments[i]);
|
||||
}
|
||||
return constructor;
|
||||
}
|
||||
|
||||
// Establish members of "WinJS.Class" namespace
|
||||
WinJS.Namespace.define("WinJS.Class", {
|
||||
define: define,
|
||||
derive: derive,
|
||||
mix: mix
|
||||
});
|
||||
|
||||
})(WinJS);
|
||||
|
||||
})(this);
|
||||
Loading…
Add table
Add a link
Reference in a new issue